diff options
author | Mario <mario@mariovavti.com> | 2021-10-08 12:24:19 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-10-08 12:24:19 +0000 |
commit | e6dac085cb1d601da1fc63bfd59d811612fa6ef4 (patch) | |
tree | f5b704b613c9c8d347857b4e7f8dd0b19cdd7df3 /vendor/ramsey | |
parent | f5f357060bf0ebcb0b8352519375953d993437e7 (diff) | |
download | volse-hubzilla-e6dac085cb1d601da1fc63bfd59d811612fa6ef4.tar.gz volse-hubzilla-e6dac085cb1d601da1fc63bfd59d811612fa6ef4.tar.bz2 volse-hubzilla-e6dac085cb1d601da1fc63bfd59d811612fa6ef4.zip |
update composer libs
Diffstat (limited to 'vendor/ramsey')
74 files changed, 459 insertions, 1424 deletions
diff --git a/vendor/ramsey/collection/LICENSE b/vendor/ramsey/collection/LICENSE index 0efc999bf..ae15f590c 100644 --- a/vendor/ramsey/collection/LICENSE +++ b/vendor/ramsey/collection/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015-2020 Ben Ramsey <ben@benramsey.com> +Copyright (c) 2015-2021 Ben Ramsey <ben@benramsey.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/ramsey/collection/README.md b/vendor/ramsey/collection/README.md index ce7a554d2..9124dd77e 100644 --- a/vendor/ramsey/collection/README.md +++ b/vendor/ramsey/collection/README.md @@ -8,17 +8,15 @@ <a href="https://github.com/ramsey/collection"><img src="http://img.shields.io/badge/source-ramsey/collection-blue.svg?style=flat-square" alt="Source Code"></a> <a href="https://packagist.org/packages/ramsey/collection"><img src="https://img.shields.io/packagist/v/ramsey/collection.svg?style=flat-square&label=release" alt="Download Package"></a> <a href="https://php.net"><img src="https://img.shields.io/packagist/php-v/ramsey/collection.svg?style=flat-square&colorB=%238892BF" alt="PHP Programming Language"></a> + <a href="https://github.com/ramsey/collection/blob/master/LICENSE"><img src="https://img.shields.io/packagist/l/ramsey/collection.svg?style=flat-square&colorB=darkcyan" alt="Read License"></a> <a href="https://github.com/ramsey/collection/actions?query=workflow%3ACI"><img src="https://img.shields.io/github/workflow/status/ramsey/collection/CI?label=CI&logo=github&style=flat-square" alt="Build Status"></a> <a href="https://codecov.io/gh/ramsey/collection"><img src="https://img.shields.io/codecov/c/gh/ramsey/collection?label=codecov&logo=codecov&style=flat-square" alt="Codecov Code Coverage"></a> <a href="https://shepherd.dev/github/ramsey/collection"><img src="https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fshepherd.dev%2Fgithub%2Framsey%2Fcollection%2Fcoverage" alt="Psalm Type Coverage"></a> - <a href="https://github.com/ramsey/collection/blob/master/LICENSE"><img src="https://img.shields.io/packagist/l/ramsey/collection.svg?style=flat-square&colorB=darkcyan" alt="Read License"></a> - <a href="https://packagist.org/packages/ramsey/collection/stats"><img src="https://img.shields.io/packagist/dt/ramsey/collection.svg?style=flat-square&colorB=darkmagenta" alt="Package downloads on Packagist"></a> - <a href="https://phpc.chat/channel/ramsey"><img src="https://img.shields.io/badge/phpc.chat-%23ramsey-darkslateblue?style=flat-square" alt="Chat with the maintainers"></a> </p> ## About -ramsey/collection is a PHP 7.2+ library for representing and manipulating collections. +ramsey/collection is a PHP library for representing and manipulating collections. Much inspiration for this library came from the [Java Collections Framework][java]. @@ -44,7 +42,7 @@ Examples of how to use this framework can be found in the Contributions are welcome! Before contributing to this project, familiarize yourself with [CONTRIBUTING.md](CONTRIBUTING.md). -To develop this project, you will need [PHP](https://www.php.net) 7.2 or greater +To develop this project, you will need [PHP](https://www.php.net) 7.3 or greater and [Composer](https://getcomposer.org). After cloning this repository locally, execute the following commands: diff --git a/vendor/ramsey/collection/composer.json b/vendor/ramsey/collection/composer.json index 0c5d09578..73ec30142 100644 --- a/vendor/ramsey/collection/composer.json +++ b/vendor/ramsey/collection/composer.json @@ -1,7 +1,7 @@ { "name": "ramsey/collection", "type": "library", - "description": "A PHP 7.2+ library for representing and manipulating collections.", + "description": "A PHP library for representing and manipulating collections.", "keywords": [ "array", "collection", @@ -19,7 +19,8 @@ } ], "require": { - "php": "^7.2 || ^8" + "php": "^7.3 || ^8", + "symfony/polyfill-php81": "^1.23" }, "require-dev": { "captainhook/captainhook": "^5.3", @@ -29,6 +30,7 @@ "hamcrest/hamcrest-php": "^2", "jangregor/phpstan-prophecy": "^0.8", "mockery/mockery": "^1.3", + "phpspec/prophecy-phpunit": "^2.0", "phpstan/extension-installer": "^1", "phpstan/phpstan": "^0.12.32", "phpstan/phpstan-mockery": "^0.12.5", @@ -50,7 +52,8 @@ "autoload-dev": { "psr-4": { "Ramsey\\Console\\": "resources/console/", - "Ramsey\\Collection\\Test\\": "tests/" + "Ramsey\\Collection\\Test\\": "tests/", + "Ramsey\\Test\\Generics\\": "tests/generics/" }, "files": [ "vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php" diff --git a/vendor/ramsey/collection/src/AbstractArray.php b/vendor/ramsey/collection/src/AbstractArray.php index 2c6e0dedd..d72dbe697 100644 --- a/vendor/ramsey/collection/src/AbstractArray.php +++ b/vendor/ramsey/collection/src/AbstractArray.php @@ -25,7 +25,7 @@ use function unserialize; * the effort required to implement this interface. * * @template T - * @template-implements ArrayInterface<T> + * @implements ArrayInterface<T> */ abstract class AbstractArray implements ArrayInterface { @@ -54,6 +54,8 @@ abstract class AbstractArray implements ArrayInterface * Returns an iterator for this array. * * @link http://php.net/manual/en/iteratoraggregate.getiterator.php IteratorAggregate::getIterator() + * + * @return Traversable<array-key, T> */ public function getIterator(): Traversable { @@ -81,7 +83,10 @@ abstract class AbstractArray implements ArrayInterface * * @return T|null the value stored at the offset, or null if the offset * does not exist. + * + * @psalm-suppress InvalidAttribute */ + #[\ReturnTypeWillChange] // phpcs:ignore public function offsetGet($offset) { return $this->data[$offset] ?? null; @@ -121,6 +126,8 @@ abstract class AbstractArray implements ArrayInterface /** * Returns a serialized string representation of this array object. * + * @deprecated The Serializable interface will go away in PHP 9. + * * @link http://php.net/manual/en/serializable.serialize.php Serializable::serialize() * * @return string a PHP serialized string. @@ -131,8 +138,23 @@ abstract class AbstractArray implements ArrayInterface } /** + * Returns data suitable for PHP serialization. + * + * @link https://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.serialize + * @link https://www.php.net/serialize + * + * @return array<array-key, T> + */ + public function __serialize(): array + { + return $this->data; + } + + /** * Converts a serialized string representation into an instance object. * + * @deprecated The Serializable interface will go away in PHP 9. + * * @link http://php.net/manual/en/serializable.unserialize.php Serializable::unserialize() * * @param string $serialized A PHP serialized string to unserialize. @@ -148,6 +170,16 @@ abstract class AbstractArray implements ArrayInterface } /** + * Adds unserialized data to the object. + * + * @param array<array-key, T> $data + */ + public function __unserialize(array $data): void + { + $this->data = $data; + } + + /** * Returns the number of items in this array. * * @link http://php.net/manual/en/countable.count.php Countable::count() diff --git a/vendor/ramsey/collection/src/AbstractCollection.php b/vendor/ramsey/collection/src/AbstractCollection.php index 2facf0e89..b1df91923 100644 --- a/vendor/ramsey/collection/src/AbstractCollection.php +++ b/vendor/ramsey/collection/src/AbstractCollection.php @@ -42,8 +42,8 @@ use function usort; * minimize the effort required to implement this interface * * @template T - * @template-extends AbstractArray<T> - * @template-implements CollectionInterface<T> + * @extends AbstractArray<T> + * @implements CollectionInterface<T> */ abstract class AbstractCollection extends AbstractArray implements CollectionInterface { @@ -258,7 +258,6 @@ abstract class AbstractCollection extends AbstractArray implements CollectionInt $temp[] = $collection->toArray(); } - /** @var array<array-key, T> $merge */ $merge = array_merge(...$temp); $collection = clone $this; diff --git a/vendor/ramsey/collection/src/AbstractSet.php b/vendor/ramsey/collection/src/AbstractSet.php index 3bd22965f..1126ccb0a 100644 --- a/vendor/ramsey/collection/src/AbstractSet.php +++ b/vendor/ramsey/collection/src/AbstractSet.php @@ -20,7 +20,7 @@ namespace Ramsey\Collection; * this specific type of collection. * * @template T - * @template-extends AbstractCollection<T> + * @extends AbstractCollection<T> */ abstract class AbstractSet extends AbstractCollection { diff --git a/vendor/ramsey/collection/src/ArrayInterface.php b/vendor/ramsey/collection/src/ArrayInterface.php index 19fbff336..27af6102b 100644 --- a/vendor/ramsey/collection/src/ArrayInterface.php +++ b/vendor/ramsey/collection/src/ArrayInterface.php @@ -23,6 +23,8 @@ use Serializable; * `ArrayInterface` provides traversable array functionality to data types. * * @template T + * @extends ArrayAccess<array-key, T> + * @extends IteratorAggregate<array-key, T> */ interface ArrayInterface extends ArrayAccess, diff --git a/vendor/ramsey/collection/src/Collection.php b/vendor/ramsey/collection/src/Collection.php index 2f8deddaa..1299c12c2 100644 --- a/vendor/ramsey/collection/src/Collection.php +++ b/vendor/ramsey/collection/src/Collection.php @@ -71,7 +71,7 @@ namespace Ramsey\Collection; * ``` * * @template T - * @template-extends AbstractCollection<T> + * @extends AbstractCollection<T> */ class Collection extends AbstractCollection { diff --git a/vendor/ramsey/collection/src/CollectionInterface.php b/vendor/ramsey/collection/src/CollectionInterface.php index dfef6ca86..aa86feb04 100644 --- a/vendor/ramsey/collection/src/CollectionInterface.php +++ b/vendor/ramsey/collection/src/CollectionInterface.php @@ -21,7 +21,7 @@ namespace Ramsey\Collection; * and others unordered. * * @template T - * @template-extends ArrayInterface<T> + * @extends ArrayInterface<T> */ interface CollectionInterface extends ArrayInterface { diff --git a/vendor/ramsey/collection/src/DoubleEndedQueue.php b/vendor/ramsey/collection/src/DoubleEndedQueue.php index 6ebdca5ad..c9c59502d 100644 --- a/vendor/ramsey/collection/src/DoubleEndedQueue.php +++ b/vendor/ramsey/collection/src/DoubleEndedQueue.php @@ -22,8 +22,8 @@ use Ramsey\Collection\Exception\NoSuchElementException; * minimize the effort required to implement this interface. * * @template T - * @template-extends Queue<T> - * @template-implements DoubleEndedQueueInterface<T> + * @extends Queue<T> + * @implements DoubleEndedQueueInterface<T> */ class DoubleEndedQueue extends Queue implements DoubleEndedQueueInterface { diff --git a/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php b/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php index 67aae5e2e..d7df53469 100644 --- a/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php +++ b/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php @@ -160,7 +160,7 @@ use Ramsey\Collection\Exception\NoSuchElementException; * empty. * * @template T - * @template-extends QueueInterface<T> + * @extends QueueInterface<T> */ interface DoubleEndedQueueInterface extends QueueInterface { diff --git a/vendor/ramsey/collection/src/GenericArray.php b/vendor/ramsey/collection/src/GenericArray.php index 9b95df387..2b079aa5e 100644 --- a/vendor/ramsey/collection/src/GenericArray.php +++ b/vendor/ramsey/collection/src/GenericArray.php @@ -17,7 +17,7 @@ namespace Ramsey\Collection; /** * `GenericArray` represents a standard array object. * - * @template-extends AbstractArray<mixed> + * @extends AbstractArray<mixed> */ class GenericArray extends AbstractArray { diff --git a/vendor/ramsey/collection/src/Map/AbstractMap.php b/vendor/ramsey/collection/src/Map/AbstractMap.php index 70f71160c..ae9f2fe61 100644 --- a/vendor/ramsey/collection/src/Map/AbstractMap.php +++ b/vendor/ramsey/collection/src/Map/AbstractMap.php @@ -26,8 +26,8 @@ use function in_array; * effort required to implement this interface. * * @template T - * @template-extends AbstractArray<T> - * @template-implements MapInterface<T> + * @extends AbstractArray<T> + * @implements MapInterface<T> */ abstract class AbstractMap extends AbstractArray implements MapInterface { diff --git a/vendor/ramsey/collection/src/Map/AbstractTypedMap.php b/vendor/ramsey/collection/src/Map/AbstractTypedMap.php index ff9f69177..551d2e6c6 100644 --- a/vendor/ramsey/collection/src/Map/AbstractTypedMap.php +++ b/vendor/ramsey/collection/src/Map/AbstractTypedMap.php @@ -22,11 +22,10 @@ use Ramsey\Collection\Tool\ValueToStringTrait; * This class provides a basic implementation of `TypedMapInterface`, to * minimize the effort required to implement this interface. * - * @phpstan-ignore-next-line - * @template K as array-key + * @template K * @template T - * @template-extends AbstractMap<T> - * @template-implements TypedMapInterface<T> + * @extends AbstractMap<T> + * @implements TypedMapInterface<T> */ abstract class AbstractTypedMap extends AbstractMap implements TypedMapInterface { @@ -64,6 +63,7 @@ abstract class AbstractTypedMap extends AbstractMap implements TypedMapInterface ); } + /** @psalm-suppress MixedArgumentTypeCoercion */ parent::offsetSet($offset, $value); } } diff --git a/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php b/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php index 3274dc9de..79a314d96 100644 --- a/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php +++ b/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php @@ -18,7 +18,7 @@ namespace Ramsey\Collection\Map; * `AssociativeArrayMap` represents a standard associative array object. * * @template T - * @template-extends AbstractMap<T> + * @extends AbstractMap<T> */ class AssociativeArrayMap extends AbstractMap { diff --git a/vendor/ramsey/collection/src/Map/MapInterface.php b/vendor/ramsey/collection/src/Map/MapInterface.php index 04e52a238..6ed0b2967 100644 --- a/vendor/ramsey/collection/src/Map/MapInterface.php +++ b/vendor/ramsey/collection/src/Map/MapInterface.php @@ -22,7 +22,7 @@ use Ramsey\Collection\ArrayInterface; * A map cannot contain duplicate keys; each key can map to at most one value. * * @template T - * @template-extends ArrayInterface<T> + * @extends ArrayInterface<T> */ interface MapInterface extends ArrayInterface { diff --git a/vendor/ramsey/collection/src/Map/NamedParameterMap.php b/vendor/ramsey/collection/src/Map/NamedParameterMap.php index ecc52f73a..9926ddd8c 100644 --- a/vendor/ramsey/collection/src/Map/NamedParameterMap.php +++ b/vendor/ramsey/collection/src/Map/NamedParameterMap.php @@ -26,7 +26,7 @@ use function is_int; * `NamedParameterMap` represents a mapping of values to a set of named keys * that may optionally be typed * - * @template-extends AbstractMap<mixed> + * @extends AbstractMap<mixed> */ class NamedParameterMap extends AbstractMap { diff --git a/vendor/ramsey/collection/src/Map/TypedMap.php b/vendor/ramsey/collection/src/Map/TypedMap.php index 752475fee..2e796377a 100644 --- a/vendor/ramsey/collection/src/Map/TypedMap.php +++ b/vendor/ramsey/collection/src/Map/TypedMap.php @@ -80,10 +80,9 @@ use Ramsey\Collection\Tool\TypeTrait; * } * ``` * - * @phpstan-ignore-next-line - * @template K as array-key + * @template K * @template T - * @template-extends AbstractTypedMap<K, T> + * @extends AbstractTypedMap<K, T> */ class TypedMap extends AbstractTypedMap { @@ -121,6 +120,8 @@ class TypedMap extends AbstractTypedMap { $this->keyType = $keyType; $this->valueType = $valueType; + + /** @psalm-suppress MixedArgumentTypeCoercion */ parent::__construct($data); } diff --git a/vendor/ramsey/collection/src/Map/TypedMapInterface.php b/vendor/ramsey/collection/src/Map/TypedMapInterface.php index 51b6a81a2..0308109cc 100644 --- a/vendor/ramsey/collection/src/Map/TypedMapInterface.php +++ b/vendor/ramsey/collection/src/Map/TypedMapInterface.php @@ -19,7 +19,7 @@ namespace Ramsey\Collection\Map; * typed. * * @template T - * @template-extends MapInterface<T> + * @extends MapInterface<T> */ interface TypedMapInterface extends MapInterface { diff --git a/vendor/ramsey/collection/src/Queue.php b/vendor/ramsey/collection/src/Queue.php index 4af2fdf76..93e032b43 100644 --- a/vendor/ramsey/collection/src/Queue.php +++ b/vendor/ramsey/collection/src/Queue.php @@ -24,8 +24,8 @@ use Ramsey\Collection\Tool\ValueToStringTrait; * the effort required to implement this interface. * * @template T - * @template-extends AbstractArray<T> - * @template-implements QueueInterface<T> + * @extends AbstractArray<T> + * @implements QueueInterface<T> */ class Queue extends AbstractArray implements QueueInterface { diff --git a/vendor/ramsey/collection/src/QueueInterface.php b/vendor/ramsey/collection/src/QueueInterface.php index 7ebbb5d06..8c7383df8 100644 --- a/vendor/ramsey/collection/src/QueueInterface.php +++ b/vendor/ramsey/collection/src/QueueInterface.php @@ -94,7 +94,7 @@ use Ramsey\Collection\Exception\NoSuchElementException; * `poll()` method to indicate that the queue contains no elements. * * @template T - * @template-extends ArrayInterface<T> + * @extends ArrayInterface<T> */ interface QueueInterface extends ArrayInterface { diff --git a/vendor/ramsey/collection/src/Set.php b/vendor/ramsey/collection/src/Set.php index ac1c5cbf0..6932f247a 100644 --- a/vendor/ramsey/collection/src/Set.php +++ b/vendor/ramsey/collection/src/Set.php @@ -36,7 +36,7 @@ namespace Ramsey\Collection; * ``` * * @template T - * @template-extends AbstractSet<T> + * @extends AbstractSet<T> */ class Set extends AbstractSet { diff --git a/vendor/ramsey/uuid/CHANGELOG.md b/vendor/ramsey/uuid/CHANGELOG.md deleted file mode 100644 index e65960558..000000000 --- a/vendor/ramsey/uuid/CHANGELOG.md +++ /dev/null @@ -1,1262 +0,0 @@ -# ramsey/uuid Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - - -## [Unreleased] - -### Added - -### Changed - -### Deprecated - -### Removed - -### Fixed - -### Security - - -## [4.1.1] - 2020-08-18 - -### Fixed - -* Allow use of brick/math version 0.9 - - -## [4.1.0] - 2020-07-28 - -### Changed - -* Improve performance of `Uuid::fromString()`, `Uuid::fromBytes()`, - `UuidInterface#toString()`, and `UuidInterface#getBytes()`. See PR - [#324](https://github.com/ramsey/uuid/pull/324) for more information. - - -## [4.0.1] - 2020-03-29 - -### Fixed - -* Fix collection deserialization errors due to upstream `allowed_classes` being - set to `false`. For details, see [ramsey/uuid#303](https://github.com/ramsey/uuid/issues/303) - and [ramsey/collection#47](https://github.com/ramsey/collection/issues/47). - - -## [4.0.0] - 2020-03-22 - -### Added - -* Add support for version 6 UUIDs, as defined by <http://gh.peabody.io/uuidv6/>, - including the static method `Uuid::uuid6()`, which returns a - `Nonstandard\UuidV6` instance. -* Add ability to generate version 2 (DCE Security) UUIDs, including the static - method `Uuid::uuid2()`, which returns an `Rfc4122\UuidV2` instance. -* Add classes to represent each version of RFC 4122 UUID. When generating new - UUIDs or creating UUIDs from existing strings, bytes, or integers, if the UUID - is an RFC 4122 variant, one of these instances will be returned: - * `Rfc4122\UuidV1` - * `Rfc4122\UuidV2` - * `Rfc4122\UuidV3` - * `Rfc4122\UuidV4` - * `Rfc4122\UuidV5` - * `Rfc4122\NilUuid` -* Add classes to represent version 6 UUIDs, GUIDs, and nonstandard - (non-RFC 4122 variant) UUIDs: - * `Nonstandard\UuidV6` - * `Guid\Guid` - * `Nonstandard\Uuid` -* Add `Uuid::fromDateTime()` to create version 1 UUIDs from instances of - `\DateTimeInterface`. -* The `\DateTimeInterface` instance returned by `UuidInterface::getDateTime()` - (and now `Rfc4122\UuidV1::getDateTime()`) now includes microseconds, as - specified by the version 1 UUID. -* Add `Validator\ValidatorInterface` and `Validator\GenericValidator` to allow - flexibility in validating UUIDs/GUIDs. - * The default validator continues to validate UUID strings using the same - relaxed validation pattern found in the 3.x series of ramsey/uuid. - * Introduce `Rfc4122\Validator` that may be used for strict validation of - RFC 4122 UUID strings. - * Add ability to change the default validator used by `Uuid` through - `FeatureSet::setValidator()`. - * Add `getValidator()` and `setValidator()` to `UuidFactory`. -* Add `Provider\Node\StaticNodeProvider` to assist in setting a custom static - node value with the multicast bit set for version 1 UUIDs. -* Add the following new exceptions: - * `Exception\BuilderNotFoundException` - - Thrown to indicate that no suitable UUID builder could be found. - * `Exception\DateTimeException` - - Thrown to indicate that the PHP DateTime extension encountered an - exception/error. - * `Exception\DceSecurityException` - - Thrown to indicate an exception occurred while dealing with DCE Security - (version 2) UUIDs. - * `Exception\InvalidArgumentException` - - Thrown to indicate that the argument received is not valid. This extends the - built-in PHP `\InvalidArgumentException`, so there should be no BC breaks - with ramsey/uuid throwing this exception, if you are catching the PHP - exception. - * `Exception\InvalidBytesException` - - Thrown to indicate that the bytes being operated on are invalid in some way. - * `Exception\NameException` - - Thrown to indicate that an error occurred while attempting to hash a - namespace and name. - * `Exception\NodeException` - - Throw to indicate that attempting to fetch or create a node ID encountered - an error. - * `Exception\RandomSourceException` - - Thrown to indicate that the source of random data encountered an error. - * `Exception\TimeSourceException` - - Thrown to indicate that the source of time encountered an error. - * `Exception\UnableToBuildUuidException` - - Thrown to indicate a builder is unable to build a UUID. -* Introduce a `Builder\FallbackBuilder`, used by `FeatureSet` to help decide - whether to return a `Uuid` or `Nonstandard\Uuid` when decoding a - UUID string or bytes. -* Add `Rfc4122\UuidInterface` to specifically represent RFC 4122 variant UUIDs. -* Add `Rfc4122\UuidBuilder` to build RFC 4122 variant UUIDs. This replaces the - existing `Builder\DefaultUuidBuilder`, which is now deprecated. -* Introduce `Math\CalculatorInterface` for representing calculators to perform - arithmetic operations on integers. -* Depend on [brick/math](https://github.com/brick/math) for the - `Math\BrickMathCalculator`, which is the default calculator used by this - library when math cannot be performed in native PHP due to integer size - limitations. The calculator is configurable and may be changed, if desired. -* Add `Converter\Number\GenericNumberConverter` and - `Converter\Time\GenericTimeConverter` which will use the calculator provided - to convert numbers and time to values for UUIDs. -* Introduce `Type\Hexadecimal`, `Type\Integer`, `Type\Decimal`, and `Type\Time` - for improved type-safety when dealing with arbitrary string values. -* Add a `Type\TypeInterface` that each of the ramsey/uuid types implements. -* Add `Fields\FieldsInterface` and `Rfc4122\FieldsInterface` to define - field layouts for UUID variants. The implementations `Rfc4122\Fields`, - `Guid\Fields`, and `Nonstandard\Fields` store the 16-byte, - binary string representation of the UUID internally, and these manage - conversion of the binary string into the hexadecimal field values. -* Introduce `Builder\BuilderCollection` and `Provider\Node\NodeProviderCollection`. - These are typed collections for providing builders and node providers to - `Builder\FallbackBuilder` and `Provider\Node\FallbackNodeProvider`, respectively. -* Add `Generator\NameGeneratorInterface` to support alternate methods of - generating bytes for version 3 and version 5 name-based UUID. By default, - ramsey/uuid uses the `Generator\DefaultNameGenerator`, which uses the standard - algorithm this library has used since the beginning. You may choose to use the - new `Generator\PeclUuidNameGenerator` to make use of the new - `uuid_generate_md5()` and `uuid_generate_sha1()` functions in - [ext-uuid version 1.1.0](https://pecl.php.net/package/uuid). - -### Changed - -* Set minimum required PHP version to 7.2. -* This library now works on 32-bit and 64-bit systems, with no degradation in - functionality. -* By default, the following static methods will now return specific instance - types. This should not cause any BC breaks if typehints target `UuidInterface`: - * `Uuid::uuid1` returns `Rfc4122\UuidV1` - * `Uuid::uuid3` returns `Rfc4122\UuidV3` - * `Uuid::uuid4` returns `Rfc4122\UuidV4` - * `Uuid::uuid5` returns `Rfc4122\UuidV5` -* Accept `Type\Hexadecimal` for the `$node` parameter for - `UuidFactoryInterface::uuid1()`. This is in addition to the `int|string` types - already accepted, so there are no BC breaks. `Type\Hexadecimal` is now the - recommended type to pass for `$node`. -* Out of the box, `Uuid::fromString()`, `Uuid::fromBytes()`, and - `Uuid::fromInteger()` will now return either an `Rfc4122\UuidInterface` - instance or an instance of `Nonstandard\Uuid`, depending on whether the input - contains an RFC 4122 variant UUID with a valid version identifier. Both - implement `UuidInterface`, so BC breaks should not occur if typehints use the - interface. -* Change `Uuid::getFields()` to return an instance of `Fields\FieldsInterface`. - Previously, it returned an array of integer values (on 64-bit systems only). -* `Uuid::getDateTime()` now returns an instance of `\DateTimeImmutable` instead - of `\DateTime`. -* Make the following changes to `UuidInterface`: - * `getHex()` now returns a `Type\Hexadecimal` instance. - * `getInteger()` now returns a `Type\Integer` instance. The `Type\Integer` - instance holds a string representation of a 128-bit integer. You may then - use a math library of your choice (bcmath, gmp, etc.) to operate on the - string integer. - * `getDateTime()` now returns `\DateTimeInterface` instead of `\DateTime`. - * Add `__toString()` method. - * Add `getFields()` method. It returns an instance of `Fields\FieldsInterface`. -* Add the following new methods to `UuidFactoryInterface`: - * `uuid2()` - * `uuid6()` - * `fromDateTime()` - * `fromInteger()` - * `getValidator()` -* This library no longer throws generic exceptions. However, this should not - result in BC breaks, since the new exceptions extend from built-in PHP - exceptions that this library previously threw. - * `Exception\UnsupportedOperationException` is now descended from - `\LogicException`. Previously, it descended from `\RuntimeException`. -* Change required constructor parameters for `Uuid`: - * Change the first required constructor parameter for `Uuid` from - `array $fields` to `Rfc4122\FieldsInterface $fields`. - * Add `Converter\TimeConverterInterface $timeConverter` as the fourth - required constructor parameter for `Uuid`. -* Change the second required parameter of `Builder\UuidBuilderInterface::build()` - from `array $fields` to `string $bytes`. Rather than accepting an array of - hexadecimal strings as UUID fields, the `build()` method now expects a byte - string. -* Add `Converter\TimeConverterInterface $timeConverter` as the second required - constructor parameter for `Rfc4122\UuidBuilder`. This also affects the - now-deprecated `Builder\DefaultUuidBuilder`, since this class now inherits - from `Rfc4122\UuidBuilder`. -* Add `convertTime()` method to `Converter\TimeConverterInterface`. -* Add `getTime()` method to `Provider\TimeProviderInterface`. It replaces the - `currentTime()` method. -* `Provider\Node\FallbackNodeProvider` now accepts only a - `Provider\Node\NodeProviderCollection` as its constructor parameter. -* `Provider\Time\FixedTimeProvider` no longer accepts an array but accepts only - `Type\Time` instances. -* `Provider\NodeProviderInterface::getNode()` now returns `Type\Hexadecimal` - instead of `string|false|null`. -* `Converter/TimeConverterInterface::calculateTime()` now returns - `Type\Hexadecimal` instead of `array`. The value is the full UUID timestamp - value (count of 100-nanosecond intervals since the Gregorian calendar epoch) - in hexadecimal format. -* Change methods in `NumberConverterInterface` to accept and return string values - instead of `mixed`; this simplifies the interface and makes it consistent. -* `Generator\DefaultTimeGenerator` no longer adds the variant and version bits - to the bytes it returns. These must be applied to the bytes afterwards. -* When encoding to bytes or decoding from bytes, `OrderedTimeCodec` now checks - whether the UUID is an RFC 4122 variant, version 1 UUID. If not, it will throw - an exception—`InvalidArgumentException` when using - `OrderedTimeCodec::encodeBinary()` and `UnsupportedOperationException` when - using `OrderedTimeCodec::decodeBytes()`. - -### Deprecated - -The following functionality is deprecated and will be removed in ramsey/uuid -5.0.0. - -* The following methods from `UuidInterface` and `Uuid` are deprecated. Use their - counterparts on the `Rfc4122\FieldsInterface` returned by `Uuid::getFields()`. - * `getClockSeqHiAndReservedHex()` - * `getClockSeqLowHex()` - * `getClockSequenceHex()` - * `getFieldsHex()` - * `getNodeHex()` - * `getTimeHiAndVersionHex()` - * `getTimeLowHex()` - * `getTimeMidHex()` - * `getTimestampHex()` - * `getVariant()` - * `getVersion()` -* The following methods from `Uuid` are deprecated. Use the `Rfc4122\FieldsInterface` - instance returned by `Uuid::getFields()` to get the `Type\Hexadecimal` value - for these fields. You may use the new `Math\CalculatorInterface::toIntegerValue()` - method to convert the `Type\Hexadecimal` instances to instances of - `Type\Integer`. This library provides `Math\BrickMathCalculator`, which may be - used for this purpose, or you may use the arbitrary-precision arithemetic - library of your choice. - * `getClockSeqHiAndReserved()` - * `getClockSeqLow()` - * `getClockSequence()` - * `getNode()` - * `getTimeHiAndVersion()` - * `getTimeLow()` - * `getTimeMid()` - * `getTimestamp()` -* `getDateTime()` on `UuidInterface` and `Uuid` is deprecated. Use this method - only on instances of `Rfc4122\UuidV1` or `Nonstandard\UuidV6`. -* `getUrn()` on `UuidInterface` and `Uuid` is deprecated. It is available on - `Rfc4122\UuidInterface` and classes that implement it. -* The following methods are deprecated and have no direct replacements. However, - you may obtain the same information by calling `UuidInterface::getHex()` and - splitting the return value in half. - * `UuidInterface::getLeastSignificantBitsHex()` - * `UuidInterface::getMostSignificantBitsHex()` - * `Uuid::getLeastSignificantBitsHex()` - * `Uuid::getMostSignificantBitsHex()` - * `Uuid::getLeastSignificantBits()` - * `Uuid::getMostSignificantBits()` -* `UuidInterface::getNumberConverter()` and `Uuid::getNumberConverter()` are - deprecated. There is no alternative recommendation, so plan accordingly. -* `Builder\DefaultUuidBuilder` is deprecated; transition to `Rfc4122\UuidBuilder`. -* `Converter\Number\BigNumberConverter` is deprecated; transition to - `Converter\Number\GenericNumberConverter`. -* `Converter\Time\BigNumberTimeConverter` is deprecated; transition to - `Converter\Time\GenericTimeConverter`. -* The classes for representing and generating *degraded* UUIDs are deprecated. - These are no longer necessary; this library now behaves the same on 32-bit and - 64-bit systems. - * `Builder\DegradedUuidBuilder` - * `Converter\Number\DegradedNumberConverter` - * `Converter\Time\DegradedTimeConverter` - * `DegradedUuid` -* The `Uuid::UUID_TYPE_IDENTIFIER` constant is deprecated. Use - `Uuid::UUID_TYPE_DCE_SECURITY` instead. -* The `Uuid::VALID_PATTERN` constant is deprecated. Use - `Validator\GenericValidator::getPattern()` or `Rfc4122\Validator::getPattern()` - instead. - -### Removed - -* Remove the following bytes generators and recommend - `Generator\RandomBytesGenerator` as a suitable replacement: - * `Generator\MtRandGenerator` - * `Generator\OpenSslGenerator` - * `Generator\SodiumRandomGenerator` -* Remove `Exception\UnsatisfiedDependencyException`. This library no longer - throws this exception. -* Remove the method `Provider\TimeProviderInterface::currentTime()`. Use - `Provider\TimeProviderInterface::getTime()` instead. - - -## [4.0.0-beta2] - 2020-03-01 - -## Added - -* Add missing convenience methods for `Rfc4122\UuidV2`. -* Add `Provider\Node\StaticNodeProvider` to assist in setting a custom static - node value with the multicast bit set for version 1 UUIDs. - -## Changed - -* `Provider\NodeProviderInterface::getNode()` now returns `Type\Hexadecimal` - instead of `string|false|null`. - - -## [4.0.0-beta1] - 2020-02-27 - -### Added - -* Add `ValidatorInterface::getPattern()` to return the regular expression - pattern used by the validator. -* Add `v6()` helper function for version 6 UUIDs. - -### Changed - -* Set the pattern constants on validators as `private`. Use the `getPattern()` - method instead. -* Change the `$node` parameter for `UuidFactoryInterface::uuid6()` to accept - `null` or `Type\Hexadecimal`. -* Accept `Type\Hexadecimal` for the `$node` parameter for - `UuidFactoryInterface::uuid1()`. This is in addition to the `int|string` types - already accepted, so there are no BC breaks. `Type\Hexadecimal` is now the - recommended type to pass for `$node`. - -### Removed - -* Remove `currentTime()` method from `Provider\Time\FixedTimeProvider` and - `Provider\Time\SystemTimeProvider`; it had previously been removed from - `Provider\TimeProviderInterface`. - - -## [4.0.0-alpha5] - 2020-02-23 - -### Added - -* Introduce `Builder\BuilderCollection` and `Provider\Node\NodeProviderCollection`. - -### Changed - -* `Builder\FallbackBuilder` now accepts only a `Builder\BuilderCollection` as - its constructor parameter. -* `Provider\Node\FallbackNodeProvider` now accepts only a `Provider\Node\NodeProviderCollection` - as its constructor parameter. -* `Provider\Time\FixedTimeProvider` no longer accepts an array but accepts only - `Type\Time` instances. - - -## [4.0.0-alpha4] - 2020-02-23 - -### Added - -* Add a `Type\TypeInterface` that each of the ramsey/uuid types implements. -* Support version 6 UUIDs; see <http://gh.peabody.io/uuidv6/>. - -### Changed - -* 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. -* Mark `Guid\Guid` and `Nonstandard\Uuid` classes as `final`. -* Add `uuid6()` method to `UuidFactoryInterface`. - -### Deprecated - -* `Uuid::UUID_TYPE_IDENTIFIER` is deprecated. Use `Uuid::UUID_TYPE_DCE_SECURITY` - instead. -* `Uuid::VALID_PATTERN` is deprecated. Use `Validator\GenericValidator::VALID_PATTERN` - instead. - - -## [4.0.0-alpha3] - 2020-02-21 - -### Fixed - -* Fix microsecond rounding error on 32-bit systems. - - -## [4.0.0-alpha2] - 2020-02-21 - -### Added - -* Add `Uuid::fromDateTime()` to create version 1 UUIDs from instances of - `\DateTimeInterface`. -* Add `Generator\NameGeneratorInterface` to support alternate methods of - generating bytes for version 3 and version 5 name-based UUID. By default, - ramsey/uuid uses the `Generator\DefaultNameGenerator`, which uses the standard - algorithm this library has used since the beginning. You may choose to use the - new `Generator\PeclUuidNameGenerator` to make use of the new - `uuid_generate_md5()` and `uuid_generate_sha1()` functions in ext-uuid version - 1.1.0. - -### Changed - -* Add `fromDateTime()` method to `UuidFactoryInterface`. -* Change `UuidInterface::getHex()` to return a `Ramsey\Uuid\Type\Hexadecimal` instance. -* Change `UuidInterface::getInteger()` to return a `Ramsey\Uuid\Type\IntegerValue` instance. - -### Fixed - -* Round microseconds to six digits when getting DateTime from v1 UUIDs. This - circumvents a needless exception for an otherwise valid time-based UUID. - - -## [4.0.0-alpha1] - 2020-01-22 - -### Added - -* Add `Validator\ValidatorInterface` and `Validator\GenericValidator` to allow - flexibility in validating UUIDs/GUIDs. - * Add ability to change the default validator used by `Uuid` through - `FeatureSet::setValidator()`. - * Add `getValidator()` and `setValidator()` to `UuidFactory`. -* Add an internal `InvalidArgumentException` that descends from the built-in - PHP `\InvalidArgumentException`. All places that used to throw - `\InvalidArgumentException` now throw `Ramsey\Uuid\Exception\InvalidArgumentException`. - This should not cause any BC breaks, however. -* Add an internal `DateTimeException` that descends from the built-in PHP - `\RuntimeException`. `Uuid::getDateTime()` may throw this exception if - `\DateTimeImmutable` throws an error or exception. -* Add `RandomSourceException` that descends from the built-in PHP - `\RuntimeException`. `DefaultTimeGenerator`, `RandomBytesGenerator`, and - `RandomNodeProvider` may throw this exception if `random_bytes()` or - `random_int()` throw an error or exception. -* Add `Fields\FieldsInterface` and `Rfc4122\FieldsInterface` to define - field layouts for UUID variants. The implementations `Rfc4122\Fields`, - `Guid\Fields`, and `Nonstandard\Fields` store the 16-byte, - binary string representation of the UUID internally, and these manage - conversion of the binary string into the hexadecimal field values. -* Add `Rfc4122\UuidInterface` to specifically represent RFC 4122 variant UUIDs. -* Add classes to represent each version of RFC 4122 UUID. When generating new - UUIDs or creating UUIDs from existing strings, bytes, or integers, if the UUID - is an RFC 4122 variant, one of these instances will be returned: - * `Rfc4122\UuidV1` - * `Rfc4122\UuidV2` - * `Rfc4122\UuidV3` - * `Rfc4122\UuidV4` - * `Rfc4122\UuidV5` - * `Rfc4122\NilUuid` -* Add `Rfc4122\UuidBuilder` to build RFC 4122 variant UUIDs. This replaces the - existing `Builder\DefaultUuidBuilder`, which is now deprecated. -* Add ability to generate version 2 (DCE Security) UUIDs, including the static - method `Uuid::uuid2()`, which returns an `Rfc4122\UuidV2` instance. -* Add classes to represent GUIDs and nonstandard (non-RFC 4122 variant) UUIDs: - * `Guid\Guid` - * `Nonstandard\Uuid`. -* Introduce a `Builder\FallbackBuilder`, used by `FeatureSet` to help decide - whether to return a `Uuid` or `Nonstandard\Uuid` when decoding a - UUID string or bytes. -* Introduce `Type\Hexadecimal`, `Type\IntegerValue`, and `Type\Time` for - improved type-safety when dealing with arbitrary string values. -* Introduce `Math\CalculatorInterface` for representing calculators to perform - arithmetic operations on integers. -* Depend on [brick/math](https://github.com/brick/math) for the - `Math\BrickMathCalculator`, which is the default calculator used by this - library when math cannot be performed in native PHP due to integer size - limitations. The calculator is configurable and may be changed, if desired. -* Add `Converter\Number\GenericNumberConverter` and - `Converter\Time\GenericTimeConverter` which will use the calculator provided - to convert numbers and time to values for UUIDs. -* The `\DateTimeInterface` instance returned by `UuidInterface::getDateTime()` - (and now `Rfc4122\UuidV1::getDateTime()`) now includes microseconds, as - specified by the version 1 UUID. - -### Changed - -* Set minimum required PHP version to 7.2. -* Add `__toString()` method to `UuidInterface`. -* The `UuidInterface::getDateTime()` method now specifies `\DateTimeInterface` - as the return value, rather than `\DateTime`; `Uuid::getDateTime()` now - returns an instance of `\DateTimeImmutable` instead of `\DateTime`. -* Add `getFields()` method to `UuidInterface`. -* Add `getValidator()` method to `UuidFactoryInterface`. -* Add `uuid2()` method to `UuidFactoryInterface`. -* Add `convertTime()` method to `Converter\TimeConverterInterface`. -* Add `getTime()` method to `Provider\TimeProviderInterface`. -* Change `Uuid::getFields()` to return an instance of `Fields\FieldsInterface`. - Previously, it returned an array of integer values (on 64-bit systems only). -* Change the first required constructor parameter for `Uuid` from - `array $fields` to `Rfc4122\FieldsInterface $fields`. -* Introduce `Converter\TimeConverterInterface $timeConverter` as fourth required - constructor parameter for `Uuid` and second required constructor parameter for - `Builder\DefaultUuidBuilder`. -* Change `UuidInterface::getInteger()` to always return a `string` value instead - of `mixed`. This is a string representation of a 128-bit integer. You may then - use a math library of your choice (bcmath, gmp, etc.) to operate on the - string integer. -* Change the second required parameter of `Builder\UuidBuilderInterface::build()` - from `array $fields` to `string $bytes`. Rather than accepting an array of - hexadecimal strings as UUID fields, the `build()` method now expects a byte - string. -* `Generator\DefaultTimeGenerator` no longer adds the variant and version bits - to the bytes it returns. These must be applied to the bytes afterwards. -* `Converter/TimeConverterInterface::calculateTime()` now returns - `Type\Hexadecimal` instead of `array`. The value is the full UUID timestamp - value (count of 100-nanosecond intervals since the Gregorian calendar epoch) - in hexadecimal format. -* Change methods in converter interfaces to accept and return string values - instead of `mixed`; this simplifies the interface and makes it consistent: - * `NumberConverterInterface::fromHex(string $hex): string` - * `NumberConverterInterface::toHex(string $number): string` - * `TimeConverterInterface::calculateTime(string $seconds, string $microseconds): array` -* `UnsupportedOperationException` is now descended from `\LogicException`. - Previously, it descended from `\RuntimeException`. -* When encoding to bytes or decoding from bytes, `OrderedTimeCodec` now checks - whether the UUID is an RFC 4122 variant, version 1 UUID. If not, it will throw - an exception—`InvalidArgumentException` when using - `OrderedTimeCodec::encodeBinary()` and `UnsupportedOperationException` when - using `OrderedTimeCodec::decodeBytes()`. -* Out of the box, `Uuid::fromString()`, `Uuid::fromBytes()`, and - `Uuid::fromInteger()` will now return either an `Rfc4122\UuidInterface` - instance or an instance of `Nonstandard\Uuid`, depending on whether the input - contains an RFC 4122 variant UUID with a valid version identifier. Both - implement `UuidInterface`, so BC breaks should not occur if typehints use the - interface. -* By default, the following static methods will now return the specific instance - types. This should not cause any BC breaks if typehints target `UuidInterface`: - * `Uuid::uuid1` returns `Rfc4122\UuidV1` - * `Uuid::uuid3` returns `Rfc4122\UuidV3` - * `Uuid::uuid4` returns `Rfc4122\UuidV4` - * `Uuid::uuid5` returns `Rfc4122\UuidV5` - -### Deprecated - -The following functionality is deprecated and will be removed in ramsey/uuid -5.0.0. - -* The following methods from `UuidInterface` and `Uuid` are deprecated. Use their - counterparts on the `Rfc4122\FieldsInterface` returned by `Uuid::getFields()`. - * `getClockSeqHiAndReservedHex()` - * `getClockSeqLowHex()` - * `getClockSequenceHex()` - * `getFieldsHex()` - * `getNodeHex()` - * `getTimeHiAndVersionHex()` - * `getTimeLowHex()` - * `getTimeMidHex()` - * `getTimestampHex()` - * `getVariant()` - * `getVersion()` -* The following methods from `Uuid` are deprecated. Use the `Rfc4122\FieldsInterface` - instance returned by `Uuid::getFields()` to get the `Type\Hexadecimal` value - for these fields, and then use the arbitrary-precision arithmetic library of - your choice to convert them to string integers. - * `getClockSeqHiAndReserved()` - * `getClockSeqLow()` - * `getClockSequence()` - * `getNode()` - * `getTimeHiAndVersion()` - * `getTimeLow()` - * `getTimeMid()` - * `getTimestamp()` -* `getDateTime()` on `UuidInterface` and `Uuid` is deprecated. Use this method - only on instances of `Rfc4122\UuidV1`. -* `getUrn()` on `UuidInterface` and `Uuid` is deprecated. It is available on - `Rfc4122\UuidInterface` and classes that implement it. -* The following methods are deprecated and have no direct replacements. However, - you may obtain the same information by calling `UuidInterface::getHex()` and - splitting the return value in half. - * `UuidInterface::getLeastSignificantBitsHex()` - * `UuidInterface::getMostSignificantBitsHex()` - * `Uuid::getLeastSignificantBitsHex()` - * `Uuid::getMostSignificantBitsHex()` - * `Uuid::getLeastSignificantBits()` - * `Uuid::getMostSignificantBits()` -* `UuidInterface::getNumberConverter()` and `Uuid::getNumberConverter()` are - deprecated. There is no alternative recommendation, so plan accordingly. -* `Builder\DefaultUuidBuilder` is deprecated; transition to - `Rfc4122\UuidBuilder`. -* `Converter\Number\BigNumberConverter` is deprecated; transition to - `Converter\Number\GenericNumberConverter`. -* `Converter\Time\BigNumberTimeConverter` is deprecated; transition to - `Converter\Time\GenericTimeConverter`. -* `Provider\TimeProviderInterface::currentTime()` is deprecated; transition to - the `getTimestamp()` method on the same interface. -* The classes for representing and generating *degraded* UUIDs are deprecated. - These are no longer necessary; this library now behaves the same on 32-bit and - 64-bit PHP. - * `Builder\DegradedUuidBuilder` - * `Converter\Number\DegradedNumberConverter` - * `Converter\Time\DegradedTimeConverter` - * `DegradedUuid` - -### Removed - -* Remove the following bytes generators and recommend - `Generator\RandomBytesGenerator` as a suitable replacement: - * `Generator\MtRandGenerator` - * `Generator\OpenSslGenerator` - * `Generator\SodiumRandomGenerator` -* Remove `Exception\UnsatisfiedDependencyException`. This library no longer - throws this exception. - - -## [3.9.3] - 2020-02-20 - -### Fixed - -* For v1 UUIDs, round down for timestamps so that microseconds do not bump the - timestamp to the next second. - - As an example, consider the case of timestamp `1` with `600000` microseconds - (`1.600000`). This is the first second after midnight on January 1, 1970, UTC. - Previous versions of this library had a bug that would round this to `2`, so - the rendered time was `1970-01-01 00:00:02`. This was incorrect. Despite - having `600000` microseconds, the time should not round up to the next second. - Rather, the time should be `1970-01-01 00:00:01.600000`. Since this version of - ramsey/uuid does not support microseconds, the microseconds are dropped, and - the time is `1970-01-01 00:00:01`. No rounding should occur. - - -## [3.9.2] - 2019-12-17 - -### Fixed - -* Check whether files returned by `/sys/class/net/*/address` are readable - before attempting to read them. This avoids a PHP warning that was being - emitted on hosts that do not grant permission to read these files. - - -## [3.9.1] - 2019-12-01 - -### Fixed - -* Fix `RandomNodeProvider` behavior on 32-bit systems. The `RandomNodeProvider` - was converting a 6-byte string to a decimal number, which is a 48-bit, - unsigned integer. This caused problems on 32-bit systems and has now been - resolved. - - -## [3.9.0] - 2019-11-30 - -### Added - -* Add function API as convenience. The functions are available in the - `Ramsey\Uuid` namespace. - * `v1(int|string|null $node = null, int|null $clockSeq = null): string` - * `v3(string|UuidInterface $ns, string $name): string` - * `v4(): string` - * `v5(string|UuidInterface $ns, string $name): string` - -### Changed - -* Use paragonie/random-lib instead of ircmaxell/random-lib. This is a - non-breaking change. -* Use a high-strength generator by default, when using `RandomLibAdapter`. This - is a non-breaking change. - -### Deprecated - -These will be removed in ramsey/uuid version 4.0.0: - -* `MtRandGenerator`, `OpenSslGenerator`, and `SodiumRandomGenerator` are - deprecated in favor of using the default `RandomBytesGenerator`. - -### Fixed - -* Set `ext-json` as a required dependency in `composer.json`. -* Use `PHP_OS` instead of `php_uname()` when determining the system OS, for - cases when `php_uname()` is disabled for security reasons. - - -## [3.8.0] - 2018-07-19 - -### Added - -* Support discovery of MAC addresses on FreeBSD systems -* Use a polyfill to provide PHP ctype functions when running on systems where the - ctype functions are not part of the PHP build -* Disallow a trailing newline character when validating UUIDs -* Annotate thrown exceptions for improved IDE hinting - - -## [3.7.3] - 2018-01-19 - -### Fixed - -* Gracefully handle cases where `glob()` returns false when searching - `/sys/class/net/*/address` files on Linux -* Fix off-by-one error in `DefaultTimeGenerator` - -### Security - -* Switch to `random_int()` from `mt_rand()` for better random numbers - - -## [3.7.2] - 2018-01-13 - -### Fixed - -* Check sysfs on Linux to determine the node identifier; this provides a - reliable way to identify the node on Docker images, etc. - - -## [3.7.1] - 2017-09-22 - -### Fixed - -* Set the multicast bit for random nodes, according to RFC 4122, §4.5 - -### Security - -* Use `random_bytes()` when generating random nodes - - -## [3.7.0] - 2017-08-04 - -### Added - -* Add the following UUID version constants: - * `Uuid::UUID_TYPE_TIME` - * `Uuid::UUID_TYPE_IDENTIFIER` - * `Uuid::UUID_TYPE_HASH_MD5` - * `Uuid::UUID_TYPE_RANDOM` - * `Uuid::UUID_TYPE_HASH_SHA1` - - -## [3.6.1] - 2017-03-26 - -### Fixed - -* Optimize UUID string decoding by using `str_pad()` instead of `sprintf()` - - -## [3.6.0] - 2017-03-18 - -### Added - -* Add `InvalidUuidStringException`, which is thrown when attempting to decode an - invalid string UUID; this does not introduce any BC issues, since the new - exception inherits from the previously used `InvalidArgumentException` - -### Fixed - -* Improve memory usage when generating large quantities of UUIDs (use `str_pad()` - and `dechex()` instead of `sprintf()`) - - -## [3.5.2] - 2016-11-22 - -### Fixed - -* Improve test coverage - - -## [3.5.1] - 2016-10-02 - -### Fixed - -* Fix issue where the same UUIDs were not being treated as equal when using - mixed cases - - -## [3.5.0] - 2016-08-02 - -### Added - -* Add `OrderedTimeCodec` to store UUID in an optimized way for InnoDB - -### Fixed - -* Fix invalid node generation in `RandomNodeProvider` -* Avoid multiple unnecessary system calls by caching failed attempt to retrieve - system node - - -## [3.4.1] - 2016-04-23 - -### Fixed - -* Fix test that violated a PHP CodeSniffer rule, breaking the build - - -## [3.4.0] - 2016-04-23 - -### Added - -* Add `TimestampFirstCombCodec` and `TimestampLastCombCodec` codecs to provide - the ability to generate [COMB sequential UUIDs] with the timestamp encoded as - either the first 48 bits or the last 48 bits -* Improve logic of `CombGenerator` for COMB sequential UUIDs - - -## [3.3.0] - 2016-03-22 - -### Security - -* Drop the use of OpenSSL as a fallback and use [paragonie/random_compat] to - support `RandomBytesGenerator` in versions of PHP earlier than 7.0; - this addresses and fixes the [collision issue] - - -## [3.2.0] - 2016-02-17 - -### Added - -* Add `SodiumRandomGenerator` to allow use of the [PECL libsodium extension] as - a random bytes generator when creating UUIDs - - -## [3.1.0] - 2015-12-17 - -### Added - -* Implement the PHP `Serializable` interface to provide the ability to - serialize/unserialize UUID objects - - -## [3.0.1] - 2015-10-21 - -### Added - -* Adopt the [Contributor Code of Conduct] for this project - - -## [3.0.0] - 2015-09-28 - -The 3.0.0 release represents a significant step for the ramsey/uuid library. -While the simple and familiar API used in previous versions remains intact, this -release provides greater flexibility to integrators, including the ability to -inject your own number generators, UUID codecs, node and time providers, and -more. - -*Please note: The changelog for 3.0.0 includes all notes from the alpha and beta -versions leading up to this release.* - -### Added - -* Add a number of generators that may be used to override the library defaults - for generating random bytes (version 4) or time-based (version 1) UUIDs - * `CombGenerator` to allow generation of sequential UUIDs - * `OpenSslGenerator` to generate random bytes on systems where - `openssql_random_pseudo_bytes()` is present - * `MtRandGenerator` to provide a fallback in the event other random generators - are not present - * `RandomLibAdapter` to allow use of [ircmaxell/random-lib] - * `RandomBytesGenerator` for use with PHP 7; ramsey/uuid will default to use - this generator when running on PHP 7 - * Refactor time-based (version 1) UUIDs into a `TimeGeneratorInterface` to - allow for other sources to generate version 1 UUIDs in this library - * `PeclUuidTimeGenerator` and `PeclUuidRandomGenerator` for creating version - 1 or version 4 UUIDs using the pecl-uuid extension -* Add a `setTimeGenerator` method on `UuidFactory` to override the default time - generator -* Add option to enable `PeclUuidTimeGenerator` via `FeatureSet` -* Support GUID generation by configuring a `FeatureSet` to use GUIDs -* Allow UUIDs to be serialized as JSON through `JsonSerializable` - -### Changed - -* Change root namespace from "Rhumsaa" to "Ramsey;" in most cases, simply - making this change in your applications is the only upgrade path you will - need—everything else should work as expected -* No longer consider `Uuid` class as `final`; everything is now based around - interfaces and factories, allowing you to use this package as a base to - implement other kinds of UUIDs with different dependencies -* Return an object of type `DegradedUuid` on 32-bit systems to indicate that - certain features are not available -* Default `RandomLibAdapter` to a medium-strength generator with - [ircmaxell/random-lib]; this is configurable, so other generator strengths may - be used - -### Removed - -* Remove `PeclUuidFactory` in favor of using pecl-uuid with generators -* Remove `timeConverter` and `timeProvider` properties, setters, and getters in - both `FeatureSet` and `UuidFactory` as those are now exclusively used by the - default `TimeGenerator` -* Move UUID [Doctrine field type] to [ramsey/uuid-doctrine] -* Move `uuid` console application to [ramsey/uuid-console] -* Remove `Uuid::VERSION` package version constant - -### Fixed - -* Improve GUID support to ensure that: - * On little endian (LE) architectures, the byte order of the first three - fields is LE - * On big endian (BE) architectures, it is the same as a GUID - * String representation is always the same -* Fix exception message for `DegradedNumberConverter::fromHex()` - - -## [3.0.0-beta1] - 2015-08-31 - -### Fixed - -* Improve GUID support to ensure that: - * On little endian (LE) architectures, the byte order of the first three - fields is LE - * On big endian (BE) architectures, it is the same as a GUID - * String representation is always the same -* Fix exception message for `DegradedNumberConverter::fromHex()` - - -## [3.0.0-alpha3] - 2015-07-28 - -### Added - -* Enable use of custom `TimeGenerator` implementations -* Add a `setTimeGenerator` method on `UuidFactory` to override the default time - generator -* Add option to enable `PeclUuidTimeGenerator` via `FeatureSet` - -### Removed - -* Remove `timeConverter` and `timeProvider` properties, setters, and getters in - both `FeatureSet` and `UuidFactory` as those are now exclusively used by the - default `TimeGenerator` - - -## [3.0.0-alpha2] - 2015-07-28 - -### Added - -* Refactor time-based (version 1) UUIDs into a `TimeGeneratorInterface` to allow - for other sources to generate version 1 UUIDs in this library -* Add `PeclUuidTimeGenerator` and `PeclUuidRandomGenerator` for creating version - 1 or version 4 UUIDs using the pecl-uuid extension -* Add `RandomBytesGenerator` for use with PHP 7. ramsey/uuid will default to use - this generator when running on PHP 7 - -### Changed - -* Default `RandomLibAdapter` to a medium-strength generator with - [ircmaxell/random-lib]; this is configurable, so other generator strengths may - be used - -### Removed - -* Remove `PeclUuidFactory` in favor of using pecl-uuid with generators - - -## [3.0.0-alpha1] - 2015-07-16 - -### Added - -* Allow dependency injection through `UuidFactory` and/or extending `FeatureSet` - to override any package defaults -* Add a number of generators that may be used to override the library defaults: - * `CombGenerator` to allow generation of sequential UUIDs - * `OpenSslGenerator` to generate random bytes on systems where - `openssql_random_pseudo_bytes()` is present - * `MtRandGenerator` to provide a fallback in the event other random generators - are not present - * `RandomLibAdapter` to allow use of [ircmaxell/random-lib] -* Support GUID generation by configuring a `FeatureSet` to use GUIDs -* Allow UUIDs to be serialized as JSON through `JsonSerializable` - -### Changed - -* Change root namespace from "Rhumsaa" to "Ramsey;" in most cases, simply - making this change in your applications is the only upgrade path you will - need—everything else should work as expected -* No longer consider `Uuid` class as `final`; everything is now based around - interfaces and factories, allowing you to use this package as a base to - implement other kinds of UUIDs with different dependencies -* Return an object of type `DegradedUuid` on 32-bit systems to indicate that - certain features are not available - -### Removed - -* Move UUID [Doctrine field type] to [ramsey/uuid-doctrine] -* Move `uuid` console application to [ramsey/uuid-console] -* Remove `Uuid::VERSION` package version constant - - -## [2.9.0] - 2016-03-22 - -### Security - -* Drop the use of OpenSSL as a fallback and use [paragonie/random_compat] to - support `RandomBytesGenerator` in versions of PHP earlier than 7.0; - this addresses and fixes the [collision issue] - - -## [2.8.4] - 2015-12-17 - -### Added - -* Add support for symfony/console v3 in the `uuid` CLI application - - -## [2.8.3] - 2015-08-31 - -### Fixed - -* Fix exception message in `Uuid::calculateUuidTime()` - - -## [2.8.2] - 2015-07-23 - -### Fixed - -* Ensure the release tag makes it into the rhumsaa/uuid package - - -## [2.8.1] - 2015-06-16 - -### Fixed - -* Use `passthru()` and output buffering in `getIfconfig()` -* Cache the system node in a static variable so that we process it only once per - runtime - - -## [2.8.0] - 2014-11-09 - -### Added - -* Add static `fromInteger()` method to create UUIDs from string integer or - `Moontoast\Math\BigNumber` - -### Fixed - -* Improve Doctrine conversion to Uuid or string for the ramsey/uuid [Doctrine field type] - - -## [2.7.4] - 2014-10-29 - -### Fixed - -* Change loop in `generateBytes()` from `foreach` to `for` - - -## [2.7.3] - 2014-08-27 - -### Fixed - -* Fix upper range for `mt_rand` used in version 4 UUIDs - - -## [2.7.2] - 2014-07-28 - -### Changed - -* Upgrade to PSR-4 autoloading - - -## [2.7.1] - 2014-02-19 - -### Fixed - -* Move moontoast/math and symfony/console to require-dev -* Support symfony/console 2.3 (LTS version) - - -## [2.7.0] - 2014-01-31 - -### Added - -* Add `Uuid::VALID_PATTERN` constant containing a UUID validation regex pattern - - -## [2.6.1] - 2014-01-27 - -### Fixed - -* Fix bug where `uuid` console application could not find the Composer - autoloader when installed in another project - - -## [2.6.0] - 2014-01-17 - -### Added - -* Introduce `uuid` console application for generating and decoding UUIDs from - CLI (run `./bin/uuid` for details) -* Add `Uuid::getInteger()` to retrieve a `Moontoast\Math\BigNumber` - representation of the 128-bit integer representing the UUID -* Add `Uuid::getHex()` to retrieve the hexadecimal representation of the UUID -* Use `netstat` on Linux to capture the node for a version 1 UUID -* Require moontoast/math as part of the regular package requirements - - -## [2.5.0] - 2013-10-30 - -### Added - -* Use `openssl_random_pseudo_bytes()`, if available, to generate random bytes - - -## [2.4.0] - 2013-07-29 - -### Added - -* Return `null` from `Uuid::getVersion()` if the UUID isn't an RFC 4122 variant -* Support string UUIDs without dashes passed to `Uuid::fromString()` - - -## [2.3.0] - 2013-07-16 - -### Added - -* Support creation of UUIDs from bytes with `Uuid::fromBytes()` - - -## [2.2.0] - 2013-07-04 - -### Added - -* Add `Doctrine\UuidType::requiresSQLCommentHint()` method - - -## [2.1.2] - 2013-07-03 - -### Fixed - -* Fix cases where the system node was coming back with uppercase hexadecimal - digits; this ensures that case in the node is converted to lowercase - - -## [2.1.1] - 2013-04-29 - -### Fixed - -* Fix bug in `Uuid::isValid()` where the NIL UUID was not reported as valid - - -## [2.1.0] - 2013-04-15 - -### Added - -* Allow checking the validity of a UUID through the `Uuid::isValid()` method - - -## [2.0.0] - 2013-02-11 - -### Added - -* Support UUID generation on 32-bit platforms - -### Changed - -* Mark `Uuid` class `final` -* Require moontoast/math on 64-bit platforms for - `Uuid::getLeastSignificantBits()` and `Uuid::getMostSignificantBits()`; the - integers returned by these methods are *unsigned* 64-bit integers and - unsupported even on 64-bit builds of PHP -* Move `UnsupportedOperationException` to the `Exception` subnamespace - - -## [1.1.2] - 2012-11-29 - -### Fixed - -* Relax [Doctrine field type] conversion rules for UUIDs - - -## [1.1.1] - 2012-08-27 - -### Fixed - -* Remove `final` keyword from `Uuid` class - - -## [1.1.0] - 2012-08-06 - -### Added - -* Support ramsey/uuid UUIDs as a Doctrine Database Abstraction Layer (DBAL) - field mapping type - - -## [1.0.0] - 2012-07-19 - -### Added - -* Support generation of version 1, 3, 4, and 5 UUIDs - - -[comb sequential uuids]: http://www.informit.com/articles/article.aspx?p=25862&seqNum=7 -[paragonie/random_compat]: https://github.com/paragonie/random_compat -[collision issue]: https://github.com/ramsey/uuid/issues/80 -[contributor code of conduct]: https://github.com/ramsey/uuid/blob/master/.github/CODE_OF_CONDUCT.md -[pecl libsodium extension]: http://pecl.php.net/package/libsodium -[ircmaxell/random-lib]: https://github.com/ircmaxell/RandomLib -[doctrine field type]: http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html -[ramsey/uuid-doctrine]: https://github.com/ramsey/uuid-doctrine -[ramsey/uuid-console]: https://github.com/ramsey/uuid-console - -[unreleased]: https://github.com/ramsey/uuid/compare/4.1.1...HEAD -[4.1.1]: https://github.com/ramsey/uuid/compare/4.1.0...4.1.1 -[4.1.0]: https://github.com/ramsey/uuid/compare/4.0.1...4.1.0 -[4.0.1]: https://github.com/ramsey/uuid/compare/4.0.0...4.0.1 -[4.0.0]: https://github.com/ramsey/uuid/compare/4.0.0-beta2...4.0.0 -[4.0.0-beta2]: https://github.com/ramsey/uuid/compare/4.0.0-beta1...4.0.0-beta2 -[4.0.0-beta1]: https://github.com/ramsey/uuid/compare/4.0.0-alpha5...4.0.0-beta1 -[4.0.0-alpha5]: https://github.com/ramsey/uuid/compare/4.0.0-alpha4...4.0.0-alpha5 -[4.0.0-alpha4]: https://github.com/ramsey/uuid/compare/4.0.0-alpha3...4.0.0-alpha4 -[4.0.0-alpha3]: https://github.com/ramsey/uuid/compare/4.0.0-alpha2...4.0.0-alpha3 -[4.0.0-alpha2]: https://github.com/ramsey/uuid/compare/4.0.0-alpha1...4.0.0-alpha2 -[4.0.0-alpha1]: https://github.com/ramsey/uuid/compare/3.9.3...4.0.0-alpha1 -[3.9.3]: https://github.com/ramsey/uuid/compare/3.9.2...3.9.3 -[3.9.2]: https://github.com/ramsey/uuid/compare/3.9.1...3.9.2 -[3.9.1]: https://github.com/ramsey/uuid/compare/3.9.0...3.9.1 -[3.9.0]: https://github.com/ramsey/uuid/compare/3.8.0...3.9.0 -[3.8.0]: https://github.com/ramsey/uuid/compare/3.7.3...3.8.0 -[3.7.3]: https://github.com/ramsey/uuid/compare/3.7.2...3.7.3 -[3.7.2]: https://github.com/ramsey/uuid/compare/3.7.1...3.7.2 -[3.7.1]: https://github.com/ramsey/uuid/compare/3.7.0...3.7.1 -[3.7.0]: https://github.com/ramsey/uuid/compare/3.6.1...3.7.0 -[3.6.1]: https://github.com/ramsey/uuid/compare/3.6.0...3.6.1 -[3.6.0]: https://github.com/ramsey/uuid/compare/3.5.2...3.6.0 -[3.5.2]: https://github.com/ramsey/uuid/compare/3.5.1...3.5.2 -[3.5.1]: https://github.com/ramsey/uuid/compare/3.5.0...3.5.1 -[3.5.0]: https://github.com/ramsey/uuid/compare/3.4.1...3.5.0 -[3.4.1]: https://github.com/ramsey/uuid/compare/3.4.0...3.4.1 -[3.4.0]: https://github.com/ramsey/uuid/compare/3.3.0...3.4.0 -[3.3.0]: https://github.com/ramsey/uuid/compare/3.2.0...3.3.0 -[3.2.0]: https://github.com/ramsey/uuid/compare/3.1.0...3.2.0 -[3.1.0]: https://github.com/ramsey/uuid/compare/3.0.1...3.1.0 -[3.0.1]: https://github.com/ramsey/uuid/compare/3.0.0...3.0.1 -[3.0.0]: https://github.com/ramsey/uuid/compare/3.0.0-beta1...3.0.0 -[3.0.0-beta1]: https://github.com/ramsey/uuid/compare/3.0.0-alpha3...3.0.0-beta1 -[3.0.0-alpha3]: https://github.com/ramsey/uuid/compare/3.0.0-alpha2...3.0.0-alpha3 -[3.0.0-alpha2]: https://github.com/ramsey/uuid/compare/3.0.0-alpha1...3.0.0-alpha2 -[3.0.0-alpha1]: https://github.com/ramsey/uuid/compare/2.9.0...3.0.0-alpha1 -[2.9.0]: https://github.com/ramsey/uuid/compare/2.8.4...2.9.0 -[2.8.4]: https://github.com/ramsey/uuid/compare/2.8.3...2.8.4 -[2.8.3]: https://github.com/ramsey/uuid/compare/2.8.2...2.8.3 -[2.8.2]: https://github.com/ramsey/uuid/compare/2.8.1...2.8.2 -[2.8.1]: https://github.com/ramsey/uuid/compare/2.8.0...2.8.1 -[2.8.0]: https://github.com/ramsey/uuid/compare/2.7.4...2.8.0 -[2.7.4]: https://github.com/ramsey/uuid/compare/2.7.3...2.7.4 -[2.7.3]: https://github.com/ramsey/uuid/compare/2.7.2...2.7.3 -[2.7.2]: https://github.com/ramsey/uuid/compare/2.7.1...2.7.2 -[2.7.1]: https://github.com/ramsey/uuid/compare/2.7.0...2.7.1 -[2.7.0]: https://github.com/ramsey/uuid/compare/2.6.1...2.7.0 -[2.6.1]: https://github.com/ramsey/uuid/compare/2.6.0...2.6.1 -[2.6.0]: https://github.com/ramsey/uuid/compare/2.5.0...2.6.0 -[2.5.0]: https://github.com/ramsey/uuid/compare/2.4.0...2.5.0 -[2.4.0]: https://github.com/ramsey/uuid/compare/2.3.0...2.4.0 -[2.3.0]: https://github.com/ramsey/uuid/compare/2.2.0...2.3.0 -[2.2.0]: https://github.com/ramsey/uuid/compare/2.1.2...2.2.0 -[2.1.2]: https://github.com/ramsey/uuid/compare/2.1.1...2.1.2 -[2.1.1]: https://github.com/ramsey/uuid/compare/2.1.0...2.1.1 -[2.1.0]: https://github.com/ramsey/uuid/compare/2.0.0...2.1.0 -[2.0.0]: https://github.com/ramsey/uuid/compare/1.1.2...2.0.0 -[1.1.2]: https://github.com/ramsey/uuid/compare/1.1.1...1.1.2 -[1.1.1]: https://github.com/ramsey/uuid/compare/1.1.0...1.1.1 -[1.1.0]: https://github.com/ramsey/uuid/compare/1.0.0...1.1.0 -[1.0.0]: https://github.com/ramsey/uuid/commits/1.0.0 diff --git a/vendor/ramsey/uuid/LICENSE b/vendor/ramsey/uuid/LICENSE index b2aa4b587..5e06cf43b 100644 --- a/vendor/ramsey/uuid/LICENSE +++ b/vendor/ramsey/uuid/LICENSE @@ -1,6 +1,4 @@ -MIT License - -Copyright (c) 2012-2020 Ben Ramsey <ben@benramsey.com> +Copyright (c) 2012-2021 Ben Ramsey <ben@benramsey.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/ramsey/uuid/README.md b/vendor/ramsey/uuid/README.md index 0e539e6b8..97e81a501 100644 --- a/vendor/ramsey/uuid/README.md +++ b/vendor/ramsey/uuid/README.md @@ -1,24 +1,29 @@ -# ramsey/uuid - -[![Source Code][badge-source]][source] -[![Latest Version][badge-release]][release] -[![Software License][badge-license]][license] -[![PHP Version][badge-php]][php] -[![Build Status][badge-build]][build] -[![Coverage Status][badge-coverage]][coverage] -[![Total Downloads][badge-downloads]][downloads] +<h1 align="center">ramsey/uuid</h1> + +<p align="center"> + <strong>A PHP library for generating and working with UUIDs.</strong> +</p> + +<p align="center"> + <a href="https://github.com/ramsey/uuid"><img src="http://img.shields.io/badge/source-ramsey/uuid-blue.svg?style=flat-square" alt="Source Code"></a> + <a href="https://packagist.org/packages/ramsey/uuid"><img src="https://img.shields.io/packagist/v/ramsey/uuid.svg?style=flat-square&label=release" alt="Download Package"></a> + <a href="https://php.net"><img src="https://img.shields.io/packagist/php-v/ramsey/uuid.svg?style=flat-square&colorB=%238892BF" alt="PHP Programming Language"></a> + <a href="https://github.com/ramsey/uuid/blob/main/LICENSE"><img src="https://img.shields.io/packagist/l/ramsey/uuid.svg?style=flat-square&colorB=darkcyan" alt="Read License"></a> + <a href="https://github.com/ramsey/uuid/actions/workflows/continuous-integration.yml"><img src="https://img.shields.io/github/workflow/status/ramsey/uuid/build/main?logo=github&style=flat-square" alt="Build Status"></a> + <a href="https://codecov.io/gh/ramsey/uuid"><img src="https://img.shields.io/codecov/c/gh/ramsey/uuid?label=codecov&logo=codecov&style=flat-square" alt="Codecov Code Coverage"></a> + <a href="https://shepherd.dev/github/ramsey/uuid"><img src="https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fshepherd.dev%2Fgithub%2Framsey%2Fuuid%2Fcoverage" alt="Psalm Type Coverage"></a> +</p> ramsey/uuid is a PHP library for generating and working with universally unique identifiers (UUIDs). -This project adheres to a [Contributor Code of Conduct][conduct]. By -participating in this project and its community, you are expected to uphold this -code. +This project adheres to a [code of conduct](CODE_OF_CONDUCT.md). +By participating in this project and its community, you are expected to +uphold this code. Much inspiration for this library came from the [Java][javauuid] and [Python][pyuuid] UUID libraries. - ## Installation The preferred method of installation is via [Composer][]. Run the following @@ -29,24 +34,38 @@ command to install the package and add it as a requirement to your project's composer require ramsey/uuid ``` - ## Upgrading to Version 4 See the documentation for a thorough upgrade guide: * [Upgrading ramsey/uuid Version 3 to 4](https://uuid.ramsey.dev/en/latest/upgrading/3-to-4.html) - ## Documentation Please see <https://uuid.ramsey.dev> for documentation, tips, examples, and frequently asked questions. - ## Contributing -Contributions are welcome! Please read [CONTRIBUTING.md][] for details. +Contributions are welcome! To contribute, please familiarize yourself with +[CONTRIBUTING.md](CONTRIBUTING.md). +## Coordinated Disclosure + +Keeping user information safe and secure is a top priority, and we welcome the +contribution of external security researchers. If you believe you've found a +security issue in software that is maintained in this repository, please read +[SECURITY.md][] for instructions on submitting a vulnerability report. + +## ramsey/uuid for Enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of ramsey/uuid and thousands of other packages are working with +Tidelift to deliver commercial support and maintenance for the open source +packages you use to build your applications. Save time, reduce risk, and improve +code health, while paying the maintainers of the exact packages you use. +[Learn more.](https://tidelift.com/subscription/pkg/packagist-ramsey-uuid?utm_source=undefined&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) ## Copyright and License @@ -54,26 +73,11 @@ The ramsey/uuid library is copyright © [Ben Ramsey](https://benramsey.com/) and licensed for use under the MIT License (MIT). Please see [LICENSE][] for more information. - [rfc4122]: http://tools.ietf.org/html/rfc4122 -[conduct]: https://github.com/ramsey/uuid/blob/master/.github/CODE_OF_CONDUCT.md +[conduct]: https://github.com/ramsey/uuid/blob/main/CODE_OF_CONDUCT.md [javauuid]: http://docs.oracle.com/javase/6/docs/api/java/util/UUID.html [pyuuid]: http://docs.python.org/3/library/uuid.html [composer]: http://getcomposer.org/ -[contributing.md]: https://github.com/ramsey/uuid/blob/master/.github/CONTRIBUTING.md - -[badge-source]: https://img.shields.io/badge/source-ramsey/uuid-blue.svg?style=flat-square -[badge-release]: https://img.shields.io/packagist/v/ramsey/uuid.svg?style=flat-square&label=release -[badge-license]: https://img.shields.io/packagist/l/ramsey/uuid.svg?style=flat-square -[badge-php]: https://img.shields.io/packagist/php-v/ramsey/uuid.svg?style=flat-square -[badge-build]: https://img.shields.io/travis/ramsey/uuid/master.svg?style=flat-square -[badge-coverage]: https://img.shields.io/coveralls/github/ramsey/uuid/master.svg?style=flat-square -[badge-downloads]: https://img.shields.io/packagist/dt/ramsey/uuid.svg?style=flat-square&colorB=mediumvioletred - -[source]: https://github.com/ramsey/uuid -[release]: https://packagist.org/packages/ramsey/uuid -[license]: https://github.com/ramsey/uuid/blob/master/LICENSE -[php]: https://php.net -[build]: https://travis-ci.org/ramsey/uuid -[coverage]: https://coveralls.io/github/ramsey/uuid?branch=master -[downloads]: https://packagist.org/packages/ramsey/uuid +[contributing.md]: https://github.com/ramsey/uuid/blob/main/CONTRIBUTING.md +[security.md]: https://github.com/ramsey/uuid/blob/main/SECURITY.md +[license]: https://github.com/ramsey/uuid/blob/main/LICENSE diff --git a/vendor/ramsey/uuid/composer.json b/vendor/ramsey/uuid/composer.json index 41d500b20..3f3b5ac42 100644 --- a/vendor/ramsey/uuid/composer.json +++ b/vendor/ramsey/uuid/composer.json @@ -7,56 +7,59 @@ "identifier", "guid" ], - "homepage": "https://github.com/ramsey/uuid", "license": "MIT", "require": { - "php": "^7.2 || ^8", + "php": "^7.2 || ^8.0", "ext-json": "*", "brick/math": "^0.8 || ^0.9", "ramsey/collection": "^1.0", - "symfony/polyfill-ctype": "^1.8" + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-php80": "^1.14" + }, + "replace": { + "rhumsaa/uuid": "self.version" }, "require-dev": { - "codeception/aspect-mock": "^3", - "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7.0", + "captainhook/captainhook": "^5.10", + "captainhook/plugin-composer": "^5.3", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "doctrine/annotations": "^1.8", - "goaop/framework": "^2", + "ergebnis/composer-normalize": "^2.15", "mockery/mockery": "^1.3", "moontoast/math": "^1.1", "paragonie/random-lib": "^2", + "php-mock/php-mock": "^2.2", "php-mock/php-mock-mockery": "^1.3", - "php-mock/php-mock-phpunit": "^2.5", "php-parallel-lint/php-parallel-lint": "^1.1", - "phpbench/phpbench": "^0.17.1", + "phpbench/phpbench": "^1.0", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^0.12", "phpstan/phpstan-mockery": "^0.12", "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^8.5", - "psy/psysh": "^0.10.0", - "slevomat/coding-standard": "^6.0", + "phpunit/phpunit": "^8.5 || ^9", + "slevomat/coding-standard": "^7.0", "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "3.9.4" + "vimeo/psalm": "^4.9" }, "suggest": { "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", "ext-ctype": "Enables faster processing of character classification using ctype functions.", "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", - "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type.", - "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter" + "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", + "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." }, "config": { "sort-packages": true }, "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-main": "4.x-dev" + }, + "captainhook": { + "force-install": true } }, - "replace": { - "rhumsaa/uuid": "self.version" - }, "autoload": { "psr-4": { "Ramsey\\Uuid\\": "src/" @@ -72,18 +75,26 @@ "Ramsey\\Uuid\\Test\\": "tests/" } }, + "minimum-stability": "dev", + "prefer-stable": true, "scripts": { + "analyze": [ + "@phpstan", + "@psalm" + ], + "build:clean": "git clean -fX build/", "lint": "parallel-lint src tests", + "lint:paths": "parallel-lint", "phpbench": "phpbench run", "phpcbf": "phpcbf -vpw --cache=build/cache/phpcs.cache", "phpcs": "phpcs --cache=build/cache/phpcs.cache", "phpstan": [ - "phpstan analyse -c tests/phpstan.neon --no-progress", - "phpstan analyse -c tests/phpstan-tests.neon --no-progress" + "phpstan analyse --no-progress", + "phpstan analyse -c phpstan-tests.neon --no-progress" ], - "psalm": "psalm --show-info=false --config=tests/psalm.xml", "phpunit": "phpunit --verbose --colors=always", "phpunit-coverage": "phpunit --verbose --colors=always --coverage-html build/coverage", + "psalm": "psalm --show-info=false --config=psalm.xml", "test": [ "@lint", "@phpbench", @@ -92,10 +103,5 @@ "@psalm", "@phpunit" ] - }, - "support": { - "issues": "https://github.com/ramsey/uuid/issues", - "rss": "https://github.com/ramsey/uuid/releases.atom", - "source": "https://github.com/ramsey/uuid" } } diff --git a/vendor/ramsey/uuid/src/Builder/BuilderCollection.php b/vendor/ramsey/uuid/src/Builder/BuilderCollection.php index b3e5f1dc9..89fa1e3c8 100644 --- a/vendor/ramsey/uuid/src/Builder/BuilderCollection.php +++ b/vendor/ramsey/uuid/src/Builder/BuilderCollection.php @@ -15,7 +15,6 @@ declare(strict_types=1); namespace Ramsey\Uuid\Builder; use Ramsey\Collection\AbstractCollection; -use Ramsey\Collection\CollectionInterface; use Ramsey\Uuid\Converter\Number\GenericNumberConverter; use Ramsey\Uuid\Converter\Time\GenericTimeConverter; use Ramsey\Uuid\Converter\Time\PhpTimeConverter; @@ -27,8 +26,10 @@ use Traversable; /** * A collection of UuidBuilderInterface objects + * + * @extends AbstractCollection<UuidBuilderInterface> */ -class BuilderCollection extends AbstractCollection implements CollectionInterface +class BuilderCollection extends AbstractCollection { public function getType(): string { @@ -52,10 +53,11 @@ class BuilderCollection extends AbstractCollection implements CollectionInterfac * a UuidInterface instance * * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + * @psalm-suppress RedundantConditionGivenDocblockType */ public function unserialize($serialized): void { - /** @var mixed[] $data */ + /** @var array<array-key, UuidBuilderInterface> $data */ $data = unserialize($serialized, [ 'allowed_classes' => [ BrickMathCalculator::class, @@ -68,6 +70,11 @@ class BuilderCollection extends AbstractCollection implements CollectionInterfac ], ]); - $this->data = $data; + $this->data = array_filter( + $data, + function ($unserialized): bool { + return $unserialized instanceof UuidBuilderInterface; + } + ); } } diff --git a/vendor/ramsey/uuid/src/Builder/DefaultUuidBuilder.php b/vendor/ramsey/uuid/src/Builder/DefaultUuidBuilder.php index 2af4e867d..7c4a6f837 100644 --- a/vendor/ramsey/uuid/src/Builder/DefaultUuidBuilder.php +++ b/vendor/ramsey/uuid/src/Builder/DefaultUuidBuilder.php @@ -21,6 +21,6 @@ use Ramsey\Uuid\Rfc4122\UuidBuilder as Rfc4122UuidBuilder; * * @psalm-immutable */ -class DefaultUuidBuilder extends Rfc4122UuidBuilder implements UuidBuilderInterface +class DefaultUuidBuilder extends Rfc4122UuidBuilder { } diff --git a/vendor/ramsey/uuid/src/Builder/FallbackBuilder.php b/vendor/ramsey/uuid/src/Builder/FallbackBuilder.php index cfd4665ac..470d2f755 100644 --- a/vendor/ramsey/uuid/src/Builder/FallbackBuilder.php +++ b/vendor/ramsey/uuid/src/Builder/FallbackBuilder.php @@ -55,7 +55,6 @@ class FallbackBuilder implements UuidBuilderInterface { $lastBuilderException = null; - /** @var UuidBuilderInterface $builder */ foreach ($this->builders as $builder) { try { return $builder->build($codec, $bytes); diff --git a/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php b/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php index fe9f57c76..0798ebc4d 100644 --- a/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php +++ b/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php @@ -67,6 +67,7 @@ class OrderedTimeCodec extends StringCodec $bytes = $uuid->getFields()->getBytes(); + /** @phpstan-ignore-next-line PHPStan complains that this is not a non-empty-string. */ return $bytes[6] . $bytes[7] . $bytes[4] . $bytes[5] . $bytes[0] . $bytes[1] . $bytes[2] . $bytes[3] diff --git a/vendor/ramsey/uuid/src/Codec/StringCodec.php b/vendor/ramsey/uuid/src/Codec/StringCodec.php index fff13bd81..58c9f5806 100644 --- a/vendor/ramsey/uuid/src/Codec/StringCodec.php +++ b/vendor/ramsey/uuid/src/Codec/StringCodec.php @@ -75,6 +75,7 @@ class StringCodec implements CodecInterface */ public function encodeBinary(UuidInterface $uuid): string { + /** @phpstan-ignore-next-line PHPStan complains that this is not a non-empty-string. */ return $uuid->getFields()->getBytes(); } diff --git a/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php b/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php index 06ce38fbb..0e0042d0a 100644 --- a/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php +++ b/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php @@ -76,6 +76,7 @@ class TimestampFirstCombCodec extends StringCodec */ public function encodeBinary(UuidInterface $uuid): string { + /** @phpstan-ignore-next-line PHPStan complains that this is not a non-empty-string. */ return $this->swapBytes($uuid->getFields()->getBytes()); } diff --git a/vendor/ramsey/uuid/src/Converter/Number/GenericNumberConverter.php b/vendor/ramsey/uuid/src/Converter/Number/GenericNumberConverter.php index c85bc3a71..501eac0fa 100644 --- a/vendor/ramsey/uuid/src/Converter/Number/GenericNumberConverter.php +++ b/vendor/ramsey/uuid/src/Converter/Number/GenericNumberConverter.php @@ -19,7 +19,7 @@ use Ramsey\Uuid\Math\CalculatorInterface; use Ramsey\Uuid\Type\Integer as IntegerObject; /** - * GenericNumberConverter uses the provided calculate to convert decimal + * GenericNumberConverter uses the provided calculator to convert decimal * numbers to and from hexadecimal values * * @psalm-immutable @@ -57,6 +57,7 @@ class GenericNumberConverter implements NumberConverterInterface */ public function toHex(string $number): string { + /** @phpstan-ignore-next-line PHPStan complains that this is not a non-empty-string. */ return $this->calculator->toBase(new IntegerObject($number), 16); } } diff --git a/vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php b/vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php index 52963fed6..538d2f2f6 100644 --- a/vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php +++ b/vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php @@ -111,7 +111,7 @@ class PhpTimeConverter implements TimeConverterInterface ); } - return new Hexadecimal(str_pad(dechex((int) $uuidTime), 16, '0', STR_PAD_LEFT)); + return new Hexadecimal(str_pad(dechex($uuidTime), 16, '0', STR_PAD_LEFT)); } public function convertTime(Hexadecimal $uuidTimestamp): Time diff --git a/vendor/ramsey/uuid/src/Exception/BuilderNotFoundException.php b/vendor/ramsey/uuid/src/Exception/BuilderNotFoundException.php index c0854d256..220ffedb8 100644 --- a/vendor/ramsey/uuid/src/Exception/BuilderNotFoundException.php +++ b/vendor/ramsey/uuid/src/Exception/BuilderNotFoundException.php @@ -19,6 +19,6 @@ use RuntimeException as PhpRuntimeException; /** * Thrown to indicate that no suitable builder could be found */ -class BuilderNotFoundException extends PhpRuntimeException +class BuilderNotFoundException extends PhpRuntimeException implements UuidExceptionInterface { } diff --git a/vendor/ramsey/uuid/src/Exception/DateTimeException.php b/vendor/ramsey/uuid/src/Exception/DateTimeException.php index dbc484045..5f0e658bf 100644 --- a/vendor/ramsey/uuid/src/Exception/DateTimeException.php +++ b/vendor/ramsey/uuid/src/Exception/DateTimeException.php @@ -19,6 +19,6 @@ use RuntimeException as PhpRuntimeException; /** * Thrown to indicate that the PHP DateTime extension encountered an exception/error */ -class DateTimeException extends PhpRuntimeException +class DateTimeException extends PhpRuntimeException implements UuidExceptionInterface { } diff --git a/vendor/ramsey/uuid/src/Exception/DceSecurityException.php b/vendor/ramsey/uuid/src/Exception/DceSecurityException.php index a65f80cd4..e6d800136 100644 --- a/vendor/ramsey/uuid/src/Exception/DceSecurityException.php +++ b/vendor/ramsey/uuid/src/Exception/DceSecurityException.php @@ -20,6 +20,6 @@ use RuntimeException as PhpRuntimeException; * Thrown to indicate an exception occurred while dealing with DCE Security * (version 2) UUIDs */ -class DceSecurityException extends PhpRuntimeException +class DceSecurityException extends PhpRuntimeException implements UuidExceptionInterface { } diff --git a/vendor/ramsey/uuid/src/Exception/InvalidArgumentException.php b/vendor/ramsey/uuid/src/Exception/InvalidArgumentException.php index 08bbb8029..2a1fa3ac2 100644 --- a/vendor/ramsey/uuid/src/Exception/InvalidArgumentException.php +++ b/vendor/ramsey/uuid/src/Exception/InvalidArgumentException.php @@ -19,6 +19,6 @@ use InvalidArgumentException as PhpInvalidArgumentException; /** * Thrown to indicate that the argument received is not valid */ -class InvalidArgumentException extends PhpInvalidArgumentException +class InvalidArgumentException extends PhpInvalidArgumentException implements UuidExceptionInterface { } diff --git a/vendor/ramsey/uuid/src/Exception/InvalidBytesException.php b/vendor/ramsey/uuid/src/Exception/InvalidBytesException.php index b20be3de0..1c94f6596 100644 --- a/vendor/ramsey/uuid/src/Exception/InvalidBytesException.php +++ b/vendor/ramsey/uuid/src/Exception/InvalidBytesException.php @@ -19,6 +19,6 @@ use RuntimeException as PhpRuntimeException; /** * Thrown to indicate that the bytes being operated on are invalid in some way */ -class InvalidBytesException extends PhpRuntimeException +class InvalidBytesException extends PhpRuntimeException implements UuidExceptionInterface { } diff --git a/vendor/ramsey/uuid/src/Exception/InvalidUuidStringException.php b/vendor/ramsey/uuid/src/Exception/InvalidUuidStringException.php index 24f42c643..6d9758166 100644 --- a/vendor/ramsey/uuid/src/Exception/InvalidUuidStringException.php +++ b/vendor/ramsey/uuid/src/Exception/InvalidUuidStringException.php @@ -20,6 +20,6 @@ namespace Ramsey\Uuid\Exception; * The InvalidArgumentException that this extends is the ramsey/uuid version * of this exception. It exists in the same namespace as this class. */ -class InvalidUuidStringException extends InvalidArgumentException +class InvalidUuidStringException extends InvalidArgumentException implements UuidExceptionInterface { } diff --git a/vendor/ramsey/uuid/src/Exception/NameException.php b/vendor/ramsey/uuid/src/Exception/NameException.php index 54d32ec38..fd96a1faf 100644 --- a/vendor/ramsey/uuid/src/Exception/NameException.php +++ b/vendor/ramsey/uuid/src/Exception/NameException.php @@ -20,6 +20,6 @@ use RuntimeException as PhpRuntimeException; * Thrown to indicate that an error occurred while attempting to hash a * namespace and name */ -class NameException extends PhpRuntimeException +class NameException extends PhpRuntimeException implements UuidExceptionInterface { } diff --git a/vendor/ramsey/uuid/src/Exception/NodeException.php b/vendor/ramsey/uuid/src/Exception/NodeException.php index 21b6d1804..0dbdd50b4 100644 --- a/vendor/ramsey/uuid/src/Exception/NodeException.php +++ b/vendor/ramsey/uuid/src/Exception/NodeException.php @@ -19,6 +19,6 @@ use RuntimeException as PhpRuntimeException; /** * Thrown to indicate that attempting to fetch or create a node ID encountered an error */ -class NodeException extends PhpRuntimeException +class NodeException extends PhpRuntimeException implements UuidExceptionInterface { } diff --git a/vendor/ramsey/uuid/src/Exception/RandomSourceException.php b/vendor/ramsey/uuid/src/Exception/RandomSourceException.php index 0c3e4f523..a44dd34a2 100644 --- a/vendor/ramsey/uuid/src/Exception/RandomSourceException.php +++ b/vendor/ramsey/uuid/src/Exception/RandomSourceException.php @@ -22,6 +22,6 @@ use RuntimeException as PhpRuntimeException; * This exception is used mostly to indicate that random_bytes() or random_int() * threw an exception. However, it may be used for other sources of random data. */ -class RandomSourceException extends PhpRuntimeException +class RandomSourceException extends PhpRuntimeException implements UuidExceptionInterface { } diff --git a/vendor/ramsey/uuid/src/Exception/TimeSourceException.php b/vendor/ramsey/uuid/src/Exception/TimeSourceException.php index accd37f87..fc9cf36b6 100644 --- a/vendor/ramsey/uuid/src/Exception/TimeSourceException.php +++ b/vendor/ramsey/uuid/src/Exception/TimeSourceException.php @@ -19,6 +19,6 @@ use RuntimeException as PhpRuntimeException; /** * Thrown to indicate that the source of time encountered an error */ -class TimeSourceException extends PhpRuntimeException +class TimeSourceException extends PhpRuntimeException implements UuidExceptionInterface { } diff --git a/vendor/ramsey/uuid/src/Exception/UnableToBuildUuidException.php b/vendor/ramsey/uuid/src/Exception/UnableToBuildUuidException.php index da9649035..5ba26d8dc 100644 --- a/vendor/ramsey/uuid/src/Exception/UnableToBuildUuidException.php +++ b/vendor/ramsey/uuid/src/Exception/UnableToBuildUuidException.php @@ -19,6 +19,6 @@ use RuntimeException as PhpRuntimeException; /** * Thrown to indicate a builder is unable to build a UUID */ -class UnableToBuildUuidException extends PhpRuntimeException +class UnableToBuildUuidException extends PhpRuntimeException implements UuidExceptionInterface { } diff --git a/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php b/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php index e6391b03d..e1b3eda17 100644 --- a/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php +++ b/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php @@ -19,6 +19,6 @@ use LogicException as PhpLogicException; /** * Thrown to indicate that the requested operation is not supported */ -class UnsupportedOperationException extends PhpLogicException +class UnsupportedOperationException extends PhpLogicException implements UuidExceptionInterface { } diff --git a/vendor/ramsey/uuid/src/Exception/UuidExceptionInterface.php b/vendor/ramsey/uuid/src/Exception/UuidExceptionInterface.php new file mode 100644 index 000000000..a2f1c103b --- /dev/null +++ b/vendor/ramsey/uuid/src/Exception/UuidExceptionInterface.php @@ -0,0 +1,21 @@ +<?php + +/** + * This file is part of the ramsey/uuid library + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com> + * @license http://opensource.org/licenses/MIT MIT + */ + +declare(strict_types=1); + +namespace Ramsey\Uuid\Exception; + +use Throwable; + +interface UuidExceptionInterface extends Throwable +{ +} diff --git a/vendor/ramsey/uuid/src/FeatureSet.php b/vendor/ramsey/uuid/src/FeatureSet.php index 4531a6d7f..a8ab2fdbb 100644 --- a/vendor/ramsey/uuid/src/FeatureSet.php +++ b/vendor/ramsey/uuid/src/FeatureSet.php @@ -274,6 +274,7 @@ class FeatureSet $this->numberConverter = $this->buildNumberConverter($calculator); $this->timeConverter = $this->buildTimeConverter($calculator); + /** @psalm-suppress RedundantPropertyInitializationCheck */ if (isset($this->timeProvider)) { $this->timeGenerator = $this->buildTimeGenerator($this->timeProvider); } diff --git a/vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php b/vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php index 4ae90be2c..16e6525da 100644 --- a/vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php +++ b/vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php @@ -14,7 +14,10 @@ declare(strict_types=1); namespace Ramsey\Uuid\Fields; +use ValueError; + use function base64_decode; +use function sprintf; use function strlen; /** @@ -43,11 +46,20 @@ trait SerializableFieldsTrait } /** + * @return array{bytes: string} + */ + public function __serialize(): array + { + return ['bytes' => $this->getBytes()]; + } + + /** * Constructs the object from a serialized string representation * * @param string $serialized The serialized string representation of the object * * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + * @psalm-suppress UnusedMethodCall */ public function unserialize($serialized): void { @@ -57,4 +69,18 @@ trait SerializableFieldsTrait $this->__construct(base64_decode($serialized)); } } + + /** + * @param array{bytes: string} $data + */ + public function __unserialize(array $data): void + { + // @codeCoverageIgnoreStart + if (!isset($data['bytes'])) { + throw new ValueError(sprintf('%s(): Argument #1 ($data) is invalid', __METHOD__)); + } + // @codeCoverageIgnoreEnd + + $this->unserialize($data['bytes']); + } } diff --git a/vendor/ramsey/uuid/src/Generator/CombGenerator.php b/vendor/ramsey/uuid/src/Generator/CombGenerator.php index 88ae6ea23..49b09381d 100644 --- a/vendor/ramsey/uuid/src/Generator/CombGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/CombGenerator.php @@ -107,7 +107,7 @@ class CombGenerator implements RandomGeneratorInterface return (string) hex2bin( str_pad( - bin2hex((string) $hash), + bin2hex($hash), $length - self::TIMESTAMP_BYTES, '0' ) diff --git a/vendor/ramsey/uuid/src/Generator/DceSecurityGenerator.php b/vendor/ramsey/uuid/src/Generator/DceSecurityGenerator.php index a3f07f2ff..aca8c5db7 100644 --- a/vendor/ramsey/uuid/src/Generator/DceSecurityGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/DceSecurityGenerator.php @@ -138,7 +138,7 @@ class DceSecurityGenerator implements DceSecurityGeneratorInterface } $domainByte = pack('n', $localDomain)[1]; - $identifierBytes = hex2bin(str_pad($identifierHex, 8, '0', STR_PAD_LEFT)); + $identifierBytes = (string) hex2bin(str_pad($identifierHex, 8, '0', STR_PAD_LEFT)); if ($node instanceof Hexadecimal) { $node = $node->toString(); @@ -149,7 +149,6 @@ class DceSecurityGenerator implements DceSecurityGeneratorInterface $clockSeq = $clockSeq << 8; } - /** @var string $bytes */ $bytes = $this->timeGenerator->generate($node, $clockSeq); // Replace bytes in the time-based UUID with DCE Security values. diff --git a/vendor/ramsey/uuid/src/Generator/DefaultNameGenerator.php b/vendor/ramsey/uuid/src/Generator/DefaultNameGenerator.php index 270e8fbe1..7303e9fa2 100644 --- a/vendor/ramsey/uuid/src/Generator/DefaultNameGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/DefaultNameGenerator.php @@ -16,6 +16,7 @@ namespace Ramsey\Uuid\Generator; use Ramsey\Uuid\Exception\NameException; use Ramsey\Uuid\UuidInterface; +use ValueError; use function hash; @@ -28,8 +29,12 @@ class DefaultNameGenerator implements NameGeneratorInterface /** @psalm-pure */ public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string { - /** @var string|bool $bytes */ - $bytes = @hash($hashAlgorithm, $ns->getBytes() . $name, true); + try { + /** @var string|bool $bytes */ + $bytes = @hash($hashAlgorithm, $ns->getBytes() . $name, true); + } catch (ValueError $e) { + $bytes = false; // keep same behavior than PHP 7 + } if ($bytes === false) { throw new NameException(sprintf( diff --git a/vendor/ramsey/uuid/src/Generator/PeclUuidNameGenerator.php b/vendor/ramsey/uuid/src/Generator/PeclUuidNameGenerator.php index 93b786878..3780c5c60 100644 --- a/vendor/ramsey/uuid/src/Generator/PeclUuidNameGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/PeclUuidNameGenerator.php @@ -35,11 +35,11 @@ class PeclUuidNameGenerator implements NameGeneratorInterface { switch ($hashAlgorithm) { case 'md5': - $uuid = (string) uuid_generate_md5($ns->toString(), $name); + $uuid = uuid_generate_md5($ns->toString(), $name); break; case 'sha1': - $uuid = (string) uuid_generate_sha1($ns->toString(), $name); + $uuid = uuid_generate_sha1($ns->toString(), $name); break; default: @@ -49,6 +49,6 @@ class PeclUuidNameGenerator implements NameGeneratorInterface )); } - return (string) uuid_parse($uuid); + return uuid_parse($uuid); } } diff --git a/vendor/ramsey/uuid/src/Generator/PeclUuidRandomGenerator.php b/vendor/ramsey/uuid/src/Generator/PeclUuidRandomGenerator.php index df750f6a5..07c47d265 100644 --- a/vendor/ramsey/uuid/src/Generator/PeclUuidRandomGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/PeclUuidRandomGenerator.php @@ -14,6 +14,9 @@ declare(strict_types=1); namespace Ramsey\Uuid\Generator; +use function uuid_create; +use function uuid_parse; + use const UUID_TYPE_RANDOM; /** diff --git a/vendor/ramsey/uuid/src/Generator/PeclUuidTimeGenerator.php b/vendor/ramsey/uuid/src/Generator/PeclUuidTimeGenerator.php index 903798dd3..e01f44e52 100644 --- a/vendor/ramsey/uuid/src/Generator/PeclUuidTimeGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/PeclUuidTimeGenerator.php @@ -14,6 +14,9 @@ declare(strict_types=1); namespace Ramsey\Uuid\Generator; +use function uuid_create; +use function uuid_parse; + use const UUID_TYPE_TIME; /** diff --git a/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php b/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php index e6e9a199b..12edb96ae 100644 --- a/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php @@ -15,6 +15,7 @@ declare(strict_types=1); namespace Ramsey\Uuid\Generator; use Ramsey\Uuid\Exception\RandomSourceException; +use Throwable; /** * RandomBytesGenerator generates strings of random binary data using the @@ -33,7 +34,7 @@ class RandomBytesGenerator implements RandomGeneratorInterface { try { return random_bytes($length); - } catch (\Throwable $exception) { + } catch (Throwable $exception) { throw new RandomSourceException( $exception->getMessage(), (int) $exception->getCode(), diff --git a/vendor/ramsey/uuid/src/Guid/Fields.php b/vendor/ramsey/uuid/src/Guid/Fields.php index 49db4ed2f..d8a1a2b10 100644 --- a/vendor/ramsey/uuid/src/Guid/Fields.php +++ b/vendor/ramsey/uuid/src/Guid/Fields.php @@ -94,6 +94,7 @@ final class Fields implements FieldsInterface public function getTimeLow(): Hexadecimal { // Swap the bytes from little endian to network byte order. + /** @var array $hex */ $hex = unpack( 'H*', pack( @@ -109,6 +110,7 @@ final class Fields implements FieldsInterface public function getTimeMid(): Hexadecimal { // Swap the bytes from little endian to network byte order. + /** @var array $hex */ $hex = unpack( 'H*', pack( @@ -123,6 +125,7 @@ final class Fields implements FieldsInterface public function getTimeHiAndVersion(): Hexadecimal { // Swap the bytes from little endian to network byte order. + /** @var array $hex */ $hex = unpack( 'H*', pack( @@ -172,6 +175,7 @@ final class Fields implements FieldsInterface return null; } + /** @var array $parts */ $parts = unpack('n*', $this->bytes); return ((int) $parts[4] >> 4) & 0x00f; diff --git a/vendor/ramsey/uuid/src/Guid/Guid.php b/vendor/ramsey/uuid/src/Guid/Guid.php index 08a00695a..b3ed096ab 100644 --- a/vendor/ramsey/uuid/src/Guid/Guid.php +++ b/vendor/ramsey/uuid/src/Guid/Guid.php @@ -18,7 +18,6 @@ use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\TimeConverterInterface; use Ramsey\Uuid\Uuid; -use Ramsey\Uuid\UuidInterface; /** * Guid represents a UUID with "native" (little-endian) byte order @@ -49,7 +48,7 @@ use Ramsey\Uuid\UuidInterface; * * @psalm-immutable */ -final class Guid extends Uuid implements UuidInterface +final class Guid extends Uuid { public function __construct( Fields $fields, diff --git a/vendor/ramsey/uuid/src/Lazy/LazyUuidFromString.php b/vendor/ramsey/uuid/src/Lazy/LazyUuidFromString.php index 3d4ddcb21..8ba757964 100644 --- a/vendor/ramsey/uuid/src/Lazy/LazyUuidFromString.php +++ b/vendor/ramsey/uuid/src/Lazy/LazyUuidFromString.php @@ -7,7 +7,7 @@ * file that was distributed with this source code. * * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com> - * @license http://opensource.org/licenses/MIT MIT + * @license http://opensource.org/licenses/MIT MIT */ declare(strict_types=1); @@ -24,10 +24,12 @@ use Ramsey\Uuid\Type\Hexadecimal; use Ramsey\Uuid\Type\Integer as IntegerObject; use Ramsey\Uuid\UuidFactory; use Ramsey\Uuid\UuidInterface; +use ValueError; use function assert; use function bin2hex; use function hex2bin; +use function sprintf; use function str_replace; use function substr; @@ -91,6 +93,16 @@ final class LazyUuidFromString implements UuidInterface } /** + * @return array{string: string} + * + * @psalm-return array{string: non-empty-string} + */ + public function __serialize(): array + { + return ['string' => $this->uuid]; + } + + /** * {@inheritDoc} * * @param string $serialized @@ -102,6 +114,22 @@ final class LazyUuidFromString implements UuidInterface $this->uuid = $serialized; } + /** + * @param array{string: string} $data + * + * @psalm-param array{string: non-empty-string} $data + */ + public function __unserialize(array $data): void + { + // @codeCoverageIgnoreStart + if (!isset($data['string'])) { + throw new ValueError(sprintf('%s(): Argument #1 ($data) is invalid', __METHOD__)); + } + // @codeCoverageIgnoreEnd + + $this->unserialize($data['string']); + } + /** @psalm-suppress DeprecatedMethod */ public function getNumberConverter(): NumberConverterInterface { @@ -242,6 +270,7 @@ final class LazyUuidFromString implements UuidInterface */ public function getBytes(): string { + /** @phpstan-ignore-next-line PHPStan complains that this is not a non-empty-string. */ return (string) hex2bin(str_replace('-', '', $this->uuid)); } @@ -497,7 +526,7 @@ final class LazyUuidFromString implements UuidInterface public function getTimestamp(): string { $instance = ($this->unwrapped ?? $this->unwrap()); - $fields = $instance->getFields(); + $fields = $instance->getFields(); if ($fields->getVersion() !== 1) { throw new UnsupportedOperationException('Not a time-based UUID'); diff --git a/vendor/ramsey/uuid/src/Nonstandard/Uuid.php b/vendor/ramsey/uuid/src/Nonstandard/Uuid.php index 5a7a33347..715f82554 100644 --- a/vendor/ramsey/uuid/src/Nonstandard/Uuid.php +++ b/vendor/ramsey/uuid/src/Nonstandard/Uuid.php @@ -18,14 +18,13 @@ use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\TimeConverterInterface; use Ramsey\Uuid\Uuid as BaseUuid; -use Ramsey\Uuid\UuidInterface; /** * Nonstandard\Uuid is a UUID that doesn't conform to RFC 4122 * * @psalm-immutable */ -final class Uuid extends BaseUuid implements UuidInterface +final class Uuid extends BaseUuid { public function __construct( Fields $fields, diff --git a/vendor/ramsey/uuid/src/Provider/Dce/SystemDceSecurityProvider.php b/vendor/ramsey/uuid/src/Provider/Dce/SystemDceSecurityProvider.php index 1a1f4cf2e..6d6240b7a 100644 --- a/vendor/ramsey/uuid/src/Provider/Dce/SystemDceSecurityProvider.php +++ b/vendor/ramsey/uuid/src/Provider/Dce/SystemDceSecurityProvider.php @@ -177,8 +177,7 @@ class SystemDceSecurityProvider implements DceSecurityProviderInterface return ''; } - /** @var string $sid */ - $sid = str_getcsv(trim($response))[1] ?? ''; + $sid = str_getcsv(trim((string) $response))[1] ?? ''; if (($lastHyphen = strrpos($sid, '-')) === false) { return ''; @@ -207,7 +206,7 @@ class SystemDceSecurityProvider implements DceSecurityProviderInterface } /** @var string[] $userGroups */ - $userGroups = preg_split('/\s{2,}/', $response, -1, PREG_SPLIT_NO_EMPTY); + $userGroups = preg_split('/\s{2,}/', (string) $response, -1, PREG_SPLIT_NO_EMPTY); $firstGroup = trim($userGroups[1] ?? '', "* \t\n\r\0\x0B"); @@ -222,7 +221,7 @@ class SystemDceSecurityProvider implements DceSecurityProviderInterface } /** @var string[] $userGroup */ - $userGroup = preg_split('/\s{2,}/', $response, -1, PREG_SPLIT_NO_EMPTY); + $userGroup = preg_split('/\s{2,}/', (string) $response, -1, PREG_SPLIT_NO_EMPTY); $sid = $userGroup[1] ?? ''; diff --git a/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php b/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php index f6e5e406d..cad01045c 100644 --- a/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php +++ b/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php @@ -41,7 +41,6 @@ class FallbackNodeProvider implements NodeProviderInterface { $lastProviderException = null; - /** @var NodeProviderInterface $provider */ foreach ($this->nodeProviders as $provider) { try { return $provider->getNode(); diff --git a/vendor/ramsey/uuid/src/Provider/Node/NodeProviderCollection.php b/vendor/ramsey/uuid/src/Provider/Node/NodeProviderCollection.php index 89d09178d..536cb6034 100644 --- a/vendor/ramsey/uuid/src/Provider/Node/NodeProviderCollection.php +++ b/vendor/ramsey/uuid/src/Provider/Node/NodeProviderCollection.php @@ -15,14 +15,15 @@ declare(strict_types=1); namespace Ramsey\Uuid\Provider\Node; use Ramsey\Collection\AbstractCollection; -use Ramsey\Collection\CollectionInterface; use Ramsey\Uuid\Provider\NodeProviderInterface; use Ramsey\Uuid\Type\Hexadecimal; /** * A collection of NodeProviderInterface objects + * + * @extends AbstractCollection<NodeProviderInterface> */ -class NodeProviderCollection extends AbstractCollection implements CollectionInterface +class NodeProviderCollection extends AbstractCollection { public function getType(): string { @@ -36,10 +37,11 @@ class NodeProviderCollection extends AbstractCollection implements CollectionInt * a UuidInterface instance * * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + * @psalm-suppress RedundantConditionGivenDocblockType */ public function unserialize($serialized): void { - /** @var mixed[] $data */ + /** @var array<array-key, NodeProviderInterface> $data */ $data = unserialize($serialized, [ 'allowed_classes' => [ Hexadecimal::class, @@ -49,6 +51,11 @@ class NodeProviderCollection extends AbstractCollection implements CollectionInt ], ]); - $this->data = $data; + $this->data = array_filter( + $data, + function ($unserialized): bool { + return $unserialized instanceof NodeProviderInterface; + } + ); } } diff --git a/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php b/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php index 266c0b738..76141361b 100644 --- a/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php +++ b/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php @@ -17,6 +17,7 @@ namespace Ramsey\Uuid\Provider\Node; use Ramsey\Uuid\Exception\RandomSourceException; use Ramsey\Uuid\Provider\NodeProviderInterface; use Ramsey\Uuid\Type\Hexadecimal; +use Throwable; use function bin2hex; use function dechex; @@ -38,7 +39,7 @@ class RandomNodeProvider implements NodeProviderInterface { try { $nodeBytes = random_bytes(6); - } catch (\Throwable $exception) { + } catch (Throwable $exception) { throw new RandomSourceException( $exception->getMessage(), (int) $exception->getCode(), diff --git a/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php b/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php index 8234abaee..d512f22aa 100644 --- a/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php +++ b/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php @@ -132,7 +132,7 @@ class SystemNodeProvider implements NodeProviderInterface $node = $matches[1][0] ?? ''; } - return (string) $node; + return $node; } /** diff --git a/vendor/ramsey/uuid/src/Rfc4122/Fields.php b/vendor/ramsey/uuid/src/Rfc4122/Fields.php index 0989d842a..2ccc20bb6 100644 --- a/vendor/ramsey/uuid/src/Rfc4122/Fields.php +++ b/vendor/ramsey/uuid/src/Rfc4122/Fields.php @@ -177,6 +177,7 @@ final class Fields implements FieldsInterface return null; } + /** @var array $parts */ $parts = unpack('n*', $this->bytes); return (int) $parts[4] >> 12; diff --git a/vendor/ramsey/uuid/src/Rfc4122/VariantTrait.php b/vendor/ramsey/uuid/src/Rfc4122/VariantTrait.php index c32a8ce80..4c981658f 100644 --- a/vendor/ramsey/uuid/src/Rfc4122/VariantTrait.php +++ b/vendor/ramsey/uuid/src/Rfc4122/VariantTrait.php @@ -58,6 +58,7 @@ trait VariantTrait throw new InvalidBytesException('Invalid number of bytes'); } + /** @var array $parts */ $parts = unpack('n*', $this->getBytes()); // $parts[5] is a 16-bit, unsigned integer containing the variant bits diff --git a/vendor/ramsey/uuid/src/Type/Decimal.php b/vendor/ramsey/uuid/src/Type/Decimal.php index 5ba886535..10f93845b 100644 --- a/vendor/ramsey/uuid/src/Type/Decimal.php +++ b/vendor/ramsey/uuid/src/Type/Decimal.php @@ -15,8 +15,10 @@ declare(strict_types=1); namespace Ramsey\Uuid\Type; use Ramsey\Uuid\Exception\InvalidArgumentException; +use ValueError; use function is_numeric; +use function sprintf; /** * A value object representing a decimal @@ -99,14 +101,37 @@ final class Decimal implements NumberInterface } /** + * @return array{string: string} + */ + public function __serialize(): array + { + return ['string' => $this->toString()]; + } + + /** * Constructs the object from a serialized string representation * * @param string $serialized The serialized string representation of the object * * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + * @psalm-suppress UnusedMethodCall */ public function unserialize($serialized): void { $this->__construct($serialized); } + + /** + * @param array{string: string} $data + */ + public function __unserialize(array $data): void + { + // @codeCoverageIgnoreStart + if (!isset($data['string'])) { + throw new ValueError(sprintf('%s(): Argument #1 ($data) is invalid', __METHOD__)); + } + // @codeCoverageIgnoreEnd + + $this->unserialize($data['string']); + } } diff --git a/vendor/ramsey/uuid/src/Type/Hexadecimal.php b/vendor/ramsey/uuid/src/Type/Hexadecimal.php index 11450186e..88adc2e7e 100644 --- a/vendor/ramsey/uuid/src/Type/Hexadecimal.php +++ b/vendor/ramsey/uuid/src/Type/Hexadecimal.php @@ -15,8 +15,10 @@ declare(strict_types=1); namespace Ramsey\Uuid\Type; use Ramsey\Uuid\Exception\InvalidArgumentException; +use ValueError; use function ctype_xdigit; +use function sprintf; use function strpos; use function strtolower; use function substr; @@ -78,14 +80,37 @@ final class Hexadecimal implements TypeInterface } /** + * @return array{string: string} + */ + public function __serialize(): array + { + return ['string' => $this->toString()]; + } + + /** * Constructs the object from a serialized string representation * * @param string $serialized The serialized string representation of the object * * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + * @psalm-suppress UnusedMethodCall */ public function unserialize($serialized): void { $this->__construct($serialized); } + + /** + * @param array{string: string} $data + */ + public function __unserialize(array $data): void + { + // @codeCoverageIgnoreStart + if (!isset($data['string'])) { + throw new ValueError(sprintf('%s(): Argument #1 ($data) is invalid', __METHOD__)); + } + // @codeCoverageIgnoreEnd + + $this->unserialize($data['string']); + } } diff --git a/vendor/ramsey/uuid/src/Type/Integer.php b/vendor/ramsey/uuid/src/Type/Integer.php index 05d420a85..7690f6cd8 100644 --- a/vendor/ramsey/uuid/src/Type/Integer.php +++ b/vendor/ramsey/uuid/src/Type/Integer.php @@ -15,9 +15,11 @@ declare(strict_types=1); namespace Ramsey\Uuid\Type; use Ramsey\Uuid\Exception\InvalidArgumentException; +use ValueError; use function ctype_digit; use function ltrim; +use function sprintf; use function strpos; use function substr; @@ -36,7 +38,7 @@ use function substr; final class Integer implements NumberInterface { /** - * @var string + * @psalm-var numeric-string */ private $value; @@ -80,7 +82,10 @@ final class Integer implements NumberInterface $this->isNegative = true; } - $this->value = $value; + /** @psalm-var numeric-string $numericValue */ + $numericValue = $value; + + $this->value = $numericValue; } public function isNegative(): bool @@ -88,6 +93,9 @@ final class Integer implements NumberInterface return $this->isNegative; } + /** + * @psalm-return numeric-string + */ public function toString(): string { return $this->value; @@ -109,14 +117,37 @@ final class Integer implements NumberInterface } /** + * @return array{string: string} + */ + public function __serialize(): array + { + return ['string' => $this->toString()]; + } + + /** * Constructs the object from a serialized string representation * * @param string $serialized The serialized string representation of the object * * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + * @psalm-suppress UnusedMethodCall */ public function unserialize($serialized): void { $this->__construct($serialized); } + + /** + * @param array{string: string} $data + */ + public function __unserialize(array $data): void + { + // @codeCoverageIgnoreStart + if (!isset($data['string'])) { + throw new ValueError(sprintf('%s(): Argument #1 ($data) is invalid', __METHOD__)); + } + // @codeCoverageIgnoreEnd + + $this->unserialize($data['string']); + } } diff --git a/vendor/ramsey/uuid/src/Type/Time.php b/vendor/ramsey/uuid/src/Type/Time.php index f6a140f05..dd1b8bc28 100644 --- a/vendor/ramsey/uuid/src/Type/Time.php +++ b/vendor/ramsey/uuid/src/Type/Time.php @@ -16,10 +16,12 @@ namespace Ramsey\Uuid\Type; use Ramsey\Uuid\Exception\UnsupportedOperationException; use Ramsey\Uuid\Type\Integer as IntegerObject; +use ValueError; use stdClass; use function json_decode; use function json_encode; +use function sprintf; /** * A value object representing a timestamp @@ -89,11 +91,23 @@ final class Time implements TypeInterface } /** + * @return array{seconds: string, microseconds: string} + */ + public function __serialize(): array + { + return [ + 'seconds' => $this->getSeconds()->toString(), + 'microseconds' => $this->getMicroseconds()->toString(), + ]; + } + + /** * Constructs the object from a serialized string representation * * @param string $serialized The serialized string representation of the object * * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + * @psalm-suppress UnusedMethodCall */ public function unserialize($serialized): void { @@ -108,4 +122,18 @@ final class Time implements TypeInterface $this->__construct($time->seconds, $time->microseconds); } + + /** + * @param array{seconds: string, microseconds: string} $data + */ + public function __unserialize(array $data): void + { + // @codeCoverageIgnoreStart + if (!isset($data['seconds']) || !isset($data['microseconds'])) { + throw new ValueError(sprintf('%s(): Argument #1 ($data) is invalid', __METHOD__)); + } + // @codeCoverageIgnoreEnd + + $this->__construct($data['seconds'], $data['microseconds']); + } } diff --git a/vendor/ramsey/uuid/src/Uuid.php b/vendor/ramsey/uuid/src/Uuid.php index 762dfdbae..945480ba4 100644 --- a/vendor/ramsey/uuid/src/Uuid.php +++ b/vendor/ramsey/uuid/src/Uuid.php @@ -23,9 +23,12 @@ use Ramsey\Uuid\Lazy\LazyUuidFromString; use Ramsey\Uuid\Rfc4122\FieldsInterface as Rfc4122FieldsInterface; use Ramsey\Uuid\Type\Hexadecimal; use Ramsey\Uuid\Type\Integer as IntegerObject; +use ValueError; +use function assert; use function bin2hex; use function preg_match; +use function sprintf; use function str_replace; use function strcmp; use function strlen; @@ -238,9 +241,9 @@ class Uuid implements UuidInterface * ``` * use Ramsey\Uuid\Uuid; * - * $timeBasedUuid = Uuid::uuid1(); - * $namespaceMd5Uuid = Uuid::uuid3(Uuid::NAMESPACE_URL, 'http://php.net/'); - * $randomUuid = Uuid::uuid4(); + * $timeBasedUuid = Uuid::uuid1(); + * $namespaceMd5Uuid = Uuid::uuid3(Uuid::NAMESPACE_URL, 'http://php.net/'); + * $randomUuid = Uuid::uuid4(); * $namespaceSha1Uuid = Uuid::uuid5(Uuid::NAMESPACE_URL, 'http://php.net/'); * ``` * @@ -285,7 +288,15 @@ class Uuid implements UuidInterface */ public function serialize(): string { - return $this->getBytes(); + return $this->getFields()->getBytes(); + } + + /** + * @return array{bytes: string} + */ + public function __serialize(): array + { + return ['bytes' => $this->serialize()]; } /** @@ -312,6 +323,20 @@ class Uuid implements UuidInterface $this->timeConverter = $uuid->timeConverter; } + /** + * @param array{bytes: string} $data + */ + public function __unserialize(array $data): void + { + // @codeCoverageIgnoreStart + if (!isset($data['bytes'])) { + throw new ValueError(sprintf('%s(): Argument #1 ($data) is invalid', __METHOD__)); + } + // @codeCoverageIgnoreEnd + + $this->unserialize($data['bytes']); + } + public function compareTo(UuidInterface $other): int { $compare = strcmp($this->toString(), $other->toString()); @@ -452,6 +477,8 @@ class Uuid implements UuidInterface public static function fromString(string $uuid): UuidInterface { if (! self::$factoryReplaced && preg_match(LazyUuidFromString::VALID_REGEX, $uuid) === 1) { + assert($uuid !== ''); + return new LazyUuidFromString(strtolower($uuid)); } diff --git a/vendor/ramsey/uuid/src/UuidFactory.php b/vendor/ramsey/uuid/src/UuidFactory.php index feddef88d..6f2cea061 100644 --- a/vendor/ramsey/uuid/src/UuidFactory.php +++ b/vendor/ramsey/uuid/src/UuidFactory.php @@ -471,10 +471,14 @@ class UuidFactory implements UuidFactoryInterface */ private function uuidFromBytesAndVersion(string $bytes, int $version): UuidInterface { - $timeHi = (int) unpack('n*', substr($bytes, 6, 2))[1]; + /** @var array $unpackedTime */ + $unpackedTime = unpack('n*', substr($bytes, 6, 2)); + $timeHi = (int) $unpackedTime[1]; $timeHiAndVersion = pack('n*', BinaryUtils::applyVersion($timeHi, $version)); - $clockSeqHi = (int) unpack('n*', substr($bytes, 8, 2))[1]; + /** @var array $unpackedClockSeq */ + $unpackedClockSeq = unpack('n*', substr($bytes, 8, 2)); + $clockSeqHi = (int) $unpackedClockSeq[1]; $clockSeqHiAndReserved = pack('n*', BinaryUtils::applyVariant($clockSeqHi)); $bytes = substr_replace($bytes, $timeHiAndVersion, 6, 2); diff --git a/vendor/ramsey/uuid/src/functions.php b/vendor/ramsey/uuid/src/functions.php index 7b29ec4b1..f5df1488d 100644 --- a/vendor/ramsey/uuid/src/functions.php +++ b/vendor/ramsey/uuid/src/functions.php @@ -29,7 +29,7 @@ use Ramsey\Uuid\Type\Integer as IntegerObject; * could arise when the clock is set backwards in time or if the node ID * changes * - * @return string Version 1 UUID as a string + * @return non-empty-string Version 1 UUID as a string */ function v1($node = null, ?int $clockSeq = null): string { @@ -52,7 +52,7 @@ function v1($node = null, ?int $clockSeq = null): string * that could arise when the clock is set backwards in time or if the * node ID changes * - * @return string Version 2 UUID as a string + * @return non-empty-string Version 2 UUID as a string */ function v2( int $localDomain, @@ -69,7 +69,10 @@ function v2( * * @param string|UuidInterface $ns The namespace (must be a valid UUID) * - * @return string Version 3 UUID as a string + * @return non-empty-string Version 3 UUID as a string + * + * @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, + * but under constant factory setups, this method operates in functionally pure manners */ function v3($ns, string $name): string { @@ -79,7 +82,7 @@ function v3($ns, string $name): string /** * Returns a version 4 (random) UUID * - * @return string Version 4 UUID as a string + * @return non-empty-string Version 4 UUID as a string */ function v4(): string { @@ -92,7 +95,10 @@ function v4(): string * * @param string|UuidInterface $ns The namespace (must be a valid UUID) * - * @return string Version 5 UUID as a string + * @return non-empty-string Version 5 UUID as a string + * + * @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, + * but under constant factory setups, this method operates in functionally pure manners */ function v5($ns, string $name): string { @@ -109,7 +115,7 @@ function v5($ns, string $name): string * could arise when the clock is set backwards in time or if the node ID * changes * - * @return string Version 6 UUID as a string + * @return non-empty-string Version 6 UUID as a string */ function v6(?Hexadecimal $node = null, ?int $clockSeq = null): string { |