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/uuid/src | |
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/uuid/src')
48 files changed, 314 insertions, 60 deletions
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 { |