132 Commits

Author SHA1 Message Date
Ben Ramsey d11af7e93f Remove checks for methods, since the interface now has them 2025-12-13 21:59:33 -06:00
Ben Ramsey c3005a98bb Merge branch 'ilyaplot-4.x' into 5.x 2025-12-13 21:48:53 -06:00
ilyaplot 7547f3949f Merge branch '4.x' into 4.x 2025-10-05 02:00:49 -07:00
Ben Ramsey d2382419f3 Merge branch '4.x' into 5.x 2025-06-25 18:42:16 -05:00
Brandon Morrison aa18ce15d5 Fix pure annotations (#605)
Coming from https://github.com/ramsey/uuid/pull/603, this is an attempt
to fix the errors raised by the current phpstan settings.

I went through each of the errors raised by phpstan with the following
approach.

- If a method is part of an `@immutable` class, we can consider it pure,
  assuming it only affects internal variables.
- If a potentially pure method is calling a class's method that is only
  swapped during testing (and not during normal usage), then we can
  consider the calling method pure.
- If a class is marked deprecated, don't bother with attempting to mark
  it pure or immutable.
2025-06-25 08:24:36 -05:00
Ben Ramsey 76af496590 Merge branch '4.x' into 5.x 2025-05-31 20:55:42 -05:00
Ben Ramsey b21cb6d655 fix: max UUID should be variant 7, nil UUID should be variant 0 2025-05-31 20:12:03 -05:00
Ben Ramsey 74138a1c95 Remove deprecated classes
* Codec\OrderedTimeCodec
* Codec\TimestampFirstCombCodec
* Codec\TimestampLastCombCodec
* Generator\CombGenerator
* Nonstandard\UuidV6
2025-05-31 19:11:35 -05:00
Ben Ramsey bbd78052d7 chore(deps-dev): upgrade PHPUnit to v11.5 2025-05-26 01:54:17 -05:00
Ben Ramsey 48ac45e7da Merge branch '4.x' into 4.x 2025-05-26 00:14:49 -05:00
Ben Ramsey e82d747fbd Merge branch '4.x' into 5.x 2025-05-25 18:34:47 -05:00
Ben Ramsey 76cbc566e2 chore(deps-dev): upgrade PHPStan 2025-05-25 16:52:53 -05:00
Ilya Plotnikov 0f15cb8e41 Modify tests 2023-05-04 23:06:41 +06:00
Ben Ramsey d04a1b479e Merge branch '4.x' into 5.x 2023-04-15 18:38:51 -05:00
Maximilian Bösing bf2bee216a Add explicit Stringable interface to UuidInterface (#491)
Even tho, the `Stringable` interface is implicit on all objects containing the method `__toString`, it is recommended by PHP to explicitly setting that interface.

From php.net documentation:
> [...] Unlike most interfaces, **Stringable** is implicitly present on any class that has the magic `__toString()` method defined, although it can and should be declared explicitly.

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-02-07 10:14:23 -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 0ba1ffb029 fix: ensure monotonicity for version 7 UUIDs 2022-11-05 16:29:26 -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 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 f1891183f9 Upgrade PHPStan 2022-08-05 14:46:56 -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 d2ae388821 Remove deprecated getDateTime() method 2022-03-27 22:52:01 -05:00
Ben Ramsey 5b98a2fee1 Introduce TimeBasedInterface for UUIDs derived from time 2022-03-27 22:50:14 -05:00
Ben Ramsey cc4df59001 Remove deprecated getVersion() method 2022-03-27 21:47:55 -05:00
Ben Ramsey 8595a6d8c1 Remove deprecated getVariant() method 2022-03-27 21:28:55 -05:00
Ben Ramsey 506a781667 Remove deprecated getFieldsHex() method 2022-03-27 20:40:12 -05:00
Ben Ramsey 67abb86aaf Remove remaining deprecated getClockSeq*() methods 2022-03-27 20:32:00 -05:00
Ben Ramsey e4c7ea0755 Remove deprecated getNode*() methods 2022-03-27 20:22:45 -05:00
Ben Ramsey 23d54b85cb Remove deprecated getTimestamp*() methods 2022-03-27 20:05:08 -05:00
Ben Ramsey b0b5c12bac Remove deprecated getTimeMid*() methods 2022-03-27 19:45:17 -05:00
Ben Ramsey 045c33ba3b Remove deprecated getTimeLow*() methods 2022-03-27 19:34:45 -05:00
Ben Ramsey c47a71f2b1 Remove deprecated getTimeHiAndVersion*() methods 2022-03-27 19:20:40 -05:00
Ben Ramsey eed2aecc17 Remove deprecated getMostSignificantBits*() methods 2022-03-27 18:58:06 -05:00
Ben Ramsey 5541b3d045 Remove deprecated getLeastSignificantBits*() methods 2022-03-27 18:51:18 -05:00
Ben Ramsey f810c0a50c Remove deprecated getClockSequenceHex() method 2022-03-27 18:44:47 -05:00
Ben Ramsey ddb4ce0aca Remove deprecated getClockSeqLowHex() method 2022-03-27 18:32:51 -05:00
Ben Ramsey 1d4077d213 Remove deprecated getClockSeqHiAndReservedHex() method 2022-03-27 16:37:53 -05:00
Ben Ramsey 18688488e1 Remove deprecated "degraded" classes that used moontoast/math 2022-03-27 13:51:14 -05:00
hubipe e3e9179f27 LazyUuidFromString for valid UUIDs in uppercase (#401) 2022-01-29 13:05:59 -06:00
Chris Smith ef1eb74c82 Add test covering Uuid::fromString() being called with empty string 2021-08-09 12:55:31 +01:00
Ben Ramsey d7379b67af test: update exception message for PHP 8.1 2021-08-06 14:35:42 -05:00
Ben Ramsey c005f69d6e chore: update package files 2021-08-06 14:05:57 -05:00
Bilge 7947413a76 Use assertSame instead of assertEquals. 2020-08-23 13:53:19 +01: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