@@ -30,20 +30,19 @@ public function getName(): string
30
30
31
31
public function resolve (Environment $ environment , string $ data ): ResolvedReference
32
32
{
33
- $ className = explode (':: ' , $ data )[0 ];
34
- $ className = str_replace ('\\\\' , '\\' , $ className );
35
-
36
- if (!u ($ data )->containsAny (':: ' )) {
33
+ $ data = u ($ data );
34
+ if (!$ data ->containsAny (':: ' )) {
37
35
throw new \RuntimeException (sprintf ('Malformed method reference "%s" in file "%s" ' , $ data , $ environment ->getCurrentFileName ()));
38
36
}
39
37
40
- $ methodName = explode (':: ' , $ data )[1 ];
38
+ [$ className , $ methodName ] = $ data ->split (':: ' , 2 );
39
+ $ className = $ className ->replace ('\\\\' , '\\' );
41
40
42
41
$ scrollTextFragment = sprintf ('#:~:text=%s ' , rawurlencode ('function ' .$ methodName ));
43
42
return new ResolvedReference (
44
43
$ environment ->getCurrentFileName (),
45
44
$ methodName .'() ' ,
46
- sprintf ('%s/%s.php%s ' , $ this ->symfonyRepositoryUrl , str_replace ('\\' , '/ ' , $ className ), $ scrollTextFragment ),
45
+ sprintf ('%s/%s.php%s ' , $ this ->symfonyRepositoryUrl , $ className -> replace ('\\' , '/ ' ), $ scrollTextFragment ),
47
46
[],
48
47
[
49
48
'title ' => sprintf ('%s::%s() ' , $ className , $ methodName ),
0 commit comments