@@ -3266,9 +3266,8 @@ public function filterByTruthyValue(Expr $expr): self
32663266
32673267 $ specifiedTypes = $ this ->typeSpecifier ->specifyTypesInCondition ($ this , $ expr , TypeSpecifierContext::createTruthy ());
32683268 if ($ specifiedTypes ->shouldSpecifyOnly ()) {
3269- [$ markerExpr , $ markerValue ] = $ this ->unwrapSpecifyOnlyMarker ($ expr , true );
32703269 $ specifiedTypes = $ specifiedTypes ->unionWith (
3271- $ this ->typeSpecifier ->create ($ markerExpr , new ConstantBooleanType ($ markerValue ), TypeSpecifierContext::createTrue (), $ this ),
3270+ $ this ->typeSpecifier ->create ($ expr , new ConstantBooleanType (true ), TypeSpecifierContext::createTrue (), $ this ),
32723271 );
32733272 }
32743273 $ scope = $ this ->filterBySpecifiedTypes ($ specifiedTypes );
@@ -3289,9 +3288,8 @@ public function filterByFalseyValue(Expr $expr): self
32893288
32903289 $ specifiedTypes = $ this ->typeSpecifier ->specifyTypesInCondition ($ this , $ expr , TypeSpecifierContext::createFalsey ());
32913290 if ($ specifiedTypes ->shouldSpecifyOnly ()) {
3292- [$ markerExpr , $ markerValue ] = $ this ->unwrapSpecifyOnlyMarker ($ expr , false );
32933291 $ specifiedTypes = $ specifiedTypes ->unionWith (
3294- $ this ->typeSpecifier ->create ($ markerExpr , new ConstantBooleanType ($ markerValue ), TypeSpecifierContext::createTrue (), $ this ),
3292+ $ this ->typeSpecifier ->create ($ expr , new ConstantBooleanType (false ), TypeSpecifierContext::createTrue (), $ this ),
32953293 );
32963294 }
32973295 $ scope = $ this ->filterBySpecifiedTypes ($ specifiedTypes );
@@ -3300,24 +3298,6 @@ public function filterByFalseyValue(Expr $expr): self
33003298 return $ scope ;
33013299 }
33023300
3303- /**
3304- * Strips BooleanNot wrappers from a specifyOnly condition so the boolean
3305- * result marker is stored for the underlying call (e.g. `array_key_exists(...)`)
3306- * rather than for the negated form (`!array_key_exists(...)`). The negated form
3307- * is then derived from the inner value instead of being capped at bool.
3308- *
3309- * @return array{Expr, bool}
3310- */
3311- private function unwrapSpecifyOnlyMarker (Expr $ expr , bool $ value ): array
3312- {
3313- while ($ expr instanceof Expr \BooleanNot) {
3314- $ expr = $ expr ->expr ;
3315- $ value = !$ value ;
3316- }
3317-
3318- return [$ expr , $ value ];
3319- }
3320-
33213301 /**
33223302 * @return static
33233303 */
0 commit comments