← All changes
|
includes/sdk/google/ramsey/uuid/src/Fields/SerializableFieldsTrait.php
+14
-17
1.2.5
→
1.4.2
View file →
| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | * @copyright Copyright (c) Ben Ramsey <[email protected]> |
| 10 | 10 | * @license http://opensource.org/licenses/MIT MIT |
| 11 | 11 | */ |
| 12 | 12 | declare (strict_types=1); |
| 13 | -namespace Dudlewebs\WPMCS\Ramsey\Uuid\Fields; | |
| 13 | +namespace Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Fields; | |
| 14 | 14 | |
| 15 | 15 | use ValueError; |
| 16 | 16 | use function base64_decode; |
| 17 | 17 | use function sprintf; |
| @@ -18,9 +18,9 @@ | ||
| 18 | 18 | use function strlen; |
| 19 | 19 | /** |
| 20 | 20 | * Provides common serialization functionality to fields |
| 21 | 21 | * |
| 22 | - * @psalm-immutable | |
| 22 | + * @immutable | |
| 23 | 23 | */ |
| 24 | 24 | trait SerializableFieldsTrait |
| 25 | 25 | { |
| 26 | 26 | /** |
| @@ -25,17 +25,17 @@ | ||
| 25 | 25 | { |
| 26 | 26 | /** |
| 27 | 27 | * @param string $bytes The bytes that comprise the fields |
| 28 | 28 | */ |
| 29 | - abstract public function __construct(string $bytes); | |
| 29 | + public abstract function __construct(string $bytes); | |
| 30 | 30 | /** |
| 31 | 31 | * Returns the bytes that comprise the fields |
| 32 | 32 | */ |
| 33 | - abstract public function getBytes(): string; | |
| 33 | + public abstract function getBytes() : string; | |
| 34 | 34 | /** |
| 35 | - * Returns a string representation of object | |
| 35 | + * Returns a string representation of the object | |
| 36 | 36 | */ |
| 37 | - public function serialize(): string | |
| 37 | + public function serialize() : string | |
| 38 | 38 | { |
| 39 | 39 | return $this->getBytes(); |
| 40 | 40 | } |
| 41 | 41 | /** |
| @@ -40,9 +40,9 @@ | ||
| 40 | 40 | } |
| 41 | 41 | /** |
| 42 | 42 | * @return array{bytes: string} |
| 43 | 43 | */ |
| 44 | - public function __serialize(): array | |
| 44 | + public function __serialize() : array | |
| 45 | 45 | { |
| 46 | 46 | return ['bytes' => $this->getBytes()]; |
| 47 | 47 | } |
| 48 | 48 | /** |
| @@ -47,25 +47,22 @@ | ||
| 47 | 47 | } |
| 48 | 48 | /** |
| 49 | 49 | * Constructs the object from a serialized string representation |
| 50 | 50 | * |
| 51 | - * @param string $serialized The serialized string representation of the object | |
| 52 | - * | |
| 53 | - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint | |
| 54 | - * @psalm-suppress UnusedMethodCall | |
| 51 | + * @param string $data The serialized string representation of the object | |
| 55 | 52 | */ |
| 56 | - public function unserialize($serialized): void | |
| 53 | + public function unserialize(string $data) : void | |
| 57 | 54 | { |
| 58 | - if (strlen($serialized) === 16) { | |
| 59 | - $this->__construct($serialized); | |
| 55 | + if (strlen($data) === 16) { | |
| 56 | + $this->__construct($data); | |
| 60 | 57 | } else { |
| 61 | - $this->__construct(base64_decode($serialized)); | |
| 58 | + $this->__construct(base64_decode($data)); | |
| 62 | 59 | } |
| 63 | 60 | } |
| 64 | 61 | /** |
| 65 | - * @param array{bytes: string} $data | |
| 62 | + * @param array{bytes?: string} $data | |
| 66 | 63 | */ |
| 67 | - public function __unserialize(array $data): void | |
| 64 | + public function __unserialize(array $data) : void | |
| 68 | 65 | { |
| 69 | 66 | // @codeCoverageIgnoreStart |
| 70 | 67 | if (!isset($data['bytes'])) { |
| 71 | 68 | throw new ValueError(sprintf('%s(): Argument #1 ($data) is invalid', __METHOD__)); |