Skip to content

Commit 3c47396

Browse files
authored
Merge pull request #361 from glaubinix/patch-1
Twig: adjust version check to not depend on changing VERSION_ID constant
2 parents 00d275a + e0a762a commit 3c47396

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

phpstan.neon.dist

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ parameters:
2828

2929
dynamicConstantNames:
3030
- Symfony\Component\HttpKernel\Kernel::VERSION
31-
- Twig\Environment::VERSION_ID
31+
- Twig\Environment::MAJOR_VERSION
32+
- Twig\Environment::MINOR_VERSION

src/Twig/Version.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@
1313

1414
namespace Nelmio\SecurityBundle\Twig;
1515

16+
use Twig\Environment;
17+
1618
/**
1719
* @internal
1820
*/
1921
final class Version
2022
{
2123
public static function needsNodeTag(): bool
2224
{
23-
return \Twig\Environment::VERSION_ID < 301200;
25+
if (Environment::MAJOR_VERSION < 3) {
26+
return true;
27+
}
28+
29+
return Environment::MAJOR_VERSION === 3 && Environment::MINOR_VERSION < 12;
2430
}
2531
}

0 commit comments

Comments
 (0)