Commit Graph

46 Commits

Author SHA1 Message Date
Ben Ramsey 0ba1ffb029 fix: ensure monotonicity for version 7 UUIDs 2022-11-05 16:29:26 -05:00
Ben Ramsey ae247f1dcd chore: clean up types and PHP 8-ify the code 2022-09-15 22:14:04 -05:00
Ben Ramsey aa1e488afa feat: support version 7 (Unix Epoch time) UUIDs 2022-09-13 22:13:33 -05:00
Ben Ramsey f1891183f9 Upgrade PHPStan 2022-08-05 14:46:56 -05:00
Ben Ramsey 852850b7da Remove mocks for ext-uuid functions 2021-09-23 18:49:10 -05:00
Ben Ramsey c005f69d6e chore: update package files 2021-08-06 14:05:57 -05: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
Bilge 7947413a76 Use assertSame instead of assertEquals. 2020-08-23 13:53:19 +01:00
Ben Ramsey 4a53d4d33d Check clock sequence and local identifier boundaries 2020-03-07 10:57:12 -06:00
Ben Ramsey 86c37eff4c Change NodeProviderInterface::getNode() to return Hexadecimal 2020-02-29 22:35:45 -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 fb4f54fb84 Address static analysis issues 2020-02-08 13:14:17 -06:00
Ben Ramsey 0bff9e8660 Add NameGeneratorInterface and generators for v3 and v5 UUIDs 2020-02-08 13:12:20 -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
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 80a7be00b3 Return Hexadecimal type from TimeConverterInterface::calculateTime() 2020-01-21 23:28:10 -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 72a2312f62 Support generation of version 2 (DCE Security) UUIDs 2020-01-18 12:14:01 -06:00
Ben Ramsey 4125885862 Add getTime() to TimeProviderInterface and mark currentTime() deprecated 2020-01-18 12:13:58 -06:00
Ben Ramsey 12896f06db Use internal exceptions
Fixes #254
2020-01-18 12:13:55 -06:00
Ben Ramsey 0d7b8c2b7a 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:55 -06:00
Ben Ramsey 81f0f9a9b4 Clean-up tests and use PHPStan max level for tests 2020-01-18 12:13:09 -06:00
Ben Ramsey 8544df0f40 Remove the MtRandGenerator 2020-01-18 12:13:09 -06:00
Ben Ramsey 05f3f16158 Remove the OpenSslGenerator 2020-01-18 12:13:09 -06:00
Ben Ramsey 506135cc6e Remove SodiumRandomGenerator generator class; it is no longer necessary 2020-01-18 12:13:08 -06:00
SignpostMarv 0030399564 Increase PHPStan levels and update code to resolve issues found 2020-01-18 12:13:08 -06:00
Martin Hujer ca2629767d Require phpstan and correct issues found up to level 2
* issues found by phpstan L0
* issues found by phpstan L1
* issues found by phpstan L2 in src/
* issues found by phpstan L2 in tests/
2020-01-18 12:13:08 -06:00
Ben Ramsey 5d7ee63f1c Update dev requirements and test suite for PHP 7+ only 2020-01-18 12:13:07 -06:00
Jildert Miedema 225eb3b4c1 Set minimum version to PHP 5.6 and use PHP 5.5 style ::class constants 2020-01-18 12:13:07 -06:00
Ben Ramsey 2ed5a60a61 Fix "access array offset on value of type null" errors 2019-12-06 21:24:32 -08:00
Ben Ramsey 64ba9a2767 Clean up code according to PhpStorm inspections report 2019-11-30 13:14:52 -08:00
Ben Ramsey 657add4b3c Fix mock invocation assertions 2019-11-30 09:10:09 -08:00
Ben Ramsey 466629a399 Use a high-strength generator by default, when using RandomLibAdapter 2019-11-30 09:10:09 -08:00
Martin Hujer f3e0fed2d7 Drop remnants of HHVM from tests
It was removed from Travis in c479cdd42f
2019-11-30 09:10:09 -08:00
Ben Ramsey 1b608e7e01 Remove test that fails because of qualified function call 2019-11-30 09:10:09 -08:00
Marcel Hernandez 76efebe0ac generate random clockSeq with random_int() instead of mt_rand() 2018-01-19 16:17:49 -06:00
Marcel Hernandez 3567caf3f9 fixed off-by-one error on DefaultTimeGenerator 2018-01-19 16:17:36 -06:00
Ben Peachey dbb9a8b6d1 Changes all usage in Tests of getMock with getMockBuilder. 2017-10-17 12:46:25 +02:00
Jessica Mauerhan e0c2ff2a09 Fix code style 2016-10-06 11:10:40 -04:00
Jessica Mauerhan 761e5115be Add function mock test for systems without libsodium 2016-10-04 16:23:36 -04:00
Andreas Möller 7ff6fff06d Fix: Move tests one up 2016-09-15 08:31:27 +02:00
Ben Ramsey f5e96b6af7 Restructure tests 2015-10-03 10:59:44 -05:00
Ben Ramsey 1bdc10a306 Add RandomBytesGenerator for use with PHP 7. 2015-07-22 21:34:15 +00:00
Ben Ramsey b3ef99a2e9 Move RandomGeneratorInterface and RandomGeneratorFactory to Generator NS 2015-07-16 09:54:04 -05:00