mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
parent
7660dc2f3e
commit
ac903c5634
@ -215,9 +215,10 @@ class TypeExpander
|
||||
$class_storage = $codebase->classlike_storage_provider->get($return_type->fq_classlike_name);
|
||||
|
||||
if (strpos($return_type->const_name, '*') !== false) {
|
||||
$class_storage = $codebase->classlike_storage_provider->get($return_type->fq_classlike_name);
|
||||
|
||||
$matching_constants = \array_keys($class_storage->constants);
|
||||
$matching_constants = \array_merge(
|
||||
\array_keys($class_storage->constants),
|
||||
\array_keys($class_storage->enum_cases)
|
||||
);
|
||||
|
||||
$const_name_part = \substr($return_type->const_name, 0, -1);
|
||||
|
||||
@ -231,10 +232,6 @@ class TypeExpander
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if ($class_storage->is_enum) {
|
||||
return new Type\Atomic\TEnumCase($return_type->fq_classlike_name, $return_type->const_name);
|
||||
}
|
||||
|
||||
$matching_constants = [$return_type->const_name];
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ class EnumTest extends TestCase
|
||||
[],
|
||||
'8.1'
|
||||
],
|
||||
'SKIPPED-wildcardEnum' => [
|
||||
'wildcardEnumAsParam' => [
|
||||
'<?php
|
||||
enum A {
|
||||
case C_1;
|
||||
@ -174,6 +174,21 @@ class EnumTest extends TestCase
|
||||
[],
|
||||
'8.1',
|
||||
],
|
||||
'wildcardEnumAsReturn' => [
|
||||
'<?php
|
||||
enum E {
|
||||
const A = 1;
|
||||
case B;
|
||||
}
|
||||
|
||||
/** @return E::* */
|
||||
function f(): mixed {
|
||||
return E::B;
|
||||
}',
|
||||
'assertions' => [],
|
||||
[],
|
||||
'8.1',
|
||||
],
|
||||
'wildcardConstantsOnEnum' => [
|
||||
'<?php
|
||||
enum A {
|
||||
|
Loading…
x
Reference in New Issue
Block a user