@@ -33,7 +33,7 @@ public function findPropertyReflectionsFromNode($propertyFetch, Scope $scope): a
3333 $ reflections = [];
3434 $ propertyHolderType = $ scope ->getType ($ propertyFetch ->var );
3535 foreach ($ names as $ name ) {
36- $ reflection = $ this ->findPropertyReflection (
36+ $ reflection = $ this ->findInstancePropertyReflection (
3737 $ propertyHolderType ,
3838 $ name ,
3939 $ propertyFetch ->name instanceof Expr ? $ scope ->filterByTruthyValue (new Expr \BinaryOp \Identical (
@@ -65,7 +65,7 @@ public function findPropertyReflectionsFromNode($propertyFetch, Scope $scope): a
6565
6666 $ reflections = [];
6767 foreach ($ names as $ name ) {
68- $ reflection = $ this ->findPropertyReflection (
68+ $ reflection = $ this ->findStaticPropertyReflection (
6969 $ propertyHolderType ,
7070 $ name ,
7171 $ propertyFetch ->name instanceof Expr ? $ scope ->filterByTruthyValue (new Expr \BinaryOp \Identical (
@@ -91,13 +91,13 @@ public function findPropertyReflectionFromNode($propertyFetch, Scope $scope): ?F
9191 if ($ propertyFetch instanceof Node \Expr \PropertyFetch) {
9292 $ propertyHolderType = $ scope ->getType ($ propertyFetch ->var );
9393 if ($ propertyFetch ->name instanceof Node \Identifier) {
94- return $ this ->findPropertyReflection ($ propertyHolderType , $ propertyFetch ->name ->name , $ scope );
94+ return $ this ->findInstancePropertyReflection ($ propertyHolderType , $ propertyFetch ->name ->name , $ scope );
9595 }
9696
9797 $ nameType = $ scope ->getType ($ propertyFetch ->name );
9898 $ nameTypeConstantStrings = $ nameType ->getConstantStrings ();
9999 if (count ($ nameTypeConstantStrings ) === 1 ) {
100- return $ this ->findPropertyReflection ($ propertyHolderType , $ nameTypeConstantStrings [0 ]->getValue (), $ scope );
100+ return $ this ->findInstancePropertyReflection ($ propertyHolderType , $ nameTypeConstantStrings [0 ]->getValue (), $ scope );
101101 }
102102
103103 return null ;
@@ -113,16 +113,33 @@ public function findPropertyReflectionFromNode($propertyFetch, Scope $scope): ?F
113113 $ propertyHolderType = $ scope ->getType ($ propertyFetch ->class );
114114 }
115115
116- return $ this ->findPropertyReflection ($ propertyHolderType , $ propertyFetch ->name ->name , $ scope );
116+ return $ this ->findStaticPropertyReflection ($ propertyHolderType , $ propertyFetch ->name ->name , $ scope );
117117 }
118118
119- private function findPropertyReflection (Type $ propertyHolderType , string $ propertyName , Scope $ scope ): ?FoundPropertyReflection
119+ private function findInstancePropertyReflection (Type $ propertyHolderType , string $ propertyName , Scope $ scope ): ?FoundPropertyReflection
120120 {
121- if (!$ propertyHolderType ->hasProperty ($ propertyName )->yes ()) {
121+ if (!$ propertyHolderType ->hasInstanceProperty ($ propertyName )->yes ()) {
122122 return null ;
123123 }
124124
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 );
126143
127144 return new FoundPropertyReflection (
128145 $ originalProperty ,
0 commit comments