Commit Graph

430 Commits

Author SHA1 Message Date
Ben Ramsey b366701d62 Update documentation with references to RFC 9562 2025-06-01 00:47:29 -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 6bd7221484 Clean up docblocks, code, and note new deprecations
The following are deprecated:

* `Ramsey\Uuid\Codec\OrderedTimeCodec`
* `Ramsey\Uuid\Codec\TimestampFirstCombCodec`
* `Ramsey\Uuid\Codec\TimestampLastCombCodec`
* `Ramsey\Uuid\Generator\CombGenerator`
2025-05-31 17:20:12 -05:00
Ben Ramsey 89d258a96a chore: convert @psalm-return to @return 2025-05-26 00:21:30 -05:00
Choraimy Kroonstuiver c72360e015 Hexadecimal is never an empty string (#593)
Similarly to UUIDs, a hexadecimal can never be empty, this PR documents
it as such.

More and more libraries are starting to enforce stricter typing, I was
dealing with a library that required a `non-empty-string` which
hexadecimal isn't (is, but isn't documented that it is) which requires
either baselining false positives are adding redundant assertions.
2025-05-26 00:09:20 -05:00
philipp.nardmann fd7c1c974c Fixed PHP 8.4 deprecation (#590)
Fixed deprecation warning for str_getcsv in php 8.4, since the default
parameter will change, by providing the parameter explicitly.

Sidenote: some of the vendor packages still have the same issue with
deprecation warnings when running code maintenance tools. They should be
updated as well.

Closes #587
2025-05-25 23:49:04 -05:00
Ben Ramsey bdd1b2f71f chore(deps-dev): upgrade remaining development dependencies 2025-05-25 19:37:26 -05:00
Ben Ramsey 76cbc566e2 chore(deps-dev): upgrade PHPStan 2025-05-25 16:52:53 -05:00
Ben Ramsey 691c2c816e chore(deps-dev): remove Psalm 2025-05-25 14:53:53 -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
Natsuki Ikeguchi 3caf795655 feat: Support brick/math v0.12 (#526)
Signed-off-by: Natsuki Ikeguchi <me@s6n.jp>
2024-04-27 16:17:30 -05:00
Jáchym Toušek 9308b6a600 Improve return type of UuidInterface::compareTo() (#508) 2023-11-07 23:38:32 -06:00
Valentin Udaltsov bc93c5f873 Fixed UnixTimeGenerator collisions (#522)
Closes #518
See https://github.com/symfony/symfony/pull/52367
2023-11-07 21:32:47 -06:00
Wermeille Bastien 628d3dfc55 Fix Unserialize error with OrderedTimeCodec #494 (#496) 2023-04-15 17:59:43 -05:00
Wermeille Bastien abe81c15a9 Fix namepsace conflict #490 (#495) 2023-04-15 17:47:42 -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
Valentin Udaltsov 29bb73b69b Fixed v8() phpDoc (#493) 2023-02-07 10:06:53 -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
zedar187 77e33bc7be feat(SystemNodeProvider): dismiss zero'd mac address (#468)
Co-authored-by: Ben Ramsey <ben@benramsey.com>
2022-12-19 15:30:41 -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 283468905a refactor: improve string encoding performance of non-lazy UUIDs 2022-09-16 11:45:41 -05:00
Ben Ramsey 4000e896f9 refactor: remove dependency on ext-ctype 2022-09-16 09:43:44 -05:00
Ben Ramsey a180174b0e fix: update validation to support versions 6 & 7 2022-09-15 22:14:34 -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 e153b3420a refactor: discard unnecessary trait 2022-09-13 16:39:59 -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 2083110316 feat: deprecate variant and version constants 2022-08-12 20:18:40 -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 bc6cd7d888 Deprecate factory methods; improve deprecation docblocks 2022-08-09 09:24:01 -05:00
Ben Ramsey 2da480d7a3 Fix function type hinting 2022-08-05 17:36:05 -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 f1891183f9 Upgrade PHPStan 2022-08-05 14:46:56 -05:00
Ben Ramsey 115ec653d8 Un-deprecate UuidInterface::getUrn() 2022-03-27 20:55:27 -05:00
Ben Ramsey d98bef096f Deprecate Ramsey\Uuid\Generator\RandomLibAdapter 2022-03-27 13:03:58 -05:00
Marco Pivetta f0ada112c5 Allow iterable<T> where ramsey/collection would be used, deprecate collection classes
This patch is based on https://github.com/ramsey/uuid/pull/405

As discussed in https://github.com/ramsey/uuid/pull/405#discussion_r832095457, the `ramsey/collection`
dependency can be phased out.

Doing so via direct removal is not feasible without a clear BC break, so this change only deprecates:

 * `Ramsey\Uuid\Builder\BuilderCollection`
 * `Ramsey\Uuid\Provider\Node\NodeProviderCollection`

These classes will then be removed in `5.0.0`, along with the `ramsey/collection` dependency.
2022-03-22 17:30:42 +01:00
Marco Pivetta 4cae6c8914 Removed redundant string cast, now correctly identified by vimeo/psalm:^4.20
`substr()` only fails when one of the inputs is not a `string`, but that no longer
holds true as per `php:^8.0`, since the input must be a `string` upfront.
2022-03-22 12:42:55 +01:00
Marco Pivetta 95eb7de42b Removed redundant range check, now correctly identified by vimeo/psalm:^4.20 2022-03-22 12:42:10 +01:00
hubipe e3e9179f27 LazyUuidFromString for valid UUIDs in uppercase (#401) 2022-01-29 13:05:59 -06:00
Ben Ramsey 852850b7da Remove mocks for ext-uuid functions 2021-09-23 18:49:10 -05: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