Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Nov 27, 2023
1 parent 4c937b1 commit 0a39b42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1557,11 +1557,6 @@ parameters:
count: 4
path: src/Type/TypeCombinator.php

-
message: "#^Doing instanceof PHPStan\\\\Type\\\\Enum\\\\EnumCaseObjectType is error\\-prone and deprecated\\. Use Type\\:\\:getEnumCases\\(\\) instead\\.$#"
count: 1
path: src/Type/TypeCombinator.php

-
message: "#^Doing instanceof PHPStan\\\\Type\\\\FloatType is error\\-prone and deprecated\\. Use Type\\:\\:isFloat\\(\\) instead\\.$#"
count: 1
Expand Down
5 changes: 3 additions & 2 deletions src/Type/TypeCombinator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use PHPStan\Type\Constant\ConstantFloatType;
use PHPStan\Type\Constant\ConstantIntegerType;
use PHPStan\Type\Constant\ConstantStringType;
use PHPStan\Type\Enum\EnumCaseObjectType;
use PHPStan\Type\Generic\GenericClassStringType;
use PHPStan\Type\Generic\TemplateBenevolentUnionType;
use PHPStan\Type\Generic\TemplateType;
Expand Down Expand Up @@ -200,8 +199,10 @@ public static function union(Type ...$types): Type
if ($types[$i] instanceof StringType && !$types[$i] instanceof ClassStringType) {
$hasGenericScalarTypes[ConstantStringType::class] = true;
}
if ($types[$i] instanceof EnumCaseObjectType) {
$enumCases = $types[$i]->getEnumCases();
if (count($enumCases) === 1) {
$enumCaseTypes[$types[$i]->describe(VerbosityLevel::cache())] = $types[$i];

unset($types[$i]);
continue;
}
Expand Down

0 comments on commit 0a39b42

Please sign in to comment.