Ben Ramsey
3546a86f7d
Deprecate BigNumberConverter and BigNumberTimeConverter
2020-01-18 12:13:58 -06:00
Ben Ramsey
9b2c93c5b5
Add generic converters for numbers and time
2020-01-18 12:13:58 -06:00
Ben Ramsey
cd03f39e9c
Depend on brick/math for arbitrary-precision math
2020-01-18 12:13:58 -06:00
Ben Ramsey
07fc6b8f6f
Add Hexadecimal, IntegerValue, and Time types
2020-01-18 12:13:57 -06:00
Ben Ramsey
668b6ab9a2
Use the codec to encode to binary when using Uuid::getBytes()
2020-01-18 12:13:57 -06:00
Ben Ramsey
4d1db4d090
Clean up class naming conventions
2020-01-18 12:13:57 -06:00
Ben Ramsey
ebaa04a6b2
Improve coverage and unit tests for fields, GUIDs, and nonstandard UUIDs
2020-01-18 12:13:57 -06:00
Ben Ramsey
70eace9086
Introduce separate classes to handle nonstandard UUIDs
2020-01-18 12:13:57 -06:00
Ben Ramsey
d6ed9b3832
Introduce separate class support for GUIDs
2020-01-18 12:13:57 -06:00
Ben Ramsey
d4dd45e908
Apply fields functionality to Uuid class
2020-01-18 12:13:57 -06:00
Ben Ramsey
24311f2925
Introduce FieldsInterface and base classes for fields support
2020-01-18 12:13:56 -06:00
Ben Ramsey
3e81dad348
Fix static analysis issues with tests
2020-01-18 12:13:56 -06:00
Ben Ramsey
b7f9dc5010
Check for RFC 4122, version 1 UUIDs with OrderedTimeCodec
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
Ben Ramsey
0721630ba4
Refactor converters to uniformly accept and return string values
2020-01-18 12:13:09 -06:00
Ben Ramsey
81f0f9a9b4
Clean-up tests and use PHPStan max level for tests
2020-01-18 12:13:09 -06:00
Carlos Barrero
650cb9f545
Change getDateTime to DateTimeInterface
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
Julian Ecknig
4de1348099
Add GmpConverter and GmpTimeConverter
2020-01-18 12:13:09 -06:00
Bradyn Poulsen
3cf759ad05
Migrate isValid() to Validator and ValidatorInterface
...
* Maintain backwards compatibility with the former Uuid::isValid() and
Uuid::VALID_PATTERN
* Remove the assert statements in favor of str_replace and preg_match
* Make the validator a featureset of the factory
* Remove old suggestion about locations of constants
* Remove argument count assertions
* Remove VALID_PATTERN from Uuid
2020-01-18 12:13:08 -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
Martin Hujer
049d5acf7a
Use ::class constants where possible
...
It helps with refactorings and static analysis, because you can easily
tell if the class is missing or not.
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
eb1645bc72
Add behavior test for TimestampFirstCombCodec
2020-01-13 10:49:53 -06:00
Ben Ramsey
da6fcde177
Add tests to ensure consistent behavior from 3.x to 4.x
2020-01-08 16:47:00 -06:00
Ben Ramsey
b39ec78f6e
Check whether sysfs is readable before attempting to read it
...
Fixes #260
2019-12-17 02:01:14 -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
e1761af875
Disable deprecation messages for now
2019-12-06 17:55:09 -08:00
Ben Ramsey
231027100a
Increase microseconds in another test to ensure enough time passes
2019-12-06 14:54:08 -08:00
Ben Ramsey
9e48187656
Add slightly more sleep to ensure timestamps don't collide
2019-12-04 17:09:13 -08:00
Ben Ramsey
692175901d
Fix RandomNodeProvider behavior on 32-bit systems
...
The 6 bytes obtained from `random_bytes()` is a 48-bit integer, which
cannot be converted to decimal on a 32-bit system, without being
implicitly cast to a float by PHP. This was causing problems with
setting the multicast bit, and it led to non-random node values.
This new approach splits the 6 bytes up into two 3-byte values, each a
24-bit integer, and applies the multicast bit to the most significant
bits before re-combining the bytes as a string.
2019-11-30 20:26:42 -08:00
Ben Ramsey
35cf50d7b4
Add tests for the function API
2019-11-30 14:26:27 -08:00
Viktor Szépe
bc201fe3e4
Add uuid PECL stubs
2019-11-30 13:33:54 -08:00
Ben Ramsey
64ba9a2767
Clean up code according to PhpStorm inspections report
2019-11-30 13:14:52 -08:00
Ben Ramsey
3f43661fdc
Create stubs for testing uuid_* methods for environments without pecl/uuid
2019-11-30 12:19:43 -08:00
Ben Ramsey
555e5c1102
Test usage of PHP_OS constant
2019-11-30 12:18:43 -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
bfc4afdf1f
Tests: configure cacheDir for AspectMock
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
Ben Ramsey
93a19b8133
Fix failing build due to coding standards violation
2018-07-19 17:19:38 -05:00
Ben Ramsey
8d621488c4
Check whether passthru() is disabled
...
If passthru() is disabled in php.ini, this will force the
SystemNodeProvider to return `false` for the node. Using the default
FallbackNodeProvider, ramsey/uuid will default to the
RandomNodeProvider, in these cases.
Closes #114
2018-07-19 16:53:00 -05:00
Ben Ramsey
b8cac9278c
Merge branch 'SystemNodeProvider-FreeBSD-support' of https://github.com/kalifg/uuid into kalifg-SystemNodeProvider-FreeBSD-support
2018-07-19 15:08:45 -05:00
Lee Boynton
2804748423
Don't allow UUIDs to have trailing newline
2018-05-02 18:54:33 +01:00