@@ -620,6 +620,20 @@ private function resolveType(Expr $node): Type
620
620
) {
621
621
return new ConstantBooleanType (true );
622
622
}
623
+
624
+ $ leftType = $ this ->getType ($ node ->left );
625
+ $ rightType = $ this ->getType ($ node ->right );
626
+
627
+ $ stringType = new StringType ();
628
+ $ integerType = new IntegerType ();
629
+ $ floatType = new FloatType ();
630
+ if (
631
+ ($ stringType ->isSuperTypeOf ($ leftType )->yes () && $ stringType ->isSuperTypeOf ($ rightType )->yes ())
632
+ || ($ integerType ->isSuperTypeOf ($ leftType )->yes () && $ integerType ->isSuperTypeOf ($ rightType )->yes ())
633
+ || ($ floatType ->isSuperTypeOf ($ leftType )->yes () && $ floatType ->isSuperTypeOf ($ rightType )->yes ())
634
+ ) {
635
+ return $ this ->getType (new Expr \BinaryOp \Identical ($ node ->left , $ node ->right ));
636
+ }
623
637
}
624
638
625
639
if ($ node instanceof Expr \BinaryOp \NotEqual) {
@@ -632,6 +646,20 @@ private function resolveType(Expr $node): Type
632
646
) {
633
647
return new ConstantBooleanType (false );
634
648
}
649
+
650
+ $ leftType = $ this ->getType ($ node ->left );
651
+ $ rightType = $ this ->getType ($ node ->right );
652
+
653
+ $ stringType = new StringType ();
654
+ $ integerType = new IntegerType ();
655
+ $ floatType = new FloatType ();
656
+ if (
657
+ ($ stringType ->isSuperTypeOf ($ leftType )->yes () && $ stringType ->isSuperTypeOf ($ rightType )->yes ())
658
+ || ($ integerType ->isSuperTypeOf ($ leftType )->yes () && $ integerType ->isSuperTypeOf ($ rightType )->yes ())
659
+ || ($ floatType ->isSuperTypeOf ($ leftType )->yes () && $ floatType ->isSuperTypeOf ($ rightType )->yes ())
660
+ ) {
661
+ return $ this ->getType (new Expr \BinaryOp \NotIdentical ($ node ->left , $ node ->right ));
662
+ }
635
663
}
636
664
637
665
return new BooleanType ();
0 commit comments