Skip to content

Commit

Permalink
Make name property of enum cases return non-empty-strings (vimeo#6964)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoboss committed Dec 5, 2021
1 parent 056497e commit 2ec77fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Expand Up @@ -202,7 +202,7 @@ public static function analyze(
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(
Expand Down
3 changes: 3 additions & 0 deletions tests/EnumTest.php
Expand Up @@ -126,6 +126,9 @@ enum Status
case PUBLISHED;
case ARCHIVED;
/**
* @return non-empty-string
*/
public function get(): string
{
return $this->name;
Expand Down

0 comments on commit 2ec77fe

Please sign in to comment.