Ben Ramsey
59dc5bf06d
Move deprecated methods to DeprecatedUuidMethodsTrait
2020-01-18 14:57:05 -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
0cfd017034
Mark more methods on UuidInterface and Uuid for deprecation
2020-01-18 12:14:01 -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
d543895369
Return string integers instead of int integers
2020-01-18 12:13:58 -06:00
Massimiliano Arione
776e472808
add typehints and return 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
d4dd45e908
Apply fields functionality to Uuid class
2020-01-18 12:13:57 -06:00
Ben Ramsey
ef999c2b2c
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:56 -06:00
Massimiliano Arione
0e7cdfe620
add typehints and return types
2020-01-18 12:13:56 -06:00
Ben Ramsey
c0a2ef7d15
Use correct phpcs configuration when running from Travis CI
2020-01-18 12:13:56 -06:00
Ben Ramsey
ffc400e009
Change UuidInterface::getInteger() to always return a string value
2020-01-18 12:13:56 -06:00
Barney Laurance
bdc9170edc
Run Psalm on src as well as Static Analysis Fixture ( #282 )
...
* Run Psalm on src as well as Static Analysis Fixture
Psalm baselining feature is used to prevent immediate build failures -
psalm will just cause failures for errors caused by future changes to
the code.
See https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file
* Fix MixedArgument issues in OrderedTimeCodec
Potentially unpack should be documented as returning string[] instead of
array to make this unecassary.
* Fix Psalm PossiblyNullPropertyAssignmentValue issues
* Add psalm-immutable annotation to Uuid class
* Fix Psalm MixedArgument issues
* Fix MissingImmutableAnnotation psalm issue
* Fix Psalm MixedAssignment issue
* Fix Psalm InvalidReturnStatement / InvalidReturnType issue
* Add ImpureMethodCall issues to baseline.
Fixing these in one place just moves them somewhere else.
* Exclude psalm-baseline.xml from exported git archives
2020-01-18 12:13:56 -06:00
Marco Pivetta
d01922dd14
Marked minimal parts of UuidInterface and Uuid named constructors as pure/immutable
...
This change is the minimum requirement to make the static analysis suite pass checks
on immutability/purity invariants of a `Uuid` and `UuidInterface`: it doesn't ensure
that internals of `Uuid` are pure. That will need deprecation of `Uuid::setFactory()`,
as well as marking any types referenced in private state as `@psalm-immutable` too.
That's out of scope for the current patch, which provides a good 80/20 split on purity
invariants for most (even advanced) UUID downstream users.
2020-01-18 12:13:55 -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
Ben Ramsey
0721630ba4
Refactor converters to uniformly accept and return string values
2020-01-18 12:13:09 -06:00
Carlos Barrero
650cb9f545
Change getDateTime to DateTimeInterface
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
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
da6fcde177
Add tests to ensure consistent behavior from 3.x to 4.x
2020-01-08 16:47:00 -06:00
André Filipe
84fe6cf755
Removed some else/elseif and added some early returns to make the code a little easier to read, nothing changes on the big picture
2019-11-30 15:10:48 -08:00
Ben Ramsey
1273cfaf39
Update param typehint to accept UuidInterface as v3/v5 namespace
2019-11-30 14:15:06 -08:00
Ben Ramsey
64ba9a2767
Clean up code according to PhpStorm inspections report
2019-11-30 13:14:52 -08:00
Ben Ramsey
feb3eb50d1
Revert "Mark toString() method as deprecated, scheduled for removal in 4.0.0"
...
This reverts commit 4c467ce4d5 .
For more information, please see the discussion at:
https://github.com/ramsey/uuid/commit/4c467ce4d5a72c3cf0832c813d4d84d222c3d4bb#commitcomment-31174263
Also refer to the discussion at:
https://github.com/ShittySoft/symfony-live-berlin-2018-doctrine-tutorial/pull/3#issuecomment-460441229
TL;DR: I am retaining `toString()` for improved static analysis and
long-term stability.
2019-11-30 12:33:16 -08:00
Alessandro Minoccheri
c4cc058f3d
change array declarations
2019-11-30 09:10:09 -08:00
Ben Ramsey
4c467ce4d5
Mark toString() method as deprecated, scheduled for removal in 4.0.0
2018-08-12 10:49:01 -05:00
Marco Perone
4b7374129c
add annotations for thrown exceptions
2018-07-09 09:04:12 +02:00
Lee Boynton
2804748423
Don't allow UUIDs to have trailing newline
2018-05-02 18:54:33 +01:00
Davis Peixoto
0915c7bdc2
173 - Expose UUID versions - Alternative 1
...
https://github.com/ramsey/uuid/issues/173
Creating constants on Uuid object, so they can be used as
- UUID::UUID_TYPE_TIME
- UUID::UUID_TYPE_RANDOM
# Alternative 1
Create constants on Uuid class
Signed-off-by: Davis Peixoto <davis.peixoto@gmail.com >
2017-08-02 08:55:26 -03:00
Davis Peixoto
3d1db97b4d
173 - Expose UUID versions - Alternative 1
...
https://github.com/ramsey/uuid/issues/173
Creating constants on Uuid object, so they can be used as
- Uuid::UUID_TYPE_TIME
- Uuid::UUID_TYPE_RANDOM
Signed-off-by: Davis Peixoto <davis.peixoto@gmail.com >
2017-08-01 15:40:21 -03:00
frankdejonge
91d0c6da31
Fixes #91 : Made Uuid's serializable.
2015-10-25 22:15:32 +01:00
Emir Beganovic
fb1cd7a944
Cleanup: Update and add missing docblocks, remove unused imports
...
Just a bit of house keeping for the sake of code cleanliness.
2015-10-05 10:18:21 +02:00
Ben Ramsey
15db91b8f6
Fix minor issues highlighted by Scrutinizer
2015-09-28 12:19:57 -05:00
Ben Ramsey
e6f97dc8ab
Add docblocks for classes and interfaces in top-level Ramsey\Uuid namespace
2015-09-27 18:58:50 -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
Ben Ramsey
e81568ea4f
Fix parse error caused by double "new" keyword
2015-07-28 11:28:07 -05:00
Ben Ramsey
a95140c25c
Remove PeclUuidFactory in favor of the new PeclUuid*Generator
2015-07-28 11:25:07 -05:00
Ben Ramsey
a06a01b07d
Clean up docblocks in Ramsey\Uuid\Uuid.
2015-07-22 21:28:38 +00:00
Ben Ramsey
a300a9dce1
Removing the VERSION constant
2015-07-16 12:57:05 -05:00
Ben Ramsey
9092d16213
Have UuidInterface extend from JsonSerializable and cover it with a test
2015-07-16 11:36:05 -05:00