@@ -97,6 +97,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
9797 $ scope ,
9898 NullsafeOperatorHelper::getNullsafeShortcircuitedExprRespectingScope ($ scope , $ node ->var ),
9999 sprintf ('Access to property $%s on an unknown class %%s. ' , SprintfHelper::escapeFormatString ($ name )),
100+ // TODO use hasInstanceProperty
100101 static fn (Type $ type ): bool => $ type ->canAccessProperties ()->yes () && $ type ->hasProperty ($ name )->yes (),
101102 );
102103 $ type = $ typeResult ->getType ();
@@ -123,6 +124,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
123124 ];
124125 }
125126
127+ // TODO use hasInstanceProperty
126128 $ has = $ type ->hasProperty ($ name );
127129 if (!$ has ->no () && $ this ->canAccessUndefinedProperties ($ scope , $ node )) {
128130 return [];
@@ -154,12 +156,12 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
154156 $ propertyClassReflection = $ this ->reflectionProvider ->getClass ($ classNames [0 ]);
155157 $ parentClassReflection = $ propertyClassReflection ->getParentClass ();
156158 while ($ parentClassReflection !== null ) {
157- if ($ parentClassReflection ->hasProperty ($ name )) {
159+ if ($ parentClassReflection ->hasInstanceProperty ($ name )) {
158160 if ($ write ) {
159- if ($ scope ->canWriteProperty ($ parentClassReflection ->getProperty ($ name , $ scope ))) {
161+ if ($ scope ->canWriteProperty ($ parentClassReflection ->getInstanceProperty ($ name , $ scope ))) {
160162 return [];
161163 }
162- } elseif ($ scope ->canReadProperty ($ parentClassReflection ->getProperty ($ name , $ scope ))) {
164+ } elseif ($ scope ->canReadProperty ($ parentClassReflection ->getInstanceProperty ($ name , $ scope ))) {
163165 return [];
164166 }
165167
@@ -203,6 +205,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
203205 ];
204206 }
205207
208+ // TODO use getInstanceProperty
206209 $ propertyReflection = $ type ->getProperty ($ name , $ scope );
207210 if ($ propertyReflection ->isStatic ()) {
208211 return [
0 commit comments