@@ -259,12 +259,6 @@ public function specifyTypesInCondition(
259
259
);
260
260
}
261
261
262
- $ exprLeftType = $ scope ->getType ($ expr ->left );
263
- $ exprRightType = $ scope ->getType ($ expr ->right );
264
- if ($ expr ->left instanceof Expr \CallLike && $ expr ->right instanceof Expr \CallLike && !$ exprLeftType instanceof ConstantType && !$ exprRightType instanceof ConstantType) {
265
- return new SpecifiedTypes ();
266
- }
267
-
268
262
if ($ context ->true ()) {
269
263
$ type = TypeCombinator::intersect ($ scope ->getType ($ expr ->right ), $ scope ->getType ($ expr ->left ));
270
264
$ leftTypes = $ this ->create ($ expr ->left , $ type , $ context , false , $ scope );
@@ -281,6 +275,9 @@ public function specifyTypesInCondition(
281
275
return $ leftTypes ->unionWith ($ rightTypes );
282
276
}
283
277
278
+ $ exprLeftType = $ scope ->getType ($ expr ->left );
279
+ $ exprRightType = $ scope ->getType ($ expr ->right );
280
+
284
281
$ types = null ;
285
282
286
283
if (
@@ -321,8 +318,10 @@ public function specifyTypesInCondition(
321
318
return $ types ;
322
319
}
323
320
324
- return $ this ->create ($ expr ->left , $ exprLeftType , $ context , false , $ scope )->normalize ($ scope )
325
- ->intersectWith ($ this ->create ($ expr ->right , $ exprRightType , $ context , false , $ scope )->normalize ($ scope ));
321
+ if ($ expr ->left instanceof Expr \Variable && $ expr ->right instanceof Expr \Variable) {
322
+ return $ this ->create ($ expr ->left , $ exprLeftType , $ context , false , $ scope )->normalize ($ scope )
323
+ ->intersectWith ($ this ->create ($ expr ->right , $ exprRightType , $ context , false , $ scope )->normalize ($ scope ));
324
+ }
326
325
}
327
326
328
327
} elseif ($ expr instanceof Node \Expr \BinaryOp \NotIdentical) {
@@ -357,9 +356,6 @@ public function specifyTypesInCondition(
357
356
358
357
$ leftType = $ scope ->getType ($ expr ->left );
359
358
$ rightType = $ scope ->getType ($ expr ->right );
360
- if ($ expr ->left instanceof Expr \CallLike && $ expr ->right instanceof Expr \CallLike && !$ leftType instanceof ConstantType && !$ rightType instanceof ConstantType) {
361
- return new SpecifiedTypes ();
362
- }
363
359
364
360
$ leftBooleanType = $ leftType ->toBoolean ();
365
361
if ($ leftBooleanType instanceof ConstantBooleanType && $ rightType instanceof BooleanType) {
0 commit comments