@@ -760,18 +760,17 @@ private function resolveType(string $exprString, Expr $node): Type
760
760
$ node instanceof Node \Expr \BinaryOp \BooleanAnd
761
761
|| $ node instanceof Node \Expr \BinaryOp \LogicalAnd
762
762
) {
763
+ $ noopCallback = static function (): void {
764
+ };
765
+ $ leftResult = $ this ->nodeScopeResolver ->processExprNode ($ node ->left , $ this , $ noopCallback , ExpressionContext::createDeep ());
763
766
$ leftBooleanType = $ this ->getType ($ node ->left )->toBoolean ();
764
- if (
765
- $ leftBooleanType ->isFalse ()->yes ()
766
- ) {
767
+ if ($ leftBooleanType ->isFalse ()->yes ()) {
767
768
return new ConstantBooleanType (false );
768
769
}
769
770
770
- $ rightBooleanType = $ this -> filterByTruthyValue ( $ node -> left )->getType ($ node ->right )->toBoolean ();
771
+ $ rightBooleanType = $ leftResult -> getTruthyScope ( )->getType ($ node ->right )->toBoolean ();
771
772
772
- if (
773
- $ rightBooleanType ->isFalse ()->yes ()
774
- ) {
773
+ if ($ rightBooleanType ->isFalse ()->yes ()) {
775
774
return new ConstantBooleanType (false );
776
775
}
777
776
@@ -789,18 +788,17 @@ private function resolveType(string $exprString, Expr $node): Type
789
788
$ node instanceof Node \Expr \BinaryOp \BooleanOr
790
789
|| $ node instanceof Node \Expr \BinaryOp \LogicalOr
791
790
) {
791
+ $ noopCallback = static function (): void {
792
+ };
793
+ $ leftResult = $ this ->nodeScopeResolver ->processExprNode ($ node ->left , $ this , $ noopCallback , ExpressionContext::createDeep ());
792
794
$ leftBooleanType = $ this ->getType ($ node ->left )->toBoolean ();
793
- if (
794
- $ leftBooleanType ->isTrue ()->yes ()
795
- ) {
795
+ if ($ leftBooleanType ->isTrue ()->yes ()) {
796
796
return new ConstantBooleanType (true );
797
797
}
798
798
799
- $ rightBooleanType = $ this -> filterByFalseyValue ( $ node -> left )->getType ($ node ->right )->toBoolean ();
799
+ $ rightBooleanType = $ leftResult -> getFalseyScope ( )->getType ($ node ->right )->toBoolean ();
800
800
801
- if (
802
- $ rightBooleanType ->isTrue ()->yes ()
803
- ) {
801
+ if ($ rightBooleanType ->isTrue ()->yes ()) {
804
802
return new ConstantBooleanType (true );
805
803
}
806
804
0 commit comments