@@ -67,6 +67,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
67
67
$ scope ,
68
68
NullsafeOperatorHelper::getNullsafeShortcircuitedExprRespectingScope ($ scope , $ node ->var ),
69
69
sprintf ('Access to property $%s on an unknown class %%s. ' , SprintfHelper::escapeFormatString ($ name )),
70
+ // TODO use hasInstanceProperty
70
71
static fn (Type $ type ): bool => $ type ->canAccessProperties ()->yes () && $ type ->hasProperty ($ name )->yes (),
71
72
);
72
73
$ type = $ typeResult ->getType ();
@@ -93,6 +94,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
93
94
];
94
95
}
95
96
97
+ // TODO use hasInstanceProperty
96
98
$ has = $ type ->hasProperty ($ name );
97
99
if (!$ has ->no () && $ this ->canAccessUndefinedProperties ($ scope , $ node )) {
98
100
return [];
@@ -124,12 +126,12 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
124
126
$ propertyClassReflection = $ this ->reflectionProvider ->getClass ($ classNames [0 ]);
125
127
$ parentClassReflection = $ propertyClassReflection ->getParentClass ();
126
128
while ($ parentClassReflection !== null ) {
127
- if ($ parentClassReflection ->hasProperty ($ name )) {
129
+ if ($ parentClassReflection ->hasInstanceProperty ($ name )) {
128
130
if ($ write ) {
129
- if ($ scope ->canWriteProperty ($ parentClassReflection ->getProperty ($ name , $ scope ))) {
131
+ if ($ scope ->canWriteProperty ($ parentClassReflection ->getInstanceProperty ($ name , $ scope ))) {
130
132
return [];
131
133
}
132
- } elseif ($ scope ->canReadProperty ($ parentClassReflection ->getProperty ($ name , $ scope ))) {
134
+ } elseif ($ scope ->canReadProperty ($ parentClassReflection ->getInstanceProperty ($ name , $ scope ))) {
133
135
return [];
134
136
}
135
137
@@ -173,6 +175,7 @@ private function processSingleProperty(Scope $scope, PropertyFetch $node, string
173
175
];
174
176
}
175
177
178
+ // TODO use getInstanceProperty
176
179
$ propertyReflection = $ type ->getProperty ($ name , $ scope );
177
180
if ($ propertyReflection ->isStatic ()) {
178
181
return [
0 commit comments