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
6 changes: 6 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,12 @@ parameters:
count: 1
path: src/Type/IntersectionType.php

-
rawMessage: 'Doing instanceof PHPStan\Type\Enum\EnumCaseObjectType is error-prone and deprecated. Use Type::getEnumCases() instead.'
identifier: phpstanApi.instanceofType
count: 1
path: src/Type/IntersectionType.php

-
rawMessage: Doing instanceof PHPStan\Type\IntersectionType is error-prone and deprecated.
identifier: phpstanApi.instanceofType
Expand Down
4 changes: 4 additions & 0 deletions src/Type/IntersectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,10 @@ public function getFiniteTypes(): array
foreach ($this->types as $type) {
$oneType = [];
foreach ($type->getFiniteTypes() as $finiteType) {
if ($finiteType instanceof EnumCaseObjectType) {
$oneType[$finiteType->getClassName() . '::' . $finiteType->getEnumCaseName()] = $finiteType;
continue;
}
Comment on lines +1348 to +1351
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the same type description as in

$oneType[$enumCase->getClassName() . '::' . $enumCase->getEnumCaseName()] = $enumCase;

$oneType[$finiteType->describe(VerbosityLevel::typeOnly())] = $finiteType;
}
$compare[] = $oneType;
Expand Down
Loading