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 140
140
"league/uri" : " ^6.5|^7.0" ,
141
141
"masterminds/html5" : " ^2.7.2" ,
142
142
"monolog/monolog" : " ^1.25.1|^2" ,
143
+ "nikic/php-parser" : " ^4.16|^5.0" ,
143
144
"nyholm/psr7" : " ^1.0" ,
144
145
"pda/pheanstalk" : " ^4.0" ,
145
146
"php-http/discovery" : " ^1.15" ,
Original file line number Diff line number Diff line change 15
15
use PhpParser \NodeVisitor ;
16
16
use PhpParser \Parser ;
17
17
use PhpParser \ParserFactory ;
18
+ use PhpParser \PhpVersion ;
18
19
use Symfony \Component \Finder \Finder ;
19
20
use Symfony \Component \Translation \Extractor \Visitor \AbstractVisitor ;
20
21
use Symfony \Component \Translation \MessageCatalogue ;
@@ -39,7 +40,11 @@ public function __construct(
39
40
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));
40
41
}
41
42
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
+ }
43
48
}
44
49
45
50
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
42
42
return null ;
43
43
}
44
44
45
- $ parts = $ className ->parts ;
45
+ $ parts = $ className ->getParts () ;
46
46
$ isConstraintClass = false ;
47
47
48
48
foreach ($ parts as $ part ) {
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public function enterNode(Node $node): ?Node
34
34
return null ;
35
35
}
36
36
37
- if (!\in_array ('TranslatableMessage ' , $ className ->parts , true )) {
37
+ if (!\in_array ('TranslatableMessage ' , $ className ->getParts () , true )) {
38
38
return null ;
39
39
}
40
40
Original file line number Diff line number Diff line change 22
22
"symfony/translation-contracts" : " ^2.5|^3.0"
23
23
},
24
24
"require-dev" : {
25
- "nikic/php-parser" : " ^4.13" ,
25
+ "nikic/php-parser" : " ^4.13|^5.0 " ,
26
26
"symfony/config" : " ^5.4|^6.0" ,
27
27
"symfony/console" : " ^5.4|^6.0" ,
28
28
"symfony/dependency-injection" : " ^5.4|^6.0" ,
You can’t perform that action at this time.
0 commit comments