Skip to content

Fix phpstan/phpstan#8031: Union of constant string type lost when used with generics. #26547

Fix phpstan/phpstan#8031: Union of constant string type lost when used with generics.

Fix phpstan/phpstan#8031: Union of constant string type lost when used with generics. #26547

Triggered via pull request March 9, 2026 16:12
Status Failure
Total duration 17m 38s
Artifacts

tests.yml

on: pull_request
Matrix: Tests PHPUnit 12.x
Determine levels tests matrix
43s
Determine levels tests matrix
Matrix: Integration tests
Matrix: Tests PHPUnit 11.x
Matrix: Tests with old PHPUnit
Matrix: Mutation Testing
Matrix: Levels tests
Fit to window
Zoom out
Zoom in

Annotations

10 errors and 6 warnings
Tests with old PHPUnit (8.0, ubuntu-latest)
Process completed with exit code 2.
Tests with old PHPUnit (8.1, ubuntu-latest)
Process completed with exit code 2.
Tests with old PHPUnit (7.4, ubuntu-latest)
Process completed with exit code 2.
Tests PHPUnit 11.x (8.2, ubuntu-latest)
Process completed with exit code 2.
Tests PHPUnit 11.x (8.2, windows-latest)
Process completed with exit code 1.
Tests with old PHPUnit (8.0, windows-latest)
Process completed with exit code 1.
Tests with old PHPUnit (7.4, windows-latest)
Process completed with exit code 1.
Tests with old PHPUnit (8.1, windows-latest)
Process completed with exit code 1.
Mutation Testing (8.3, ubuntu-latest)
Process completed with exit code 1.
Mutation Testing (8.4, ubuntu-latest)
Process completed with exit code 1.
Mutation Testing (8.3, ubuntu-latest): src/Type/Generic/TemplateTypeHelper.php#L147
Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ $isArrayKey = $templateType->getBound()->describe(VerbosityLevel::precise()) === '(int|string)'; if ($type->isInteger()->yes() && $isArrayKey) { $type = $type->generalize(GeneralizePrecision::templateArgument()); - } elseif ($type->isConstantValue()->yes() && !$templateType->getBound()->isScalar()->yes()) { + } elseif ($type->isConstantValue()->yes() && $templateType->getBound()->isScalar()->no()) { $type = $type->generalize(GeneralizePrecision::templateArgument()); } }
Mutation Testing (8.3, ubuntu-latest): src/Type/Generic/TemplateTypeHelper.php#L147
Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ $isArrayKey = $templateType->getBound()->describe(VerbosityLevel::precise()) === '(int|string)'; if ($type->isInteger()->yes() && $isArrayKey) { $type = $type->generalize(GeneralizePrecision::templateArgument()); - } elseif ($type->isConstantValue()->yes() && !$templateType->getBound()->isScalar()->yes()) { + } elseif (!$type->isConstantValue()->no() && !$templateType->getBound()->isScalar()->yes()) { $type = $type->generalize(GeneralizePrecision::templateArgument()); } }
Mutation Testing (8.3, ubuntu-latest): src/Type/Generic/TemplateTypeHelper.php#L145
Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ { if (!$templateType->getVariance()->covariant()) { $isArrayKey = $templateType->getBound()->describe(VerbosityLevel::precise()) === '(int|string)'; - if ($type->isInteger()->yes() && $isArrayKey) { + if (!$type->isInteger()->no() && $isArrayKey) { $type = $type->generalize(GeneralizePrecision::templateArgument()); } elseif ($type->isConstantValue()->yes() && !$templateType->getBound()->isScalar()->yes()) { $type = $type->generalize(GeneralizePrecision::templateArgument());
Mutation Testing (8.4, ubuntu-latest): src/Type/Generic/TemplateTypeHelper.php#L147
Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ $isArrayKey = $templateType->getBound()->describe(VerbosityLevel::precise()) === '(int|string)'; if ($type->isInteger()->yes() && $isArrayKey) { $type = $type->generalize(GeneralizePrecision::templateArgument()); - } elseif ($type->isConstantValue()->yes() && !$templateType->getBound()->isScalar()->yes()) { + } elseif ($type->isConstantValue()->yes() && $templateType->getBound()->isScalar()->no()) { $type = $type->generalize(GeneralizePrecision::templateArgument()); } }
Mutation Testing (8.4, ubuntu-latest): src/Type/Generic/TemplateTypeHelper.php#L147
Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ $isArrayKey = $templateType->getBound()->describe(VerbosityLevel::precise()) === '(int|string)'; if ($type->isInteger()->yes() && $isArrayKey) { $type = $type->generalize(GeneralizePrecision::templateArgument()); - } elseif ($type->isConstantValue()->yes() && !$templateType->getBound()->isScalar()->yes()) { + } elseif (!$type->isConstantValue()->no() && !$templateType->getBound()->isScalar()->yes()) { $type = $type->generalize(GeneralizePrecision::templateArgument()); } }
Mutation Testing (8.4, ubuntu-latest): src/Type/Generic/TemplateTypeHelper.php#L145
Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ { if (!$templateType->getVariance()->covariant()) { $isArrayKey = $templateType->getBound()->describe(VerbosityLevel::precise()) === '(int|string)'; - if ($type->isInteger()->yes() && $isArrayKey) { + if (!$type->isInteger()->no() && $isArrayKey) { $type = $type->generalize(GeneralizePrecision::templateArgument()); } elseif ($type->isConstantValue()->yes() && !$templateType->getBound()->isScalar()->yes()) { $type = $type->generalize(GeneralizePrecision::templateArgument());