Commit Graph

389 Commits

Author SHA1 Message Date
Ben Ramsey f1891183f9 Upgrade PHPStan 2022-08-05 14:46:56 -05:00
Alexander Schranz a800c468aa Remove dependency to moontoast/math (#426) 2022-08-05 11:50:28 -05:00
Simon Podlipsky 9a8ea11ad3 fix: adapt tests to reflect GH-7758 (#435) 2022-08-05 11:31:53 -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 5f9cd80b1b Migrated from PHPUnit_Framework_TestCase#assertRegExp() (deprecated) to #assertMatchesRegularExpression() 2022-03-22 12:43:22 +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
Ben Ramsey aa6535442e Show deprecations in tests 2021-09-23 17:04:10 -05:00
Chris Smith ef1eb74c82 Add test covering Uuid::fromString() being called with empty string 2021-08-09 12:55:31 +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 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
Jan Langer ef25479d05 Serialization should not use internal codec 2021-02-05 17:36:26 +01:00
Ben Ramsey b941aa1a9a Prepare test suite for PHP 8 2020-10-29 18:24:14 -05:00
Remi Collet e20165e9dd use expectError instead of expectException (#351) 2020-10-29 10:07:00 -05:00
Ben Ramsey 954cb23d5e Allow builds to fail on PHP 8.0 2020-10-28 22:22:54 -05:00
Ben Ramsey 0a25f73ae0 Fix static analysis issues 2020-10-28 21:19:26 -05:00
Bilge 7947413a76 Use assertSame instead of assertEquals. 2020-08-23 13:53:19 +01:00
Marco Pivetta fa14d04231 Added benchmark about extracting UUID field details 2020-07-09 14:23:49 +02:00
Marco Pivetta 6339cd9fbc Added UUID serialization benchmark 2020-07-09 14:15:05 +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 2421b79841 Added benchmark for UUID generation logic 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 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 8d42044a99 Minimal benchmarks around Uuid::fromString(), Uuid::fromBytes(), Uuid#toString(), Uuid#getBytes()
This is mostly to store an initial state, before we go on and start manipulating the UUID library internals.
2020-07-09 13:56:04 +02:00
Ben Ramsey 22ee596348 Make serialize(UuidInterface) more compact
Resolves #318
2020-07-08 15:27:19 -05:00
Ben Ramsey b3c3920875 Fix space before break style error 2020-03-31 16:52:23 -05:00
Ben Ramsey ba8fff1d3a Fix collection deserialization errors 2020-03-29 15:13:32 -05: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
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 fcfcd3fb60 Fix failing tests on Windows
escapeshellargs() uses different quotation mark characters between Linux
and Windows, so tests were failing on Windows. This change uses a
regular expression instead.
2020-03-17 11:43:45 -05:00
Ben Ramsey 706bac009f Fix PHPStan errors 2020-03-16 10:44:20 -05:00
Ben Ramsey 4a53d4d33d Check clock sequence and local identifier boundaries 2020-03-07 10:57:12 -06:00
Ben Ramsey 8a8d5d4ba8 Add isNegative() to the Type\NumberInterface 2020-03-07 10:57:12 -06:00
Ben Ramsey b3c26661ca Correct capitalization of microsecond 2020-03-04 16:51:46 -06:00
Ben Ramsey a21eb6c3ca Update TypeInterface to extend JsonSerializable and Serializable 2020-03-04 16:44:05 -06:00
Ben Ramsey 1f1329433f Add getDateTime() to UuidV2 2020-03-02 22:56:56 -06:00
Ben Ramsey b9b56c13a4 Rename toIntegerValue() to toInteger() 2020-03-02 16:05:26 -06:00
Ben Ramsey 836de4ece5 Allow setting the node provider on the FeatureSet 2020-02-29 23:51:00 -06:00
Ben Ramsey 86c37eff4c Change NodeProviderInterface::getNode() to return Hexadecimal 2020-02-29 22:35:45 -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 ba7c1c17ce Add more tests for UuidV6 2020-02-24 15:14:57 -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 84a2e76c7e Remove currentTime() method 2020-02-23 16:11:50 -06:00
Ben Ramsey aaccc850a1 Use strict argument validation for collections
This resolves #106
2020-02-23 00:50:00 -06:00