mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-25 17:45:35 +03:00
Set validator classes to psalm-immutable
This commit is contained in:
@@ -21,6 +21,8 @@ use function str_replace;
|
||||
|
||||
/**
|
||||
* GenericValidator validates strings as UUIDs of any variant
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
final class GenericValidator implements ValidatorInterface
|
||||
{
|
||||
@@ -30,7 +32,6 @@ final class GenericValidator implements ValidatorInterface
|
||||
private const VALID_PATTERN = '^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$';
|
||||
|
||||
/**
|
||||
* @psalm-pure
|
||||
* @psalm-return non-empty-string
|
||||
* @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty
|
||||
* @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty
|
||||
@@ -40,9 +41,6 @@ final class GenericValidator implements ValidatorInterface
|
||||
return self::VALID_PATTERN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-pure
|
||||
*/
|
||||
public function validate(string $uuid): bool
|
||||
{
|
||||
$uuid = str_replace(['urn:', 'uuid:', 'URN:', 'UUID:', '{', '}'], '', $uuid);
|
||||
|
||||
Reference in New Issue
Block a user