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