mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Make name property of enum cases return non-empty-strings (vimeo/psalm#6964)
This commit is contained in:
parent
056497e73d
commit
2ec77fe29c
@ -202,7 +202,7 @@ class AtomicPropertyFetchAnalyzer
|
||||
new Type\Union([new Type\Atomic\TLiteralString($lhs_type_part->case_name)])
|
||||
);
|
||||
} else {
|
||||
$statements_analyzer->node_data->setType($stmt, Type::getString());
|
||||
$statements_analyzer->node_data->setType($stmt, Type::getNonEmptyString());
|
||||
}
|
||||
} else {
|
||||
self::handleNonExistentProperty(
|
||||
|
@ -126,6 +126,9 @@ class EnumTest extends TestCase
|
||||
case PUBLISHED;
|
||||
case ARCHIVED;
|
||||
|
||||
/**
|
||||
* @return non-empty-string
|
||||
*/
|
||||
public function get(): string
|
||||
{
|
||||
return $this->name;
|
||||
|
Loading…
Reference in New Issue
Block a user