Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Analyser/Ignore/IgnoredErrorHelperResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ public function process(
continue;
}
if (
isset($unmatchedIgnoredError['count'])
&& isset($unmatchedIgnoredError['realCount'])
isset($unmatchedIgnoredError['count'], $unmatchedIgnoredError['realCount'])
&& (isset($unmatchedIgnoredError['realPath']) || !$onlyFiles)
) {
if ($unmatchedIgnoredError['realCount'] < $unmatchedIgnoredError['count']) {
Expand Down
4 changes: 1 addition & 3 deletions src/Reflection/InitializerExprTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -1549,9 +1549,7 @@
}

if ($leftType instanceof MixedType && $rightType instanceof MixedType) {
if (
($leftIsArray->no() && $rightIsArray->no())
) {
if ($leftIsArray->no() && $rightIsArray->no()) {

Check warning on line 1552 in src/Reflection/InitializerExprTypeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.4, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ } if ($leftType instanceof MixedType && $rightType instanceof MixedType) { - if ($leftIsArray->no() && $rightIsArray->no()) { + if ($leftIsArray->no() && !$rightIsArray->yes()) { return new BenevolentUnionType([ new FloatType(), new IntegerType(),

Check warning on line 1552 in src/Reflection/InitializerExprTypeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.4, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ } if ($leftType instanceof MixedType && $rightType instanceof MixedType) { - if ($leftIsArray->no() && $rightIsArray->no()) { + if (!$leftIsArray->yes() && $rightIsArray->no()) { return new BenevolentUnionType([ new FloatType(), new IntegerType(),

Check warning on line 1552 in src/Reflection/InitializerExprTypeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.3, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ } if ($leftType instanceof MixedType && $rightType instanceof MixedType) { - if ($leftIsArray->no() && $rightIsArray->no()) { + if ($leftIsArray->no() && !$rightIsArray->yes()) { return new BenevolentUnionType([ new FloatType(), new IntegerType(),

Check warning on line 1552 in src/Reflection/InitializerExprTypeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.3, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ } if ($leftType instanceof MixedType && $rightType instanceof MixedType) { - if ($leftIsArray->no() && $rightIsArray->no()) { + if (!$leftIsArray->yes() && $rightIsArray->no()) { return new BenevolentUnionType([ new FloatType(), new IntegerType(),
return new BenevolentUnionType([
new FloatType(),
new IntegerType(),
Expand Down
10 changes: 5 additions & 5 deletions src/Rules/Comparison/ImpossibleCheckTypeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function findSpecifiedType(
return null;
} elseif ($functionName === 'in_array' && $argsCount >= 2) {
$haystackArg = $args[1]->value;
$haystackType = ($this->treatPhpDocTypesAsCertain ? $scope->getType($haystackArg) : $scope->getNativeType($haystackArg));
$haystackType = $this->treatPhpDocTypesAsCertain ? $scope->getType($haystackArg) : $scope->getNativeType($haystackArg);
if ($haystackType instanceof MixedType) {
return null;
}
Expand All @@ -107,7 +107,7 @@ public function findSpecifiedType(
}

$needleArg = $args[0]->value;
$needleType = ($this->treatPhpDocTypesAsCertain ? $scope->getType($needleArg) : $scope->getNativeType($needleArg));
$needleType = $this->treatPhpDocTypesAsCertain ? $scope->getType($needleArg) : $scope->getNativeType($needleArg);

$isStrictComparison = false;
if ($argsCount >= 3) {
Expand Down Expand Up @@ -198,7 +198,7 @@ public function findSpecifiedType(
}
} elseif ($functionName === 'method_exists' && $argsCount >= 2) {
$objectArg = $args[0]->value;
$objectType = ($this->treatPhpDocTypesAsCertain ? $scope->getType($objectArg) : $scope->getNativeType($objectArg));
$objectType = $this->treatPhpDocTypesAsCertain ? $scope->getType($objectArg) : $scope->getNativeType($objectArg);

if ($objectType instanceof ConstantStringType
&& !$this->reflectionProvider->hasClass($objectType->getValue())
Expand All @@ -207,7 +207,7 @@ public function findSpecifiedType(
}

$methodArg = $args[1]->value;
$methodType = ($this->treatPhpDocTypesAsCertain ? $scope->getType($methodArg) : $scope->getNativeType($methodArg));
$methodType = $this->treatPhpDocTypesAsCertain ? $scope->getType($methodArg) : $scope->getNativeType($methodArg);

if ($methodType instanceof ConstantStringType) {
if ($objectType instanceof ConstantStringType) {
Expand Down Expand Up @@ -273,7 +273,7 @@ public function findSpecifiedType(
return null;
}

$rootExprType = ($this->treatPhpDocTypesAsCertain ? $scope->getType($rootExpr) : $scope->getNativeType($rootExpr));
$rootExprType = $this->treatPhpDocTypesAsCertain ? $scope->getType($rootExpr) : $scope->getNativeType($rootExpr);
if ($rootExprType instanceof ConstantBooleanType) {
return $rootExprType->getValue();
}
Expand Down
2 changes: 0 additions & 2 deletions src/Rules/Methods/MethodParameterComparisonHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,6 @@ public function compare(ExtendedMethodReflection $prototype, ClassReflection $pr
}

$messages[] = $error->build();

continue;
}

return $messages;
Expand Down
Loading