File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -423,7 +423,7 @@ public static function doUnion(Type ...$types): Type
423423 // a constant scalar refined by an accessory type ('Foo'&hasMethod(bar))
424424 // stays with the other types so it is compared against the plain
425425 // constant scalars and other refinements of the same value
426- if ($ types [$ i ]-> isConstantScalarValue ()-> yes () && ! $ types [$ i ] instanceof IntersectionType ) {
426+ if (! $ types [$ i ] instanceof IntersectionType && $ types [$ i ]-> isConstantScalarValue ()-> yes () ) {
427427 $ type = $ types [$ i ];
428428 $ scalarTypes [get_class ($ type )][$ type ->describe (VerbosityLevel ::cache ())] = $ type ;
429429 unset($ types [$ i ]);
Original file line number Diff line number Diff line change @@ -1038,9 +1038,12 @@ class TypeCombinator
10381038 Level cacheLevel (PT_LC (" cache" ));
10391039 for (size_t i = 0 ; i < typesCount; i++) {
10401040 zval *type = types[i].raw ();
1041- zend_long isConstantScalarValue = callTrinary (type, PT_LC (" isconstantscalarvalue" ));
1042- PT_FAIL_IF_NEG (isConstantScalarValue);
1043- if (isConstantScalarValue == PT_TRI_YES && !isInstance (type, pt_ce_intersection_type)) {
1041+ zend_long isConstantScalarValue = PT_TRI_NO ;
1042+ if (!isInstance (type, pt_ce_intersection_type)) {
1043+ isConstantScalarValue = callTrinary (type, PT_LC (" isconstantscalarvalue" ));
1044+ PT_FAIL_IF_NEG (isConstantScalarValue);
1045+ }
1046+ if (isConstantScalarValue == PT_TRI_YES ) {
10441047 zv::Val description = describe (type, cacheLevel);
10451048 zend_string *key = describedKey (description);
10461049 if (UNEXPECTED (key == NULL )) return zv::Val ();
You can’t perform that action at this time.
0 commit comments