@@ -760,18 +760,17 @@ private function resolveType(string $exprString, Expr $node): Type
760760 $ node instanceof Node \Expr \BinaryOp \BooleanAnd
761761 || $ node instanceof Node \Expr \BinaryOp \LogicalAnd
762762 ) {
763+ $ noopCallback = static function (): void {
764+ };
765+ $ leftResult = $ this ->nodeScopeResolver ->processExprNode ($ node ->left , $ this , $ noopCallback , ExpressionContext::createDeep ());
763766 $ leftBooleanType = $ this ->getType ($ node ->left )->toBoolean ();
764- if (
765- $ leftBooleanType ->isFalse ()->yes ()
766- ) {
767+ if ($ leftBooleanType ->isFalse ()->yes ()) {
767768 return new ConstantBooleanType (false );
768769 }
769770
770- $ rightBooleanType = $ this -> filterByTruthyValue ( $ node -> left )->getType ($ node ->right )->toBoolean ();
771+ $ rightBooleanType = $ leftResult -> getTruthyScope ( )->getType ($ node ->right )->toBoolean ();
771772
772- if (
773- $ rightBooleanType ->isFalse ()->yes ()
774- ) {
773+ if ($ rightBooleanType ->isFalse ()->yes ()) {
775774 return new ConstantBooleanType (false );
776775 }
777776
@@ -789,18 +788,17 @@ private function resolveType(string $exprString, Expr $node): Type
789788 $ node instanceof Node \Expr \BinaryOp \BooleanOr
790789 || $ node instanceof Node \Expr \BinaryOp \LogicalOr
791790 ) {
791+ $ noopCallback = static function (): void {
792+ };
793+ $ leftResult = $ this ->nodeScopeResolver ->processExprNode ($ node ->left , $ this , $ noopCallback , ExpressionContext::createDeep ());
792794 $ leftBooleanType = $ this ->getType ($ node ->left )->toBoolean ();
793- if (
794- $ leftBooleanType ->isTrue ()->yes ()
795- ) {
795+ if ($ leftBooleanType ->isTrue ()->yes ()) {
796796 return new ConstantBooleanType (true );
797797 }
798798
799- $ rightBooleanType = $ this -> filterByFalseyValue ( $ node -> left )->getType ($ node ->right )->toBoolean ();
799+ $ rightBooleanType = $ leftResult -> getFalseyScope ( )->getType ($ node ->right )->toBoolean ();
800800
801- if (
802- $ rightBooleanType ->isTrue ()->yes ()
803- ) {
801+ if ($ rightBooleanType ->isTrue ()->yes ()) {
804802 return new ConstantBooleanType (true );
805803 }
806804
0 commit comments