File tree Expand file tree Collapse file tree 5 files changed +10
-4
lines changed
src/Symfony/Component/Translation Expand file tree Collapse file tree 5 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 140140 "league/uri" : " ^6.5|^7.0" ,
141141 "masterminds/html5" : " ^2.7.2" ,
142142 "monolog/monolog" : " ^1.25.1|^2" ,
143+ "nikic/php-parser" : " ^4.16|^5.0" ,
143144 "nyholm/psr7" : " ^1.0" ,
144145 "pda/pheanstalk" : " ^4.0" ,
145146 "php-http/discovery" : " ^1.15" ,
Original file line number Diff line number Diff line change 1515use PhpParser \NodeVisitor ;
1616use PhpParser \Parser ;
1717use PhpParser \ParserFactory ;
18+ use PhpParser \PhpVersion ;
1819use Symfony \Component \Finder \Finder ;
1920use Symfony \Component \Translation \Extractor \Visitor \AbstractVisitor ;
2021use Symfony \Component \Translation \MessageCatalogue ;
@@ -39,7 +40,11 @@ public function __construct(
3940 throw new \LogicException (sprintf ('You cannot use "%s" as the "nikic/php-parser" package is not installed. Try running "composer require nikic/php-parser". ' , static ::class));
4041 }
4142
42- $ this ->parser = (new ParserFactory ())->create (ParserFactory::PREFER_PHP7 );
43+ if (method_exists (ParserFactory::class, 'createForVersion ' )) {
44+ $ this ->parser = (new ParserFactory ())->createForVersion (PhpVersion::fromString ('8.2 ' ));
45+ } else {
46+ $ this ->parser = (new ParserFactory ())->create (ParserFactory::PREFER_PHP7 );
47+ }
4348 }
4449
4550 public function extract (iterable |string $ resource , MessageCatalogue $ catalogue ): void
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public function enterNode(Node $node): ?Node
4242 return null ;
4343 }
4444
45- $ parts = $ className ->parts ;
45+ $ parts = $ className ->getParts () ;
4646 $ isConstraintClass = false ;
4747
4848 foreach ($ parts as $ part ) {
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public function enterNode(Node $node): ?Node
3434 return null ;
3535 }
3636
37- if (!\in_array ('TranslatableMessage ' , $ className ->parts , true )) {
37+ if (!\in_array ('TranslatableMessage ' , $ className ->getParts () , true )) {
3838 return null ;
3939 }
4040
Original file line number Diff line number Diff line change 2222 "symfony/translation-contracts" : " ^2.5|^3.0"
2323 },
2424 "require-dev" : {
25- "nikic/php-parser" : " ^4.13" ,
25+ "nikic/php-parser" : " ^4.13|^5.0 " ,
2626 "symfony/config" : " ^5.4|^6.0" ,
2727 "symfony/console" : " ^5.4|^6.0" ,
2828 "symfony/dependency-injection" : " ^5.4|^6.0" ,
You can’t perform that action at this time.
0 commit comments