From a0c0307ae93e2696ca18fa92cb61c6e25df835e6 Mon Sep 17 00:00:00 2001 From: Dendy Faist Date: Wed, 17 Sep 2025 12:29:38 +0200 Subject: [PATCH] fix: Remove extraneous "KLM" characters from beginning of NIE check If such characters were present in the NIE to be checked a TypeError would be thrown: TypeError: Unsupported operand types: string % int Tried to find any evidence of these charatcters actually being allowed for Spanish NIE but no evidence of such a thing was found. If this were an error and they are in fact supported then proper handling of those inputs is advised. --- src/Validator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Validator.php b/src/Validator.php index 67d5c38..416485a 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -41,7 +41,7 @@ public function isValidNif(?string $value): bool public function isValidNie(?string $value): bool { if ($value) { - $regEx = '/^[KLMXYZ][0-9]{7}[A-Z]$/i'; + $regEx = '/^[XYZ][0-9]{7}[A-Z]$/i'; $letters = 'TRWAGMYFPDXBNJZSQVHLCKE'; $value = strtoupper($value);