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
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
ad75532dc8
Add a Type\TypeInterface that each of the ramsey/uuid types implements
2020-02-21 12:16:49 -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
a7cf07a2d8
Fix microsecond rounding error on 32-bit systems
2020-02-21 02:51:31 -06:00
Ben Ramsey
e0ff858ff6
Return Hexadecimal from getHex() and IntegerValue from getInteger()
2020-02-21 01:40:14 -06:00
Ben Ramsey
7af4814017
Round microseconds to six digits when getting DateTime from v1 UUIDs
2020-02-21 01:17:05 -06:00
Ben Ramsey
4a44aeab2e
Add a test for the Unix epoch with v1 UUIDs
2020-02-20 17:23:32 -06:00
Ben Ramsey
5f0850c7b5
Add an additional test for last possible date for a v1 UUID
2020-02-20 17:03:08 -06:00
Ben Ramsey
78984c54e9
Exclude phpstan-bootstrap.php from PHPstan analysis
2020-02-08 13:32:23 -06:00
Ben Ramsey
fb4f54fb84
Address static analysis issues
2020-02-08 13:14:17 -06:00
Ben Ramsey
f965293da9
Specify cache locations for build tools
2020-02-08 13:13:47 -06:00
Ben Ramsey
0bff9e8660
Add NameGeneratorInterface and generators for v3 and v5 UUIDs
2020-02-08 13:12:20 -06:00
Ben Ramsey
e5357f2c8a
Add missing native type hints to test method
2020-02-03 16:07:38 -06:00
Ben Ramsey
2e420f94c4
Revert "Suppress MissingNativeTypeHint error from slevomat/coding-standard"
...
This reverts commit e269c16cd4 .
This issue is fixed in slevomat/coding-standard 6.1.4. See thread at
https://github.com/slevomat/coding-standard/issues/883
2020-02-03 16:01:43 -06:00
Marco Pivetta
c7f71244f3
Imported pecl/uuid constants
2020-02-03 13:15:35 -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
e269c16cd4
Suppress MissingNativeTypeHint error from slevomat/coding-standard
2020-02-02 18:38:03 -06:00
Ben Ramsey
80a7be00b3
Return Hexadecimal type from TimeConverterInterface::calculateTime()
2020-01-21 23:28:10 -06:00
Ben Ramsey
4963f2320a
Optimize codec algorithms
2020-01-21 22:17:32 -06:00