diff --git a/composer.json b/composer.json index 978cb19..2513db7 100644 --- a/composer.json +++ b/composer.json @@ -31,6 +31,6 @@ "require-dev": { "phpunit/phpunit": "^9.5", "squizlabs/php_codesniffer": "1.*", - "vimeo/psalm": "^4.6.2" + "vimeo/psalm": "^4.6.2 || ^5.2" } } diff --git a/src/Enum.php b/src/Enum.php index 4c94cf6..1bd5592 100644 --- a/src/Enum.php +++ b/src/Enum.php @@ -176,6 +176,7 @@ public static function values() /** @psalm-var T $value */ foreach (static::toArray() as $key => $value) { + /** @psalm-suppress UnsafeGenericInstantiation */ $values[$key] = new static($value); } @@ -297,6 +298,7 @@ public static function __callStatic($name, $arguments) $message = "No static method or enum constant '$name' in class " . static::class; throw new \BadMethodCallException($message); } + /** @psalm-suppress UnsafeGenericInstantiation */ return self::$instances[$class][$name] = new static($array[$name]); } return clone self::$instances[$class][$name]; @@ -308,7 +310,6 @@ public static function __callStatic($name, $arguments) * * @return mixed * @link http://php.net/manual/en/jsonserializable.jsonserialize.php - * @psalm-pure */ #[\ReturnTypeWillChange] public function jsonSerialize()