1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00
This commit is contained in:
Daniil Gentili 2023-10-19 11:35:11 +02:00
parent a233e621b2
commit 5953b1c53a
3 changed files with 20 additions and 6 deletions

View File

@ -1459,7 +1459,7 @@ class ClassLikeNodeScanner
if (!isset($storage->enum_cases[$stmt->name->name])) {
$case = new EnumCaseStorage(
$enum_value?->value,
$enum_value,
$case_location,
);

View File

@ -1,18 +1,31 @@
<?php
declare(strict_types=1);
namespace Psalm\Storage;
use Psalm\CodeLocation;
use Psalm\Type\Atomic\TLiteralInt;
use Psalm\Type\Atomic\TLiteralString;
final class EnumCaseStorage
{
public bool $deprecated = false;
/**
* @var TLiteralString|TLiteralInt|null
*/
public $value;
/** @var CodeLocation */
public $stmt_location;
/**
* @var bool
*/
public $deprecated = false;
public function __construct(
public int|string|null $value,
public CodeLocation $location,
TLiteralString|TLiteralInt|null $value,
CodeLocation $location,
) {
$this->value = $value;
$this->stmt_location = $location;
}
}

View File

@ -1212,6 +1212,7 @@ trait UnionTrait
/**
* @psalm-mutation-free
* @psalm-suppress InvalidFalsableReturnType
*/
public function getSingleLiteral(): TLiteralInt|TLiteralString|TLiteralFloat
{