Commit Graph

158 Commits

Author SHA1 Message Date
Ben Ramsey d8ade1e1d2 Merge branch '4.x' into 5.x 2025-05-25 12:49:19 -05:00
Markus Staab 558009ce4c Prevent PHPStan error: 'Uuid::fromString() on a separate line has no effect.' (#552)
Co-authored-by: Ben Ramsey <ben@benramsey.com>
2024-05-18 14:34:25 -05:00
Ben Ramsey d04a1b479e Merge branch '4.x' into 5.x 2023-04-15 18:38:51 -05:00
Wermeille Bastien 628d3dfc55 Fix Unserialize error with OrderedTimeCodec #494 (#496) 2023-04-15 17:59:43 -05:00
Ben Ramsey 008f6cea26 Merge branch '4.x' into 5.x 2023-01-11 19:45:14 -06:00
George Steel 4a14ce0c62 fix: Amends psalm assertion syntax on Uuid::isValid() to prevent incorrect type inference (#486)
* fix: Amends psalm assertion syntax on `Uuid::isValid()` to prevent incorrect type inference
* Add static analysis test case for invalid input
2023-01-10 16:09:08 -06:00
Ben Ramsey c94add912b Merge branch '4.x' into 5.x 2023-01-01 15:15:10 -06:00
Marcel Berteler 5e24bfd390 feat: add Uuid:fromHexadecimal() (#309)
Co-authored-by: mberteler <marcel.berteler@capetown.gov.za>
Co-authored-by: Ben Ramsey <ben@benramsey.com>
2022-12-19 15:18:32 -06:00
Ben Ramsey 55d8833b06 feat: support version 8, custom UUIDs 2022-11-05 17:57:29 -05:00
Ben Ramsey ae247f1dcd chore: clean up types and PHP 8-ify the code 2022-09-15 22:14:04 -05:00
Ben Ramsey 685c2f3f23 feat: support max UUIDs 2022-09-14 20:44:24 -05:00
Ben Ramsey 4f4deb1dd6 feat: add UUIDv7 documentation and customization 2022-09-14 18:21:10 -05:00
Ben Ramsey aa1e488afa feat: support version 7 (Unix Epoch time) UUIDs 2022-09-13 22:13:33 -05:00
Ben Ramsey 078feed166 chore: update nomenclature 2022-09-12 20:56:42 -05:00
Ben Ramsey b78bcda2d1 feat: move UuidV6 to the Rfc4122 namespace 2022-09-12 19:41:46 -05:00
Ben Ramsey 89905d1948 chore: remove deprecation notices 2022-09-12 19:41:45 -05:00
Ben Ramsey 483b9c9de0 feat: narrow the clock sequence type hints 2022-08-13 10:43:35 -05:00
Ben Ramsey 4e2fc803c6 feat: introduce TimeBasedUuidFactoryInterface 2022-08-13 10:21:59 -05:00
Ben Ramsey 2083110316 feat: deprecate variant and version constants 2022-08-12 20:18:40 -05:00
Ben Ramsey 8c0a06654e feat: introduce Version enum and use instead of constants 2022-08-12 20:10:51 -05:00
Ben Ramsey 3d3bf1b518 Update types throughout the code base 2022-08-09 18:23:17 -05:00
Ben Ramsey 86520a0d27 Merge branch '4.x' into 5.x 2022-08-09 10:07:10 -05:00
George Steel b4dff559ab Assert non-empty-string when UUID is valid (#410)
* Assert, for psalm, the string is non-empty if validation passes
* Adds a test for SA asserting that valid string are also non-empty
* Suppress PHPStan error for unsupported conditional type assertion
* Check SA tools don't complain about non-empty-string as input parameter to `Uuid::isValid()`
2022-08-09 10:04:36 -05:00
Ben Ramsey 2b46cec8e5 Merge branch '4.x' into 5.x 2022-08-05 17:40:48 -05:00
Ben Ramsey 7b3eaf32c7 Deprecate Uuid::setFactory() and Uuid::getFactory() 2022-08-05 17:34:18 -05:00
Ben Ramsey 55693967d7 Deprecate direct instantiation of Ramsey\Uuid\Uuid 2022-08-05 17:28:11 -05:00
Ben Ramsey 069d74fdce Remove deprecated Uuid::UUID_TYPE_IDENTIFIER constant 2022-08-05 16:55:10 -05:00
Ben Ramsey b551e4645d Remove deprecated Uuid::VALID_PATTERN constant 2022-08-05 16:52:23 -05:00
Ben Ramsey f1891183f9 Upgrade PHPStan 2022-08-05 14:46:56 -05:00
Ben Ramsey 3c4b784d33 chore: upgrade Psalm and update baseline 2022-04-01 17:41:59 -05:00
Ben Ramsey dec678d60b feat: remove deprecated Serializable interface 2022-04-01 17:41:58 -05:00
Ben Ramsey 13edf70fc9 feat: introduce Variant enum and use instead of constants 2022-04-01 17:41:58 -05:00
Ben Ramsey 189f7f69ca Remove DeprecatedUuidInterface and trait 2022-03-27 23:10:05 -05:00
Ben Ramsey b1c03e96eb Merge branch '4.x' into 5.x 2022-03-27 21:01:19 -05:00
Ben Ramsey 115ec653d8 Un-deprecate UuidInterface::getUrn() 2022-03-27 20:55:27 -05:00
Ben Ramsey 1d4077d213 Remove deprecated getClockSeqHiAndReservedHex() method 2022-03-27 16:37:53 -05:00
hubipe e3e9179f27 LazyUuidFromString for valid UUIDs in uppercase (#401) 2022-01-29 13:05:59 -06:00
Graham Campbell 2ed177534e Ignore serialization shape checking for code coverage purposes 2021-09-05 14:03:47 +01:00
Graham Campbell 0997de99a2 Add support for PHP 8.1 2021-09-05 12:41:13 +01:00
Chris Smith 8fa223b1af Fix soft BC break of Uuid::fromString()
Uses an assertion to indicate the `$uuid` variable cannot be an empty
string, satisfying docblock on `LazyUuidFromString`.
2021-08-09 12:51:40 +01:00
Ben Ramsey 06f8e67792 Merge pull request #361 from slevomat/patch-1
Serialization should not use internal codec
2021-08-06 16:25:27 -05:00
Ben Ramsey c005f69d6e chore: update package files 2021-08-06 14:05:57 -05:00
Jan Langer ef25479d05 Serialization should not use internal codec 2021-02-05 17:36:26 +01:00
Marco Pivetta a621ca9e81 Uuid::uuid3() uses impure Uuid::getFactory() API - suppressing it from purity static analysis checks 2020-07-09 14:04:20 +02:00
Marco Pivetta b805572537 Ensure that Uuid::uuidX() generators produce instances equivalent to Uuid::fromString() and Uuid::fromBytes()
With this change, `Uuid::uuid1()`, `Uuid::uuid2()` and so forth now produce a `LazyUuidFromString` instance, which
is both more memory efficient and comparable to `Uuid::fromString()` instances in other tools, such as within
PHPUnit's `Assertion::assertEqual()`, which would reject any two objects not matching each other's types.

Before this patch, `Assertion::assertEquals(Uuid::uuid5(...), Uuid::fromString(...))` would always fail due to
different subtypes produced by the two factory methods.
2020-07-09 13:57:30 +02:00
Marco Pivetta 910e3e459c Adjusted comment wording: s/string/strict (typo)
Co-authored-by: Jacob Dreesen <jacob@hdreesen.de>
2020-07-09 13:57:30 +02:00
Marco Pivetta 1f0cd71d93 Applied fixes and suppressions (sadly) to match psalm/phpstan code quality guidelines
We have a lot of deprecated API in here which shouldn't exist in first place, but that
will luckily disappear with v5.0.0 :-)
2020-07-09 13:57:30 +02:00
Marco Pivetta 1ce3f55673 Applied automated CS fixes according to project CS settings 2020-07-09 13:57:30 +02:00
Marco Pivetta 0f68910bf2 Optimized Uuid::fromBytes() de-serialization to use LazyUuidFromString where possible 2020-07-09 13:57:30 +02:00
Marco Pivetta 569e93ac4e 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.
2020-07-09 13:57:30 +02:00