@@ -986,12 +986,10 @@ public function getBitwiseAndType(Expr $left, Expr $right, callable $getTypeCall
986986 $ leftType = $ getTypeCallback ($ left );
987987 $ rightType = $ getTypeCallback ($ right );
988988
989- if ($ leftType ->isObject ()->yes () || $ rightType ->isObject ()->yes ()) {
990- $ specifiedTypes = $ this ->operatorTypeSpecifyingExtensionRegistryProvider ->getRegistry ()
991- ->callOperatorTypeSpecifyingExtensions (new BinaryOp \BitwiseAnd ($ left , $ right ), $ leftType , $ rightType );
992- if ($ specifiedTypes !== null ) {
993- return $ specifiedTypes ;
994- }
989+ $ specifiedTypes = $ this ->operatorTypeSpecifyingExtensionRegistryProvider ->getRegistry ()
990+ ->callOperatorTypeSpecifyingExtensions (new BinaryOp \BitwiseAnd ($ left , $ right ), $ leftType , $ rightType );
991+ if ($ specifiedTypes !== null ) {
992+ return $ specifiedTypes ;
995993 }
996994
997995 return $ this ->getBitwiseAndTypeFromTypes ($ leftType , $ rightType );
@@ -1052,12 +1050,10 @@ public function getBitwiseOrType(Expr $left, Expr $right, callable $getTypeCallb
10521050 $ leftType = $ getTypeCallback ($ left );
10531051 $ rightType = $ getTypeCallback ($ right );
10541052
1055- if ($ leftType ->isObject ()->yes () || $ rightType ->isObject ()->yes ()) {
1056- $ specifiedTypes = $ this ->operatorTypeSpecifyingExtensionRegistryProvider ->getRegistry ()
1057- ->callOperatorTypeSpecifyingExtensions (new BinaryOp \BitwiseOr ($ left , $ right ), $ leftType , $ rightType );
1058- if ($ specifiedTypes !== null ) {
1059- return $ specifiedTypes ;
1060- }
1053+ $ specifiedTypes = $ this ->operatorTypeSpecifyingExtensionRegistryProvider ->getRegistry ()
1054+ ->callOperatorTypeSpecifyingExtensions (new BinaryOp \BitwiseOr ($ left , $ right ), $ leftType , $ rightType );
1055+ if ($ specifiedTypes !== null ) {
1056+ return $ specifiedTypes ;
10611057 }
10621058
10631059 return $ this ->getBitwiseOrTypeFromTypes ($ leftType , $ rightType );
@@ -1108,12 +1104,10 @@ public function getBitwiseXorType(Expr $left, Expr $right, callable $getTypeCall
11081104 $ leftType = $ getTypeCallback ($ left );
11091105 $ rightType = $ getTypeCallback ($ right );
11101106
1111- if ($ leftType ->isObject ()->yes () || $ rightType ->isObject ()->yes ()) {
1112- $ specifiedTypes = $ this ->operatorTypeSpecifyingExtensionRegistryProvider ->getRegistry ()
1113- ->callOperatorTypeSpecifyingExtensions (new BinaryOp \BitwiseXor ($ left , $ right ), $ leftType , $ rightType );
1114- if ($ specifiedTypes !== null ) {
1115- return $ specifiedTypes ;
1116- }
1107+ $ specifiedTypes = $ this ->operatorTypeSpecifyingExtensionRegistryProvider ->getRegistry ()
1108+ ->callOperatorTypeSpecifyingExtensions (new BinaryOp \BitwiseXor ($ left , $ right ), $ leftType , $ rightType );
1109+ if ($ specifiedTypes !== null ) {
1110+ return $ specifiedTypes ;
11171111 }
11181112
11191113 return $ this ->getBitwiseXorTypeFromTypes ($ leftType , $ rightType );
@@ -2058,15 +2052,10 @@ private function resolveConstantArrayTypeComparison(ConstantArrayType $leftType,
20582052 */
20592053 private function resolveCommonMath (Expr \BinaryOp $ expr , Type $ leftType , Type $ rightType ): Type
20602054 {
2061- // Check operator type specifying extensions first for object types
2062- // This allows extensions like GmpOperatorTypeSpecifyingExtension to
2063- // handle operator overloading before integer range optimizations kick in
2064- if ($ leftType ->isObject ()->yes () || $ rightType ->isObject ()->yes ()) {
2065- $ specifiedTypes = $ this ->operatorTypeSpecifyingExtensionRegistryProvider ->getRegistry ()
2066- ->callOperatorTypeSpecifyingExtensions ($ expr , $ leftType , $ rightType );
2067- if ($ specifiedTypes !== null ) {
2068- return $ specifiedTypes ;
2069- }
2055+ $ specifiedTypes = $ this ->operatorTypeSpecifyingExtensionRegistryProvider ->getRegistry ()
2056+ ->callOperatorTypeSpecifyingExtensions ($ expr , $ leftType , $ rightType );
2057+ if ($ specifiedTypes !== null ) {
2058+ return $ specifiedTypes ;
20702059 }
20712060
20722061 $ types = TypeCombinator::union ($ leftType , $ rightType );
@@ -2108,12 +2097,6 @@ private function resolveCommonMath(Expr\BinaryOp $expr, Type $leftType, Type $ri
21082097 }
21092098 }
21102099
2111- $ specifiedTypes = $ this ->operatorTypeSpecifyingExtensionRegistryProvider ->getRegistry ()
2112- ->callOperatorTypeSpecifyingExtensions ($ expr , $ leftType , $ rightType );
2113- if ($ specifiedTypes !== null ) {
2114- return $ specifiedTypes ;
2115- }
2116-
21172100 if (
21182101 $ leftType ->isArray ()->yes ()
21192102 || $ rightType ->isArray ()->yes ()
0 commit comments