@@ -72,6 +72,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
7272 $ scope ,
7373 NullsafeOperatorHelper::getNullsafeShortcircuitedExprRespectingScope ($ scope , $ node ->var ),
7474 sprintf ('Access to property $%s on an unknown class %%s. ' , SprintfHelper::escapeFormatString ($ name )),
75+ // TODO use hasInstanceProperty
7576 static fn (Type $ type ): bool => $ type ->canAccessProperties ()->yes () && $ type ->hasProperty ($ name )->yes (),
7677 );
7778 $ type = $ typeResult ->getType ();
@@ -98,6 +99,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
9899 ];
99100 }
100101
102+ // TODO use hasInstanceProperty
101103 $ has = $ type ->hasProperty ($ name );
102104 if (!$ has ->no () && $ this ->canAccessUndefinedProperties ($ scope , $ node )) {
103105 return [];
@@ -129,12 +131,12 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
129131 $ propertyClassReflection = $ this ->reflectionProvider ->getClass ($ classNames [0 ]);
130132 $ parentClassReflection = $ propertyClassReflection ->getParentClass ();
131133 while ($ parentClassReflection !== null ) {
132- if ($ parentClassReflection ->hasProperty ($ name )) {
134+ if ($ parentClassReflection ->hasInstanceProperty ($ name )) {
133135 if ($ write ) {
134- if ($ scope ->canWriteProperty ($ parentClassReflection ->getProperty ($ name , $ scope ))) {
136+ if ($ scope ->canWriteProperty ($ parentClassReflection ->getInstanceProperty ($ name , $ scope ))) {
135137 return [];
136138 }
137- } elseif ($ scope ->canReadProperty ($ parentClassReflection ->getProperty ($ name , $ scope ))) {
139+ } elseif ($ scope ->canReadProperty ($ parentClassReflection ->getInstanceProperty ($ name , $ scope ))) {
138140 return [];
139141 }
140142
@@ -178,6 +180,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
178180 ];
179181 }
180182
183+ // TODO use getInstanceProperty
181184 $ propertyReflection = $ type ->getProperty ($ name , $ scope );
182185 if ($ propertyReflection ->isStatic ()) {
183186 return [
0 commit comments