diff --git a/src/Builder/DegradedUuidBuilder.php b/src/Builder/DegradedUuidBuilder.php index 18af18b..23931e4 100644 --- a/src/Builder/DegradedUuidBuilder.php +++ b/src/Builder/DegradedUuidBuilder.php @@ -61,6 +61,8 @@ class DegradedUuidBuilder implements UuidBuilderInterface * @param string $bytes The byte string from which to construct a UUID * * @return DegradedUuid The DegradedUuidBuild returns an instance of Ramsey\Uuid\DegradedUuid + * + * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface { diff --git a/src/Builder/FallbackBuilder.php b/src/Builder/FallbackBuilder.php index c2f7c10..cfd4665 100644 --- a/src/Builder/FallbackBuilder.php +++ b/src/Builder/FallbackBuilder.php @@ -48,6 +48,8 @@ class FallbackBuilder implements UuidBuilderInterface * @param string $bytes The byte string from which to construct a UUID * * @return UuidInterface an instance of a UUID object + * + * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface { diff --git a/src/Builder/UuidBuilderInterface.php b/src/Builder/UuidBuilderInterface.php index f9611cd..8e58b2b 100644 --- a/src/Builder/UuidBuilderInterface.php +++ b/src/Builder/UuidBuilderInterface.php @@ -32,6 +32,8 @@ interface UuidBuilderInterface * * @return UuidInterface Implementations may choose to return more specific * instances of UUIDs that implement UuidInterface + * + * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface; } diff --git a/src/Generator/DefaultNameGenerator.php b/src/Generator/DefaultNameGenerator.php index 0f8c43c..270e8fb 100644 --- a/src/Generator/DefaultNameGenerator.php +++ b/src/Generator/DefaultNameGenerator.php @@ -25,6 +25,7 @@ use function hash; */ class DefaultNameGenerator implements NameGeneratorInterface { + /** @psalm-pure */ public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string { /** @var string|bool $bytes */ diff --git a/src/Generator/NameGeneratorInterface.php b/src/Generator/NameGeneratorInterface.php index e064952..cc43dd0 100644 --- a/src/Generator/NameGeneratorInterface.php +++ b/src/Generator/NameGeneratorInterface.php @@ -31,6 +31,8 @@ interface NameGeneratorInterface * @param string $hashAlgorithm The hashing algorithm to use * * @return string A binary string + * + * @psalm-pure */ public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string; } diff --git a/src/Generator/PeclUuidNameGenerator.php b/src/Generator/PeclUuidNameGenerator.php index 55740ae..93b7868 100644 --- a/src/Generator/PeclUuidNameGenerator.php +++ b/src/Generator/PeclUuidNameGenerator.php @@ -30,6 +30,7 @@ use function uuid_parse; */ class PeclUuidNameGenerator implements NameGeneratorInterface { + /** @psalm-pure */ public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string { switch ($hashAlgorithm) { diff --git a/src/Guid/GuidBuilder.php b/src/Guid/GuidBuilder.php index b38eb82..758dd6b 100644 --- a/src/Guid/GuidBuilder.php +++ b/src/Guid/GuidBuilder.php @@ -62,6 +62,8 @@ class GuidBuilder implements UuidBuilderInterface * @param string $bytes The byte string from which to construct a UUID * * @return Guid The GuidBuilder returns an instance of Ramsey\Uuid\Guid\Guid + * + * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface { diff --git a/src/Nonstandard/UuidBuilder.php b/src/Nonstandard/UuidBuilder.php index e6750f6..0c89277 100644 --- a/src/Nonstandard/UuidBuilder.php +++ b/src/Nonstandard/UuidBuilder.php @@ -61,6 +61,8 @@ class UuidBuilder implements UuidBuilderInterface * * @return Uuid The Nonstandard\UuidBuilder returns an instance of * Nonstandard\Uuid + * + * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface { diff --git a/src/Rfc4122/UuidBuilder.php b/src/Rfc4122/UuidBuilder.php index e3de0f0..736931a 100644 --- a/src/Rfc4122/UuidBuilder.php +++ b/src/Rfc4122/UuidBuilder.php @@ -65,6 +65,8 @@ class UuidBuilder implements UuidBuilderInterface * @param string $bytes The byte string from which to construct a UUID * * @return Rfc4122UuidInterface UuidBuilder returns instances of Rfc4122UuidInterface + * + * @psalm-pure */ public function build(CodecInterface $codec, string $bytes): UuidInterface { diff --git a/src/UuidFactory.php b/src/UuidFactory.php index 0486d38..2d8b3a1 100644 --- a/src/UuidFactory.php +++ b/src/UuidFactory.php @@ -351,6 +351,7 @@ class UuidFactory implements UuidFactoryInterface /** * @inheritDoc + * @psalm-pure */ public function uuid3($ns, string $name): UuidInterface { @@ -366,6 +367,7 @@ class UuidFactory implements UuidFactoryInterface /** * @inheritDoc + * @psalm-pure */ public function uuid5($ns, string $name): UuidInterface { @@ -401,6 +403,8 @@ class UuidFactory implements UuidFactoryInterface * * @return UuidInterface An instance of UuidInterface, created from the * provided bytes + * + * @psalm-pure */ public function uuid(string $bytes): UuidInterface { @@ -418,6 +422,8 @@ class UuidFactory implements UuidFactoryInterface * * @return UuidInterface An instance of UuidInterface, created by hashing * together the provided namespace and name + * + * @psalm-pure */ private function uuidFromNsAndName($ns, string $name, int $version, string $hashAlgorithm): UuidInterface { @@ -438,6 +444,8 @@ class UuidFactory implements UuidFactoryInterface * * @return UuidInterface An instance of UuidInterface, created from the * byte string and version + * + * @psalm-pure */ private function uuidFromBytesAndVersion(string $bytes, int $version): UuidInterface { diff --git a/src/UuidFactoryInterface.php b/src/UuidFactoryInterface.php index d0b1045..468cc63 100644 --- a/src/UuidFactoryInterface.php +++ b/src/UuidFactoryInterface.php @@ -83,6 +83,8 @@ interface UuidFactoryInterface * * @return UuidInterface A UuidInterface instance that represents a * version 3 UUID + * + * @psalm-pure */ public function uuid3($ns, string $name): UuidInterface; @@ -103,6 +105,8 @@ interface UuidFactoryInterface * * @return UuidInterface A UuidInterface instance that represents a * version 5 UUID + * + * @psalm-pure */ public function uuid5($ns, string $name): UuidInterface; diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index fb34980..be0e7de 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -1,5 +1,5 @@ - + new DegradedTimeConverter() @@ -44,6 +44,13 @@ uuid_parse($uuid) + + + uuid_generate_md5 + uuid_generate_sha1 + uuid_parse + + shell_exec('id -u') @@ -54,23 +61,16 @@ - - $node + $macs - - $node + $node - - getNode - - - is_array($node) - - + + getFactory getFactory getFactory getFactory