Commit Graph

42 Commits

Author SHA1 Message Date
Ben Ramsey 55d8833b06 feat: support version 8, custom UUIDs 2022-11-05 17:57:29 -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 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 115ec653d8 Un-deprecate UuidInterface::getUrn() 2022-03-27 20:55:27 -05:00
Ben Ramsey b941aa1a9a Prepare test suite for PHP 8 2020-10-29 18:24:14 -05: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
Marco Pivetta 15a5d4f5e1 Propagating @psalm-pure to factories and builders used internally to purely assemble a UuidInterface
Ref: https://github.com/ramsey/uuid/pull/300#issuecomment-601329450
2020-03-23 11:25:22 +01:00
Ben Ramsey 07e3254913 Set validator classes to psalm-immutable 2020-03-09 17:08:49 -05:00
Ben Ramsey 0f17a01277 [ci skip] Continue documentation improvements 2020-03-07 17:11:51 -06:00
Ben Ramsey 57e3ce9dd7 Fix Psalm errors resulting from changes introduced in 3.9.4 2020-03-07 15:22:00 -06:00
Ben Ramsey b31703e7c9 Improve documentation 2020-03-04 22:50:39 -06:00
Ben Ramsey b3c26661ca Correct capitalization of microsecond 2020-03-04 16:51:46 -06:00
Ben Ramsey 1f1329433f Add getDateTime() to UuidV2 2020-03-02 22:56:56 -06:00
Ben Ramsey cbd6a45a6a [ci skip] Update documentation 2020-03-01 23:59:58 -06:00
Ben Ramsey 4ffd156a84 Add StaticNodeProvider to make it easier to use a static node 2020-02-29 17:23:27 -06:00
Ben Ramsey 19a91b7522 Add missing convenience methods for UuidV2 2020-02-29 11:29:12 -06:00
Ben Ramsey 0bd312f944 Improve test coverage 2020-02-26 20:17:49 -06:00
Ben Ramsey a8bbc2f58a Add ValidatorInterface::getPattern() and set constants to private 2020-02-23 16:12:52 -06:00
Ben Ramsey cc2bf6f8ef Support version 6 UUIDs
See the following:

* https://github.com/uuid6/uuid6-ietf-draft
* http://gh.peabody.io/uuidv6/
2020-02-22 22:41:15 -06:00
Ben Ramsey 65b0c091c0 Deprecate VALID_PATTERN, UUID_TYPE_IDENTIFIER; suggest replacements 2020-02-21 13:37:06 -06:00
Ben Ramsey a7cf07a2d8 Fix microsecond rounding error on 32-bit systems 2020-02-21 02:51:31 -06:00
Ben Ramsey a78056d42c Use actual byte string instead of hex2bin() on hex string 2020-02-21 01:41:38 -06:00
Ben Ramsey 7af4814017 Round microseconds to six digits when getting DateTime from v1 UUIDs 2020-02-21 01:17:05 -06:00
Marco Pivetta a252f29847 Import used functions and constants via use statement to disallow ambiguity for compiler/static-analysis
As documented in https://wiki.php.net/rfc/use_global_elements, the engine (by default) does a local namespace
lookup, then falls back to global namespace when first calling a global function referenced in namespaced code,
unless that function is referenced via fully qualified name (FQN).

By using the FQN, the actual symbol can be looked up at compile-time, both by the PHP engine and by static analysis
tooling, allowing for compiler (in particular) optimizations to replace known hot-path functions with specialized opcodes.

Sadly, no actual benchmark at hand: the improvements can be minimal or massive, depending on where this library is
used (tight loops being most relevant).
2020-02-03 13:15:35 -06:00
Ben Ramsey bf237a1962 Change UuidBuilderInterface::build() to accept bytes instead of fields 2020-01-21 15:49:18 -06:00
Ben Ramsey 13aaa217fa Add specific validator for RFC 4122 variant UUIDs 2020-01-20 21:06:37 -06:00
Ben Ramsey 7ea7e4282e Validate fields passed to specific UUID version classes 2020-01-20 21:05:06 -06:00
Ben Ramsey a5c7314f8d Fix string passed to DateTimeImmutable 2020-01-20 21:04:26 -06:00
Ben Ramsey a8d52100de Support microtime in returned DateTimeInterface instances
Fixes #90 and supersedes #93.
2020-01-19 23:21:48 -06:00
Ben Ramsey 72a2312f62 Support generation of version 2 (DCE Security) UUIDs 2020-01-18 12:14:01 -06:00
Ben Ramsey 8202946225 Add NilUuid concrete class to represent nil UUIDs 2020-01-18 12:14:01 -06:00
Ben Ramsey 0cfd017034 Mark more methods on UuidInterface and Uuid for deprecation 2020-01-18 12:14:01 -06:00
Ben Ramsey 12a2b0680d Add individual concrete classes for each version of RFC 4122 UUID 2020-01-18 12:14:01 -06:00
Ben Ramsey 10624f64a1 Change return type of Uuid::getFields() to FieldsInterface 2020-01-18 12:14:00 -06:00
Ben Ramsey 1e26916bf6 Add getTimestamp() and getClockSeq() to FieldsInterface 2020-01-18 12:13:58 -06:00
Ben Ramsey 4d1db4d090 Clean up class naming conventions 2020-01-18 12:13:57 -06:00
Ben Ramsey 24311f2925 Introduce FieldsInterface and base classes for fields support 2020-01-18 12:13:56 -06:00