@@ -31,7 +31,7 @@ public function findPropertyReflectionsFromNode($propertyFetch, Scope $scope): a
31
31
$ reflections = [];
32
32
$ propertyHolderType = $ scope ->getType ($ propertyFetch ->var );
33
33
foreach ($ names as $ name ) {
34
- $ reflection = $ this ->findPropertyReflection (
34
+ $ reflection = $ this ->findInstancePropertyReflection (
35
35
$ propertyHolderType ,
36
36
$ name ,
37
37
$ propertyFetch ->name instanceof Expr ? $ scope ->filterByTruthyValue (new Expr \BinaryOp \Identical (
@@ -63,7 +63,7 @@ public function findPropertyReflectionsFromNode($propertyFetch, Scope $scope): a
63
63
64
64
$ reflections = [];
65
65
foreach ($ names as $ name ) {
66
- $ reflection = $ this ->findPropertyReflection (
66
+ $ reflection = $ this ->findStaticPropertyReflection (
67
67
$ propertyHolderType ,
68
68
$ name ,
69
69
$ propertyFetch ->name instanceof Expr ? $ scope ->filterByTruthyValue (new Expr \BinaryOp \Identical (
@@ -89,13 +89,13 @@ public function findPropertyReflectionFromNode($propertyFetch, Scope $scope): ?F
89
89
if ($ propertyFetch instanceof Node \Expr \PropertyFetch) {
90
90
$ propertyHolderType = $ scope ->getType ($ propertyFetch ->var );
91
91
if ($ propertyFetch ->name instanceof Node \Identifier) {
92
- return $ this ->findPropertyReflection ($ propertyHolderType , $ propertyFetch ->name ->name , $ scope );
92
+ return $ this ->findInstancePropertyReflection ($ propertyHolderType , $ propertyFetch ->name ->name , $ scope );
93
93
}
94
94
95
95
$ nameType = $ scope ->getType ($ propertyFetch ->name );
96
96
$ nameTypeConstantStrings = $ nameType ->getConstantStrings ();
97
97
if (count ($ nameTypeConstantStrings ) === 1 ) {
98
- return $ this ->findPropertyReflection ($ propertyHolderType , $ nameTypeConstantStrings [0 ]->getValue (), $ scope );
98
+ return $ this ->findInstancePropertyReflection ($ propertyHolderType , $ nameTypeConstantStrings [0 ]->getValue (), $ scope );
99
99
}
100
100
101
101
return null ;
@@ -111,16 +111,33 @@ public function findPropertyReflectionFromNode($propertyFetch, Scope $scope): ?F
111
111
$ propertyHolderType = $ scope ->getType ($ propertyFetch ->class );
112
112
}
113
113
114
- return $ this ->findPropertyReflection ($ propertyHolderType , $ propertyFetch ->name ->name , $ scope );
114
+ return $ this ->findStaticPropertyReflection ($ propertyHolderType , $ propertyFetch ->name ->name , $ scope );
115
115
}
116
116
117
- private function findPropertyReflection (Type $ propertyHolderType , string $ propertyName , Scope $ scope ): ?FoundPropertyReflection
117
+ private function findInstancePropertyReflection (Type $ propertyHolderType , string $ propertyName , Scope $ scope ): ?FoundPropertyReflection
118
118
{
119
- if (!$ propertyHolderType ->hasProperty ($ propertyName )->yes ()) {
119
+ if (!$ propertyHolderType ->hasInstanceProperty ($ propertyName )->yes ()) {
120
120
return null ;
121
121
}
122
122
123
- $ originalProperty = $ propertyHolderType ->getProperty ($ propertyName , $ scope );
123
+ $ originalProperty = $ propertyHolderType ->getInstanceProperty ($ propertyName , $ scope );
124
+
125
+ return new FoundPropertyReflection (
126
+ $ originalProperty ,
127
+ $ scope ,
128
+ $ propertyName ,
129
+ $ originalProperty ->getReadableType (),
130
+ $ originalProperty ->getWritableType (),
131
+ );
132
+ }
133
+
134
+ private function findStaticPropertyReflection (Type $ propertyHolderType , string $ propertyName , Scope $ scope ): ?FoundPropertyReflection
135
+ {
136
+ if (!$ propertyHolderType ->hasStaticProperty ($ propertyName )->yes ()) {
137
+ return null ;
138
+ }
139
+
140
+ $ originalProperty = $ propertyHolderType ->getStaticProperty ($ propertyName , $ scope );
124
141
125
142
return new FoundPropertyReflection (
126
143
$ originalProperty ,
0 commit comments