88use TypeLang \Parser \Node \Literal \VariableLiteralNode ;
99use TypeLang \Parser \Node \Name ;
1010use TypeLang \Parser \Node \Stmt \NamedTypeNode ;
11- use TypeLang \Parser \ParserInterface as TypesParserInterface ;
1211use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \ClassConstantElementReference ;
1312use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \ClassMethodElementReference ;
1413use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \ClassPropertyElementReference ;
@@ -26,15 +25,15 @@ final class ElementReferenceReader implements ReaderInterface
2625 private const T_IDENTIFIER = '[a-zA-Z_ \\x80- \\xff][a-zA-Z0-9 \\-_ \\x80- \\xff]*+ ' ;
2726
2827 private const SIMPLE_TOKENIZER_PCRE = '/^(? '
29- . '|(?:(?P<T_CLASS> ' . self ::T_FQN . ')::(?: '
30- . '(?: \\$[a-zA-Z_ \\x80- \\xff][a-zA-Z0-9_ \\x80- \\xff]*+)(*MARK:T_CLASS_PROPERTY) '
31- . '|(?:[a-zA-Z_ \\x80- \\xff][a-zA-Z0-9_ \\x80- \\xff]*+\(\))(*MARK:T_CLASS_METHOD) '
32- . '|(?:[a-zA-Z_ \\x80- \\xff][a-zA-Z0-9_ \\x80- \\xff]*+)(*MARK:T_CLASS_CONSTANT) '
28+ . '|(?:(?P<T_CLASS> ' . self ::T_FQN . ')::(?: '
29+ . '(?: \\$[a-zA-Z_ \\x80- \\xff][a-zA-Z0-9_ \\x80- \\xff]*+)(*MARK:T_CLASS_PROPERTY) '
30+ . '|(?:[a-zA-Z_ \\x80- \\xff][a-zA-Z0-9_ \\x80- \\xff]*+\(\))(*MARK:T_CLASS_METHOD) '
31+ . '|(?:[a-zA-Z_ \\x80- \\xff][a-zA-Z0-9_ \\x80- \\xff]*+)(*MARK:T_CLASS_CONSTANT) '
3332 . ')) '
34- . '|(?:(?: \\$ ' . self ::T_IDENTIFIER . ')(*MARK:T_VARIABLE)) '
35- . '|(?:(?: ' . self ::T_FQN . '\(\))(*MARK:T_FUNCTION)) '
36- . '|(?:(?: ' . self ::T_FQN . ')(*MARK:T_IDENTIFIER)) '
37- . ')(?:\s|$)/Ssum ' ;
33+ . '|(?:(?: \\$ ' . self ::T_IDENTIFIER . ')(*MARK:T_VARIABLE)) '
34+ . '|(?:(?: ' . self ::T_FQN . '\(\))(*MARK:T_FUNCTION)) '
35+ . '|(?:(?: ' . self ::T_FQN . ')(*MARK:T_IDENTIFIER)) '
36+ . ')(?:\s|$)/Ssum ' ;
3837
3938 public function __invoke (Stream $ stream ): ElementReference
4039 {
@@ -48,17 +47,19 @@ public function __invoke(Stream $stream): ElementReference
4847 // @phpstan-ignore match.unhandled
4948 $ result = match ($ matches ['MARK ' ]) {
5049 // @phpstan-ignore-next-line : All ok
51- 'T_FUNCTION ' => new FunctionElementReference ($ isFullyQualified
52- // @phpstan-ignore-next-line : All ok
53- ? new FullQualifiedName (\substr ($ body , 0 , -2 ))
54- // @phpstan-ignore-next-line : All ok
55- : new Name (\substr ($ body , 0 , -2 )),
50+ 'T_FUNCTION ' => new FunctionElementReference (
51+ function: $ isFullyQualified
52+ // @phpstan-ignore-next-line : All ok
53+ ? new FullQualifiedName (\substr ($ body , 0 , -2 ))
54+ // @phpstan-ignore-next-line : All ok
55+ : new Name (\substr ($ body , 0 , -2 )),
5656 ),
5757 // @phpstan-ignore-next-line : All ok
5858 'T_IDENTIFIER ' => new TypeElementReference (
59- type: new NamedTypeNode ($ isFullyQualified
60- ? new FullQualifiedName ($ body )
61- : new Name ($ body )
59+ type: new NamedTypeNode (
60+ name: $ isFullyQualified
61+ ? new FullQualifiedName ($ body )
62+ : new Name ($ body )
6263 ),
6364 ),
6465 'T_VARIABLE ' => new VariableReference (
0 commit comments