diff --git a/src/Lazy/LazyUuidFromString.php b/src/Lazy/LazyUuidFromString.php index fd15b14..0ea9b19 100644 --- a/src/Lazy/LazyUuidFromString.php +++ b/src/Lazy/LazyUuidFromString.php @@ -24,6 +24,7 @@ use Ramsey\Uuid\Type\Hexadecimal; use Ramsey\Uuid\Type\Integer as IntegerObject; use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; + use function assert; use function hex2bin; use function str_replace; @@ -33,10 +34,10 @@ use function str_replace; * conversion. This object optimizes instantiation, serialization and string conversion time, at the cost of * increased overhead for more advanced UUID operations. * - * @psalm-immutable - * * @internal this type is used internally for performance reasons, and is not supposed to be directly referenced * in consumer libraries. + * + * @psalm-immutable */ final class LazyUuidFromString implements UuidInterface { @@ -56,6 +57,7 @@ final class LazyUuidFromString implements UuidInterface return $this->uuid; } + /** {@inheritDoc} */ public function unserialize($serialized): void { $this->uuid = $serialized; @@ -67,6 +69,7 @@ final class LazyUuidFromString implements UuidInterface ->getNumberConverter(); } + /** {@inheritDoc} */ public function getFieldsHex(): array { return $this->unwrap() diff --git a/src/Uuid.php b/src/Uuid.php index 3742caf..d7c70ea 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -389,6 +389,7 @@ class Uuid implements UuidInterface { // Note: non-string equality is intentional here. If the factory is configured differently, every assumption // around purity is broken, and we have to internally decide everything differently. + // phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators.DisallowedNotEqualOperator self::$factoryReplaced = ($factory != new UuidFactory()); self::$factory = $factory; @@ -411,7 +412,7 @@ class Uuid implements UuidInterface $base16Uuid = bin2hex($bytes); return self::fromString( - substr($base16Uuid,0, 8) + substr($base16Uuid, 0, 8) . '-' . substr($base16Uuid, 8, 4) . '-' diff --git a/tests/UuidTest.php b/tests/UuidTest.php index 7e8551b..ef46a3a 100644 --- a/tests/UuidTest.php +++ b/tests/UuidTest.php @@ -24,12 +24,10 @@ use Ramsey\Uuid\Generator\CombGenerator; use Ramsey\Uuid\Generator\RandomGeneratorFactory; use Ramsey\Uuid\Generator\RandomGeneratorInterface; use Ramsey\Uuid\Guid\Guid; -use Ramsey\Uuid\Nonstandard\Uuid as NonstandardUuid; use Ramsey\Uuid\Nonstandard\UuidV6; use Ramsey\Uuid\Provider\Node\RandomNodeProvider; use Ramsey\Uuid\Provider\Time\FixedTimeProvider; use Ramsey\Uuid\Rfc4122\FieldsInterface; -use Ramsey\Uuid\Rfc4122\NilUuid; use Ramsey\Uuid\Rfc4122\UuidV1; use Ramsey\Uuid\Rfc4122\UuidV2; use Ramsey\Uuid\Rfc4122\UuidV3; diff --git a/tests/benchmark/UuidStringConversionBench.php b/tests/benchmark/UuidStringConversionBench.php index ca05de6..8703550 100644 --- a/tests/benchmark/UuidStringConversionBench.php +++ b/tests/benchmark/UuidStringConversionBench.php @@ -16,6 +16,7 @@ namespace Ramsey\Uuid\Benchmark; use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; + use function array_map; final class UuidStringConversionBench @@ -132,31 +133,26 @@ final class UuidStringConversionBench private $uuid; /** * @var UuidInterface - * * @psalm-var non-empty-list */ private $promiscuousUuids; /** * @var string - * * @psalm-var non-empty-string */ private $tinyUuidBytes; /** * @var string - * * @psalm-var non-empty-string */ private $hugeUuidBytes; /** * @var string - * * @psalm-var non-empty-string */ private $uuidBytes; /** * @var string - * * @psalm-var non-empty-list */ private $promiscuousUuidsBytes;