Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.12.x' into 2.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jan 5, 2025
2 parents 82a6961 + fd7bad3 commit a2d5bb1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
12 changes: 0 additions & 12 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1455,12 +1455,6 @@ parameters:
count: 1
path: src/Type/Php/ArrayCombineFunctionReturnTypeExtension.php

-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantBooleanType is error\-prone and deprecated\. Use Type\:\:isTrue\(\) or Type\:\:isFalse\(\) instead\.$#'
identifier: phpstanApi.instanceofType
count: 1
path: src/Type/Php/ArrayFilterFunctionReturnTypeHelper.php

-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantStringType is error\-prone and deprecated\. Use Type\:\:getConstantStrings\(\) instead\.$#'
identifier: phpstanApi.instanceofType
Expand All @@ -1473,12 +1467,6 @@ parameters:
count: 4
path: src/Type/Php/ArrayMergeFunctionDynamicReturnTypeExtension.php

-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantBooleanType is error\-prone and deprecated\. Use Type\:\:isTrue\(\) or Type\:\:isFalse\(\) instead\.$#'
identifier: phpstanApi.instanceofType
count: 1
path: src/Type/Php/ArraySearchFunctionDynamicReturnTypeExtension.php

-
message: '#^Doing instanceof PHPStan\\Type\\ConstantScalarType is error\-prone and deprecated\. Use Type\:\:isConstantScalarValue\(\) or Type\:\:getConstantScalarTypes\(\) or Type\:\:getConstantScalarValues\(\) instead\.$#'
identifier: phpstanApi.instanceofType
Expand Down
3 changes: 1 addition & 2 deletions src/Type/Php/ArrayFilterFunctionReturnTypeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use PHPStan\Type\BenevolentUnionType;
use PHPStan\Type\Constant\ConstantArrayType;
use PHPStan\Type\Constant\ConstantArrayTypeBuilder;
use PHPStan\Type\Constant\ConstantBooleanType;
use PHPStan\Type\Constant\ConstantIntegerType;
use PHPStan\Type\ErrorType;
use PHPStan\Type\MixedType;
Expand Down Expand Up @@ -256,7 +255,7 @@ private function processKeyAndItemType(MutatingScope $scope, Type $keyType, Type
return [
$keyVarName !== null ? $scope->getVariableType($keyVarName) : $keyType,
$itemVarName !== null ? $scope->getVariableType($itemVarName) : $itemType,
!$booleanResult instanceof ConstantBooleanType,
!$booleanResult->isTrue()->yes(),
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
}

$strictArgType = $scope->getType($functionCall->getArgs()[2]->value);
if (!$strictArgType instanceof ConstantBooleanType || $strictArgType->getValue() === false) {
if (!$strictArgType->isTrue()->yes()) {
return TypeCombinator::union($haystackArgType->getIterableKeyType(), new ConstantBooleanType(false));
}

Expand Down

0 comments on commit a2d5bb1

Please sign in to comment.