67 Commits

Author SHA1 Message Date
Ben Ramsey d2382419f3 Merge branch '4.x' into 5.x 2025-06-25 18:42:16 -05:00
Ben Ramsey 4ca249e960 Ignore the "result unused" error in tests from the PHPStan config 2025-06-25 08:24:36 -05:00
Brandon Morrison aa18ce15d5 Fix pure annotations (#605)
Coming from https://github.com/ramsey/uuid/pull/603, this is an attempt
to fix the errors raised by the current phpstan settings.

I went through each of the errors raised by phpstan with the following
approach.

- If a method is part of an `@immutable` class, we can consider it pure,
  assuming it only affects internal variables.
- If a potentially pure method is calling a class's method that is only
  swapped during testing (and not during normal usage), then we can
  consider the calling method pure.
- If a class is marked deprecated, don't bother with attempting to mark
  it pure or immutable.
2025-06-25 08:24:36 -05:00
Ben Ramsey eaa5e16923 Assert the length of time bytes is 6 2025-06-23 18:01:01 -05:00
Ben Ramsey f2956967f2 Update tests for testing bytes "rollover" 2025-06-23 17:32:33 -05:00
Ben Ramsey b40c069763 Remove errant echo statement from test.
[skip ci]
2025-06-23 15:27:20 -05:00
Ben Ramsey 7abc2f2035 Ensure tests are properly checking against the previous values 2025-06-22 17:38:46 -05:00
Ben Ramsey 74138a1c95 Remove deprecated classes
* Codec\OrderedTimeCodec
* Codec\TimestampFirstCombCodec
* Codec\TimestampLastCombCodec
* Generator\CombGenerator
* Nonstandard\UuidV6
2025-05-31 19:11:35 -05:00
Ben Ramsey bbd78052d7 chore(deps-dev): upgrade PHPUnit to v11.5 2025-05-26 01:54:17 -05:00
Ben Ramsey 82d4b5f92a Merge branch '4.x' into 5.x 2025-05-25 21:55:49 -05:00
Ben Ramsey bdd1b2f71f chore(deps-dev): upgrade remaining development dependencies 2025-05-25 19:37:26 -05:00
Ben Ramsey e82d747fbd Merge branch '4.x' into 5.x 2025-05-25 18:34:47 -05:00
Ben Ramsey 76cbc566e2 chore(deps-dev): upgrade PHPStan 2025-05-25 16:52:53 -05:00
Ben Ramsey c94add912b Merge branch '4.x' into 5.x 2023-01-01 15:15:10 -06:00
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 483b9c9de0 feat: narrow the clock sequence type hints 2022-08-13 10:43:35 -05:00
Ben Ramsey 8c0a06654e feat: introduce Version enum and use instead of constants 2022-08-12 20:10:51 -05:00
Ben Ramsey 3d3bf1b518 Update types throughout the code base 2022-08-09 18:23:17 -05:00
Ben Ramsey 346f840e21 Merge branch '4.x' into 5.x 2022-08-05 15:17:01 -05:00
Ben Ramsey f1891183f9 Upgrade PHPStan 2022-08-05 14:46:56 -05:00
Ben Ramsey 382fdf777f chore: upgrade PHPStan 2022-04-01 17:41:59 -05:00
Ben Ramsey 2fad6c1107 Specify length as a positive-int 2022-03-27 13:51:50 -05:00
Ben Ramsey c2cfd0c4fb Remove deprecated Ramsey\Uuid\Generator\RandomLibAdapter 2022-03-27 13:17:39 -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