Set validator classes to psalm-immutable

This commit is contained in:
Ben Ramsey
2020-03-09 17:08:49 -05:00
parent 67665bf107
commit 07e3254913
3 changed files with 6 additions and 11 deletions
+2 -4
View File
@@ -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);