@@ -97,6 +97,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
97
97
$ scope ,
98
98
NullsafeOperatorHelper::getNullsafeShortcircuitedExprRespectingScope ($ scope , $ node ->var ),
99
99
sprintf ('Access to property $%s on an unknown class %%s. ' , SprintfHelper::escapeFormatString ($ name )),
100
+ // TODO use hasInstanceProperty
100
101
static fn (Type $ type ): bool => $ type ->canAccessProperties ()->yes () && $ type ->hasProperty ($ name )->yes (),
101
102
);
102
103
$ type = $ typeResult ->getType ();
@@ -123,6 +124,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
123
124
];
124
125
}
125
126
127
+ // TODO use hasInstanceProperty
126
128
$ has = $ type ->hasProperty ($ name );
127
129
if (!$ has ->no () && $ this ->canAccessUndefinedProperties ($ scope , $ node )) {
128
130
return [];
@@ -154,12 +156,12 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
154
156
$ propertyClassReflection = $ this ->reflectionProvider ->getClass ($ classNames [0 ]);
155
157
$ parentClassReflection = $ propertyClassReflection ->getParentClass ();
156
158
while ($ parentClassReflection !== null ) {
157
- if ($ parentClassReflection ->hasProperty ($ name )) {
159
+ if ($ parentClassReflection ->hasInstanceProperty ($ name )) {
158
160
if ($ write ) {
159
- if ($ scope ->canWriteProperty ($ parentClassReflection ->getProperty ($ name , $ scope ))) {
161
+ if ($ scope ->canWriteProperty ($ parentClassReflection ->getInstanceProperty ($ name , $ scope ))) {
160
162
return [];
161
163
}
162
- } elseif ($ scope ->canReadProperty ($ parentClassReflection ->getProperty ($ name , $ scope ))) {
164
+ } elseif ($ scope ->canReadProperty ($ parentClassReflection ->getInstanceProperty ($ name , $ scope ))) {
163
165
return [];
164
166
}
165
167
@@ -203,6 +205,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
203
205
];
204
206
}
205
207
208
+ // TODO use getInstanceProperty
206
209
$ propertyReflection = $ type ->getProperty ($ name , $ scope );
207
210
if ($ propertyReflection ->isStatic ()) {
208
211
return [
0 commit comments