@@ -91,6 +91,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
91
91
$ scope ,
92
92
NullsafeOperatorHelper::getNullsafeShortcircuitedExprRespectingScope ($ scope , $ node ->var ),
93
93
sprintf ('Access to property $%s on an unknown class %%s. ' , SprintfHelper::escapeFormatString ($ name )),
94
+ // TODO use hasInstanceProperty
94
95
static fn (Type $ type ): bool => $ type ->canAccessProperties ()->yes () && $ type ->hasProperty ($ name )->yes (),
95
96
);
96
97
$ type = $ typeResult ->getType ();
@@ -117,6 +118,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
117
118
];
118
119
}
119
120
121
+ // TODO use hasInstanceProperty
120
122
$ has = $ type ->hasProperty ($ name );
121
123
if (!$ has ->no () && $ this ->canAccessUndefinedProperties ($ scope , $ node )) {
122
124
return [];
@@ -148,12 +150,12 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
148
150
$ propertyClassReflection = $ this ->reflectionProvider ->getClass ($ classNames [0 ]);
149
151
$ parentClassReflection = $ propertyClassReflection ->getParentClass ();
150
152
while ($ parentClassReflection !== null ) {
151
- if ($ parentClassReflection ->hasProperty ($ name )) {
153
+ if ($ parentClassReflection ->hasInstanceProperty ($ name )) {
152
154
if ($ write ) {
153
- if ($ scope ->canWriteProperty ($ parentClassReflection ->getProperty ($ name , $ scope ))) {
155
+ if ($ scope ->canWriteProperty ($ parentClassReflection ->getInstanceProperty ($ name , $ scope ))) {
154
156
return [];
155
157
}
156
- } elseif ($ scope ->canReadProperty ($ parentClassReflection ->getProperty ($ name , $ scope ))) {
158
+ } elseif ($ scope ->canReadProperty ($ parentClassReflection ->getInstanceProperty ($ name , $ scope ))) {
157
159
return [];
158
160
}
159
161
@@ -197,6 +199,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
197
199
];
198
200
}
199
201
202
+ // TODO use getInstanceProperty
200
203
$ propertyReflection = $ type ->getProperty ($ name , $ scope );
201
204
if ($ propertyReflection ->isStatic ()) {
202
205
return [
0 commit comments