9
9
use TypeLang \Parser \Node \Stmt \ClassConstNode ;
10
10
use TypeLang \Parser \Node \Stmt \NamedTypeNode ;
11
11
use TypeLang \Parser \ParserInterface as TypesParserInterface ;
12
- use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \ClassConstantSymbolReference ;
13
- use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \ClassMethodSymbolReference ;
14
- use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \ClassPropertySymbolReference ;
12
+ use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \ClassConstantElementReference ;
13
+ use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \ClassMethodElementReference ;
14
+ use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \ClassPropertyElementReference ;
15
15
use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \FunctionReference ;
16
- use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \SymbolReference ;
17
- use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \TypeSymbolReference ;
16
+ use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \ElementReference ;
17
+ use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \TypeElementReference ;
18
18
use TypeLang \PHPDoc \DocBlock \Tag \Shared \Reference \VariableReference ;
19
19
20
20
/**
21
- * @template-implements ReaderInterface<SymbolReference >
21
+ * @template-implements ReaderInterface<ElementReference >
22
22
*/
23
- final class SymbolReferenceReader implements ReaderInterface
23
+ final class ElementReferenceReader implements ReaderInterface
24
24
{
25
25
private OptionalTypeReader $ types ;
26
26
@@ -29,7 +29,7 @@ public function __construct(TypesParserInterface $parser)
29
29
$ this ->types = new OptionalTypeReader ($ parser );
30
30
}
31
31
32
- public function __invoke (Stream $ stream ): SymbolReference
32
+ public function __invoke (Stream $ stream ): ElementReference
33
33
{
34
34
$ type = ($ this ->types )($ stream );
35
35
@@ -56,10 +56,10 @@ public function __invoke(Stream $stream): SymbolReference
56
56
$ identifier = $ type ->constant ->toString ();
57
57
58
58
if (\str_starts_with ($ stream ->value , '() ' )) {
59
- return new ClassMethodSymbolReference ($ type ->class , $ identifier );
59
+ return new ClassMethodElementReference ($ type ->class , $ identifier );
60
60
}
61
61
62
- return new ClassConstantSymbolReference ($ type ->class , $ identifier );
62
+ return new ClassConstantElementReference ($ type ->class , $ identifier );
63
63
}
64
64
65
65
throw $ stream ->toException (\sprintf (
@@ -68,16 +68,16 @@ public function __invoke(Stream $stream): SymbolReference
68
68
));
69
69
}
70
70
71
- private function createFromFunction (CallableTypeNode $ type ): SymbolReference
71
+ private function createFromFunction (CallableTypeNode $ type ): ElementReference
72
72
{
73
73
if ($ type ->type !== null || $ type ->parameters ->items !== []) {
74
- return new TypeSymbolReference ($ type );
74
+ return new TypeElementReference ($ type );
75
75
}
76
76
77
77
return new FunctionReference ($ type ->name );
78
78
}
79
79
80
- private function createFromNamedType (NamedTypeNode $ type , Stream $ stream ): SymbolReference
80
+ private function createFromNamedType (NamedTypeNode $ type , Stream $ stream ): ElementReference
81
81
{
82
82
if (\str_starts_with ($ stream ->value , ':: ' )) {
83
83
if ($ type ->arguments === null && $ type ->fields === null ) {
@@ -87,7 +87,7 @@ private function createFromNamedType(NamedTypeNode $type, Stream $stream): Symbo
87
87
$ variable = $ stream ->apply (new OptionalVariableNameReader ());
88
88
89
89
if ($ variable !== null ) {
90
- return new ClassPropertySymbolReference (
90
+ return new ClassPropertyElementReference (
91
91
class: $ type ->name ,
92
92
property: $ variable ,
93
93
);
@@ -100,6 +100,6 @@ class: $type->name,
100
100
));
101
101
}
102
102
103
- return new TypeSymbolReference ($ type );
103
+ return new TypeElementReference ($ type );
104
104
}
105
105
}
0 commit comments