@@ -240,9 +240,7 @@ public function specifyTypesInCondition(
240
240
}
241
241
}
242
242
243
- $ leftType = $ scope ->getType ($ expr ->left );
244
243
$ rightType = $ scope ->getType ($ expr ->right );
245
-
246
244
if (
247
245
$ expr ->left instanceof ClassConstFetch &&
248
246
$ expr ->left ->class instanceof Expr &&
@@ -261,40 +259,42 @@ public function specifyTypesInCondition(
261
259
);
262
260
}
263
261
262
+ $ exprLeftType = $ scope ->getType ($ expr ->left );
263
+ $ exprRightType = $ scope ->getType ($ expr ->right );
264
+
264
265
$ types = null ;
265
266
266
267
if (
267
268
(
268
- $ leftType instanceof ConstantType
269
+ $ exprLeftType instanceof ConstantType
269
270
&& !$ expr ->right instanceof Node \Scalar
270
- ) || $ leftType instanceof EnumCaseObjectType
271
+ ) || $ exprLeftType instanceof EnumCaseObjectType
271
272
) {
272
273
$ types = $ this ->create (
273
274
$ expr ->right ,
274
- $ leftType ,
275
+ $ exprLeftType ,
275
276
$ context ,
276
277
false ,
277
278
$ scope ,
278
279
);
279
280
}
280
-
281
281
if (
282
282
(
283
- $ rightType instanceof ConstantType
283
+ $ exprRightType instanceof ConstantType
284
284
&& !$ expr ->left instanceof Node \Scalar
285
- ) || $ rightType instanceof EnumCaseObjectType
285
+ ) || $ exprRightType instanceof EnumCaseObjectType
286
286
) {
287
- $ leftTypes = $ this ->create (
287
+ $ leftType = $ this ->create (
288
288
$ expr ->left ,
289
- $ rightType ,
289
+ $ exprRightType ,
290
290
$ context ,
291
291
false ,
292
292
$ scope ,
293
293
);
294
294
if ($ types !== null ) {
295
- $ types = $ types ->unionWith ($ leftTypes );
295
+ $ types = $ types ->unionWith ($ leftType );
296
296
} else {
297
- $ types = $ leftTypes ;
297
+ $ types = $ leftType ;
298
298
}
299
299
}
300
300
@@ -319,9 +319,10 @@ public function specifyTypesInCondition(
319
319
return $ leftTypes ->unionWith ($ rightTypes );
320
320
}
321
321
322
- return $ this ->create ($ expr ->left , $ leftType , $ context , false , $ scope )->normalize ($ scope )
323
- ->intersectWith ($ this ->create ($ expr ->right , $ rightType , $ context , false , $ scope )->normalize ($ scope ));
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
324
}
325
+
325
326
} elseif ($ expr instanceof Node \Expr \BinaryOp \NotIdentical) {
326
327
return $ this ->specifyTypesInCondition (
327
328
$ scope ,
0 commit comments