Commit Graph

23 Commits

Author SHA1 Message Date
Ben Ramsey b3c26661ca Correct capitalization of microsecond 2020-03-04 16:51:46 -06:00
Ben Ramsey fec93008bc Accept Type\Hexadecimal for the first parameter to uuid1() 2020-02-24 14:34:40 -06:00
Marco Pivetta dee551deb1 Removed use function imports for mocked/stubbed functions, disabling phpcs import rule
While the rule is now disabled, it still is very much valuable to import most pure functions from the core
PHP scope, allowing us some marginal gains on anything that can be inlined by the engine (now or in future).

The rule does not allow selective exclusions, so we will need to keep it off for now.
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 c11c023796 Address static analysis issues and add additional tests 2020-01-18 12:13:59 -06:00
Ben Ramsey 4125885862 Add getTime() to TimeProviderInterface and mark currentTime() deprecated 2020-01-18 12:13:58 -06:00
Ben Ramsey 3e81dad348 Fix static analysis issues with tests 2020-01-18 12:13:56 -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
Massimiliano Arione 5459113b81 add typehints and return types 2020-01-18 12:13:10 -06:00
SignpostMarv 0030399564 Increase PHPStan levels and update code to resolve issues found 2020-01-18 12:13:08 -06:00
Ben Ramsey 64ba9a2767 Clean up code according to PhpStorm inspections report 2019-11-30 13:14:52 -08:00
Alessandro Minoccheri c4cc058f3d change array declarations 2019-11-30 09:10:09 -08:00
Marco Perone 4b7374129c add annotations for thrown exceptions 2018-07-09 09:04:12 +02: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 Ramsey 5bf7f5064c Add docblocks for classes and interfaces in Ramsey\Uuid\Generator namespace 2015-09-26 19:06:21 -05:00
Scrutinizer Auto-Fixer f59b447603 Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2015-08-13 15:32:44 +00:00
Aztech 8974c76bf6 Refactor TimeGeneratorInterface
- Remove UuidFactory from signature
- Remove setters on UuidFactory to prevent inconsistencies (a new feature set and factory should be used instead)
- Update tests to reflect those changes
2015-07-27 11:14:20 -05:00
Ben Ramsey dfbf8b8098 Abstract time generation into family of TimeGeneratorInterface classes 2015-07-27 11:14:20 -05:00