Skip to content

Commit 0a39b42

Browse files
committed
Fix
1 parent 4c937b1 commit 0a39b42

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,11 +1557,6 @@ parameters:
15571557
count: 4
15581558
path: src/Type/TypeCombinator.php
15591559

1560-
-
1561-
message: "#^Doing instanceof PHPStan\\\\Type\\\\Enum\\\\EnumCaseObjectType is error\\-prone and deprecated\\. Use Type\\:\\:getEnumCases\\(\\) instead\\.$#"
1562-
count: 1
1563-
path: src/Type/TypeCombinator.php
1564-
15651560
-
15661561
message: "#^Doing instanceof PHPStan\\\\Type\\\\FloatType is error\\-prone and deprecated\\. Use Type\\:\\:isFloat\\(\\) instead\\.$#"
15671562
count: 1

src/Type/TypeCombinator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use PHPStan\Type\Constant\ConstantFloatType;
1717
use PHPStan\Type\Constant\ConstantIntegerType;
1818
use PHPStan\Type\Constant\ConstantStringType;
19-
use PHPStan\Type\Enum\EnumCaseObjectType;
2019
use PHPStan\Type\Generic\GenericClassStringType;
2120
use PHPStan\Type\Generic\TemplateBenevolentUnionType;
2221
use PHPStan\Type\Generic\TemplateType;
@@ -200,8 +199,10 @@ public static function union(Type ...$types): Type
200199
if ($types[$i] instanceof StringType && !$types[$i] instanceof ClassStringType) {
201200
$hasGenericScalarTypes[ConstantStringType::class] = true;
202201
}
203-
if ($types[$i] instanceof EnumCaseObjectType) {
202+
$enumCases = $types[$i]->getEnumCases();
203+
if (count($enumCases) === 1) {
204204
$enumCaseTypes[$types[$i]->describe(VerbosityLevel::cache())] = $types[$i];
205+
205206
unset($types[$i]);
206207
continue;
207208
}

0 commit comments

Comments
 (0)