Ben Ramsey
115ec653d8
Un-deprecate UuidInterface::getUrn()
2022-03-27 20:55:27 -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
Ben Ramsey
22ee596348
Make serialize(UuidInterface) more compact
...
Resolves #318
2020-07-08 15:27:19 -05:00
Ben Ramsey
ba8fff1d3a
Fix collection deserialization errors
2020-03-29 15:13:32 -05:00
Marco Pivetta
c8e8b7b693
Marking Uuid::uuid3() as pure as well: it produces same values for same input
2020-03-23 10:18:21 +01:00
Marco Pivetta
e830b23d77
Marking Uuid::uuid5() as pure: same input leads to same output, and no I/O under normal operational constraints
2020-03-23 10:18:21 +01:00
Ben Ramsey
b31703e7c9
Improve documentation
2020-03-04 22:50:39 -06:00
Ben Ramsey
cbd6a45a6a
[ci skip] Update documentation
2020-03-01 23:59:58 -06:00
Ben Ramsey
bb78f0e598
Simplify comparison algorithm
2020-03-01 16:19:40 -06:00
Ben Ramsey
19a91b7522
Add missing convenience methods for UuidV2
2020-02-29 11:29:12 -06:00
Ben Ramsey
fec93008bc
Accept Type\Hexadecimal for the first parameter to uuid1()
2020-02-24 14:34:40 -06:00
Ben Ramsey
ab3c89fb8e
Change the $node parameter from mixed to ?Hexadecimal
2020-02-24 13:44:03 -06:00
Ben Ramsey
614fc69b45
Add use statements for PHP functions
2020-02-23 16:13:31 -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
f42afcecbb
Rename Type\IntegerValue to Type\Integer
...
Rename `Type\IntegerValue` to `Type\Integer`. It was originally named
`IntegerValue` because static analysis sees `Integer` in docblock
annotations and treats it as the native `int` type. `Integer` is not a
reserved word in PHP, so it should be named `Integer` for consistency
with other types in this library. When using it, a class alias prevents
static analysis from complaining.
2020-02-21 11:59:49 -06:00
Ben Ramsey
e0ff858ff6
Return Hexadecimal from getHex() and IntegerValue from getInteger()
2020-02-21 01:40:14 -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
Marco Pivetta
598b47d07f
Refining type of producing a string that can be declared as non-empty-string
2020-02-03 11:05:36 -06:00
Ben Ramsey
5fa4eb4f17
Add fromDateTime() to create version 1 UUIDs from DateTime instances
...
Fixes #28
2020-02-03 00:48:41 -06:00
Ben Ramsey
59dc5bf06d
Move deprecated methods to DeprecatedUuidMethodsTrait
2020-01-18 14:57:05 -06:00
Ben Ramsey
268e66aad8
Add static Uuid::uuid2() method
2020-01-18 14:14:47 -06:00
Ben Ramsey
72a2312f62
Support generation of version 2 (DCE Security) 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
2ad77d9ca7
Remove CalculatorInterface as a Uuid constructor parameter
2020-01-18 12:14:00 -06:00
Ben Ramsey
52f764c284
Change first constructor param in Uuid to Rfc4122\FieldsInterface
2020-01-18 12:14:00 -06:00
Ben Ramsey
360261d617
Deprecate all the fields methods on UuidInterface and Uuid
2020-01-18 12:14:00 -06:00
Ben Ramsey
10624f64a1
Change return type of Uuid::getFields() to FieldsInterface
2020-01-18 12:14:00 -06:00
Ben Ramsey
c11c023796
Address static analysis issues and add additional tests
2020-01-18 12:13:59 -06:00
Ben Ramsey
d543895369
Return string integers instead of int integers
2020-01-18 12:13:58 -06:00
Massimiliano Arione
776e472808
add typehints and return types
2020-01-18 12:13:57 -06:00
Ben Ramsey
668b6ab9a2
Use the codec to encode to binary when using Uuid::getBytes()
2020-01-18 12:13:57 -06:00
Ben Ramsey
4d1db4d090
Clean up class naming conventions
2020-01-18 12:13:57 -06:00
Ben Ramsey
d4dd45e908
Apply fields functionality to Uuid class
2020-01-18 12:13:57 -06:00
Ben Ramsey
ef999c2b2c
Update coding style to include PSR-12, among other options
...
This also includes heavy use of slevomat/coding-standard to apply
various checks to the code, based on maintainer (me) preference.
2020-01-18 12:13:56 -06:00
Massimiliano Arione
0e7cdfe620
add typehints and return types
2020-01-18 12:13:56 -06:00