380 Commits

Author SHA1 Message Date
Ben Ramsey 4666f7128f Merge branch 'main' into patch-1 2021-08-06 16:27:50 -05: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 7ca2832d3b chore: suppress redundant condition complaint 2021-08-06 16:14:11 -05:00
Ben Ramsey fb9ef508b0 Merge branch 'fix-static-analysis' of https://github.com/pawel-slowik/uuid into pawel-slowik-fix-static-analysis 2021-08-06 16:08:43 -05:00
Ben Ramsey 0b4be8392a fix: check whether property is set 2021-08-06 14:29:01 -05:00
Ben Ramsey 4511ccd7e6 chore(deps): upgrade vimeo/psalm 2021-08-06 14:25:16 -05:00
Ben Ramsey c005f69d6e chore: update package files 2021-08-06 14:05:57 -05:00
Paweł Słowik fe475968db Assure unserialized NodeProviderCollection contains only valid elements
This stops Psalm from complaining about MixedPropertyTypeCoercion
2021-05-24 22:48:58 +02:00
Paweł Słowik 7e4909e764 Assure unserialized BuilderCollection contains only valid elements
This stops Psalm from complaining about MixedPropertyTypeCoercion
2021-05-24 22:44:43 +02:00
Paweł Słowik aeb5e4d297 Specify NodeProviderCollection element type
This stops PHPStan from complaining:

Class Ramsey\Uuid\Provider\Node\NodeProviderCollection extends generic class
Ramsey\Collection\AbstractCollection but does not specify its types: T
2021-05-24 22:31:23 +02:00
Paweł Słowik 605ff66148 Specify BuilderCollection element type
This stops PHPStan from complaining:

Class Ramsey\Uuid\Builder\BuilderCollection extends generic class
Ramsey\Collection\AbstractCollection but does not specify its types: T
2021-05-24 22:30:57 +02:00
Barney Hanlon 90a87a7543 Add interface for UUID-related exceptions (#340)
Add common interface for exceptions so that wrappers can identify that is a UUID-related exception
2021-04-23 11:12:51 -05:00
Jan Langer ef25479d05 Serialization should not use internal codec 2021-02-05 17:36:26 +01:00
Ben Ramsey 59957e2b2d Merge branch 'master' into patch-1 2020-10-29 18:30:23 -05:00
Ben Ramsey b941aa1a9a Prepare test suite for PHP 8 2020-10-29 18:24:14 -05:00
Remi Collet ae7df1ceb9 catch ValueError raised by PHP 8 (#352) 2020-10-29 11:57:41 -05:00
Ben Ramsey 0a25f73ae0 Fix static analysis issues 2020-10-28 21:19:26 -05:00
Ben Ramsey 205bba2e12 Merge branch 'master' into patch-1 2020-08-23 15:09:47 -05:00
Bilge 49b772a5e2 Removed redundant interface inheritance. 2020-08-23 19:36:53 +01:00
Marco Pivetta 0c2b4074d2 Minor performance optimization: LazyUuidFromString#unwrap() now uses an internal instance cache for unwrapped instances 2020-07-09 14:39:36 +02: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
Valentin Udaltsov 388bdab9bc Mark v3() and v5() as pure 2020-04-13 22:22:22 +03: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 07e3254913 Set validator classes to psalm-immutable 2020-03-09 17:08:49 -05:00
Ben Ramsey 67665bf107 Build the time generator when setting the calculator 2020-03-09 17:08:23 -05:00
Ben Ramsey 453806576d [ci skip] Add documentation for replacing default calculator 2020-03-09 15:05:42 -05:00
Ben Ramsey 0f17a01277 [ci skip] Continue documentation improvements 2020-03-07 17:11:51 -06:00
Ben Ramsey 5ed0ba442d Fix Psalm error on 32-bit systems, as a result of 3.9.4 fixes 2020-03-07 16:32:59 -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 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 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 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 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 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