Re-implemented Uuid::fromString() so it produces a LazyUuidFromString when possible

This should speed up `Uuid::fromString()` massively, leading to much shallower execution
paths when `toString()` and similar simplistic API is required.
This commit is contained in:
Marco Pivetta
2020-06-30 14:38:04 +02:00
parent 8d42044a99
commit 569e93ac4e
8 changed files with 482 additions and 37 deletions
+13 -1
View File
@@ -72,12 +72,24 @@ class GenericValidatorTest extends TestCase
'value' => 'ff6f8cb0-c57da-51e1-9b21-0800200c9a66',
'expected' => false,
],
[
'value' => "ff6f8cb0-c57d-11e1-1b21-0800200c9a66\n",
'expected' => false,
],
[
'value' => "\nff6f8cb0-c57d-11e1-1b21-0800200c9a66",
'expected' => false,
],
[
'value' => "\nff6f8cb0-c57d-11e1-1b21-0800200c9a66\n",
'expected' => false,
],
]);
}
public function testGetPattern(): void
{
$expectedPattern = '^[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}$';
$expectedPattern = '\A[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}\z';
$validator = new GenericValidator();