You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit da45cc1
Browse filesBrowse the repository at this point in the historyBrowse files
Require every receiver union member to have the property when resolving native type of PropertyFetch and StaticPropertyFetch
- PropertyFetchHandler: the native-type path used MutatingScope::getInstancePropertyReflection(),
which keeps only the union members that have the property, so `?Foo` / `Foo|Bar` receivers got
the property's native type. Now it returns ErrorType unless the whole receiver type (with null
removed only on a nullsafe chain) has the property, as 2.2 did via PropertyReflectionFinder.
- StaticPropertyFetchHandler: same for `$expr::$prop` - a nullable class expression outside a
nullsafe chain, or a union with members lacking the static property, gives ErrorType.
- Ported both changes to the turbo-ext C++ mirrors (PropertyFetchHandler.cpp,
StaticPropertyFetchHandler.cpp); analysis output is identical with the extension on and off.
- Probed method calls, static method calls, class constants, array dim fetch, nullsafe and
dynamic-name property fetches against 2.2.17: they already match, so no changes there.
$resolveProperty = function (string$propertyName) use ($nativeTypesPromoted, $reflectionScope, $staticPropertyFetchedOnType, $expr): Type {
166
+
$resolveProperty = function (string$propertyName) use ($nativeTypesPromoted, $reflectionScope, $staticPropertyFetchedOnType, $classType, $classResult, $expr): Type {
167
167
if ($nativeTypesPromoted) {
168
+
// unlike getStaticPropertyReflection(), do not pick only the union
169
+
// members that have the property - a fetch on e.g. a null member
170
+
// does not produce the property's native type
171
+
if ($classType !== null && !$classResult->containsNullsafe() && TypeCombinator::containsNull($classType)) {
172
+
returnnewErrorType();
173
+
}
174
+
if (!$staticPropertyFetchedOnType->hasStaticProperty($propertyName)->yes()) {
0 commit comments