diff --git a/src/Rfc4122/Validator.php b/src/Rfc4122/Validator.php index 97cdb7e..7dcf078 100644 --- a/src/Rfc4122/Validator.php +++ b/src/Rfc4122/Validator.php @@ -22,6 +22,8 @@ use function str_replace; /** * Rfc4122\Validator validates strings as UUIDs of the RFC 4122 variant + * + * @psalm-immutable */ final class Validator implements ValidatorInterface { @@ -29,7 +31,6 @@ final class Validator implements ValidatorInterface . '[1-5]{1}[0-9A-Fa-f]{3}-[ABab89]{1}[0-9A-Fa-f]{3}-[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 @@ -39,9 +40,6 @@ final class Validator implements ValidatorInterface return self::VALID_PATTERN; } - /** - * @psalm-pure - */ public function validate(string $uuid): bool { $uuid = str_replace(['urn:', 'uuid:', 'URN:', 'UUID:', '{', '}'], '', $uuid); diff --git a/src/Validator/GenericValidator.php b/src/Validator/GenericValidator.php index 84fc645..f6a6010 100644 --- a/src/Validator/GenericValidator.php +++ b/src/Validator/GenericValidator.php @@ -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); diff --git a/src/Validator/ValidatorInterface.php b/src/Validator/ValidatorInterface.php index ef813c2..3d4bd6f 100644 --- a/src/Validator/ValidatorInterface.php +++ b/src/Validator/ValidatorInterface.php @@ -16,6 +16,8 @@ namespace Ramsey\Uuid\Validator; /** * A validator validates a string as a proper UUID + * + * @psalm-immutable */ interface ValidatorInterface { @@ -24,7 +26,6 @@ interface ValidatorInterface * * @return string The regular expression pattern this validator uses * - * @psalm-pure * @psalm-return non-empty-string */ public function getPattern(): string; @@ -35,8 +36,6 @@ interface ValidatorInterface * @param string $uuid The string to validate as a UUID * * @return bool True if the string is a valid UUID, false otherwise - * - * @psalm-pure */ public function validate(string $uuid): bool; }