From 558009ce4ccd77d7f0a83cd0d64580b767ebd933 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sat, 18 May 2024 21:34:25 +0200 Subject: [PATCH] Prevent PHPStan error: 'Uuid::fromString() on a separate line has no effect.' (#552) Co-authored-by: Ben Ramsey --- src/Uuid.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Uuid.php b/src/Uuid.php index e0384a5..cce9943 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -19,6 +19,7 @@ use DateTimeInterface; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\TimeConverterInterface; +use Ramsey\Uuid\Exception\InvalidArgumentException; use Ramsey\Uuid\Exception\UnsupportedOperationException; use Ramsey\Uuid\Fields\FieldsInterface; use Ramsey\Uuid\Lazy\LazyUuidFromString; @@ -436,9 +437,10 @@ class Uuid implements UuidInterface * @return UuidInterface A UuidInterface instance created from a binary * string representation * + * @throws InvalidArgumentException + * * @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 - * * @psalm-suppress ImpureStaticProperty we know that the factory being replaced can lead to massive * havoc across all consumers: that should never happen, and * is generally to be discouraged. Until the factory is kept @@ -474,9 +476,10 @@ class Uuid implements UuidInterface * @return UuidInterface A UuidInterface instance created from a hexadecimal * string representation * + * @throws InvalidArgumentException + * * @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 - * * @psalm-suppress ImpureStaticProperty we know that the factory being replaced can lead to massive * havoc across all consumers: that should never happen, and * is generally to be discouraged. Until the factory is kept @@ -523,6 +526,8 @@ class Uuid implements UuidInterface * @return UuidInterface A UuidInterface instance created from the Hexadecimal * object representing a hexadecimal number * + * @throws InvalidArgumentException + * * @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 * @psalm-suppress MixedInferredReturnType,MixedReturnStatement @@ -550,6 +555,8 @@ class Uuid implements UuidInterface * @return UuidInterface A UuidInterface instance created from the string * representation of a 128-bit integer * + * @throws InvalidArgumentException + * * @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 */