Commit Graph

37 Commits

Author SHA1 Message Date
Ben Ramsey 115ec653d8 Un-deprecate UuidInterface::getUrn() 2022-03-27 20:55:27 -05:00
Ben Ramsey cbd6a45a6a [ci skip] Update documentation 2020-03-01 23:59:58 -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 e0ff858ff6 Return Hexadecimal from getHex() and IntegerValue from getInteger() 2020-02-21 01:40:14 -06:00
Marco Pivetta 598b47d07f Refining type of producing a string that can be declared as non-empty-string 2020-02-03 11:05:36 -06:00
Ben Ramsey 9c4f45e5c1 Move deprecated interface methods to DeprecatedUuidInterface 2020-01-18 14:27:17 -06:00
Ben Ramsey 0cfd017034 Mark more methods on UuidInterface and Uuid for deprecation 2020-01-18 12:14:01 -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 d4dd45e908 Apply fields functionality to Uuid class 2020-01-18 12:13:57 -06:00
Ben Ramsey 8e79ff851a Address Psalm errors 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
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
Marco Pivetta 667d42b5ce UuidInterface#getInteger() should return a string as per pre-existing declaration 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
Carlos Barrero 650cb9f545 Change getDateTime to DateTimeInterface 2020-01-18 12:13:09 -06:00
Ben Ramsey 5f2eaa6d2d Add __toString() to UuidInterface
Resolves #111
2020-01-18 12:13:09 -06: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
Ben Ramsey 4c467ce4d5 Mark toString() method as deprecated, scheduled for removal in 4.0.0 2018-08-12 10:49:01 -05:00
Ben Ramsey 5d5eab97ee Add ext-json as a dependency 2018-08-05 16:59:04 -05:00
Marco Perone 4b7374129c add annotations for thrown exceptions 2018-07-09 09:04:12 +02:00
frankdejonge 91d0c6da31 Fixes #91: Made Uuid's serializable. 2015-10-25 22:15:32 +01:00
Emir Beganovic 94e39e8202 Add new line after last use 2015-10-05 10:21:32 +02: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
Ben Ramsey 9092d16213 Have UuidInterface extend from JsonSerializable and cover it with a test 2015-07-16 11:36:05 -05:00
Ben Ramsey e006f669ad Adding common docblock file header 2015-07-15 13:59:52 -05:00
Ben Ramsey d67c3490a8 Change namespace to "Ramsey"; closes #48 2015-04-25 12:11:37 -05:00
Ben Ramsey 90fd1531d0 Fixing PSR2 standards violations reported by PHP_CodeSniffer 2014-11-08 15:50:04 -05:00
Ben Ramsey cd2d09c356 Introduce Converter namespace and move Number and Time classes into it 2014-11-08 14:43:09 -05:00
Thibaud Fabre cce58a0b8a Fix doc comments and remove unneeded usings 2014-11-08 15:57:30 +01:00
Thibaud Fabre fead6f3223 Refactor in the spirit of #1 & #34 2014-10-30 15:16:59 +01:00
Thibaud Fabre 723ef345bf Refactor factory functions
Remove $littleEndian parameter
Add fromGuidString/Bytes factory methods for GUIDs
No longer possible to output GUIDs as UUIDs and vice-versa
Pass tests
2014-10-30 15:15:16 +01:00
Thibaud Fabre 13b3bf7ed9 Refactor from/toString methods to codecs 2014-10-30 15:15:16 +01:00