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
Ben Ramsey
19f01c7985
No longer set variant/version bits inside the time generator
2020-01-21 16:38:07 -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
5d7c0f2210
Move files to clean up project root directory
2020-01-19 23:48:55 -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
3c975dd194
Add v2() convenience function for version 2 UUIDs
2020-01-18 18:45:00 -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
8202946225
Add NilUuid concrete class to represent nil UUIDs
2020-01-18 12:14:01 -06:00
Ben Ramsey
959dc2a9b0
Refactor tests for GenericValidator
2020-01-18 12:14:01 -06:00
Ben Ramsey
d21a3e3875
Add tests to ensure static methods return specific UUID types
2020-01-18 12:14:01 -06:00
Ben Ramsey
0b64d6d995
Optimize how OrderedTimeCodec rearranges bytes and validates instances
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
5d1f106882
Rename Validator\Validator to Validator\GenericValidator
2020-01-18 12:14:00 -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
26a02a93db
Restore ExpectedBehaviorTest as close to 3.x version as possible
2020-01-18 12:13:59 -06:00
Ben Ramsey
d7c6f28761
Clean up test names in FeatureSetTest
2020-01-18 12:13:59 -06:00
Ben Ramsey
f5cfb5f57d
Split known v3 and v5 UUID tests into providers
2020-01-18 12:13:59 -06:00
Ben Ramsey
deb888c4a3
Set floating-point precision for tests to "14"
2020-01-18 12:13:59 -06:00
Ben Ramsey
37f72746a7
Remove checks that are no longer necessary
2020-01-18 12:13:59 -06:00
Ben Ramsey
c80ad2606f
Deprecate degraded UUIDs; they are no longer necessary
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