← All changes
|
includes/sdk/google/ramsey/uuid/src/Builder/FallbackBuilder.php
+12
-19
1.2.4
→
1.4.2
View file →
| @@ -9,36 +9,29 @@ | ||
| 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\Builder; | |
| 13 | +namespace Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Builder; | |
| 14 | 14 | |
| 15 | -use Dudlewebs\WPMCS\Ramsey\Uuid\Codec\CodecInterface; | |
| 16 | -use Dudlewebs\WPMCS\Ramsey\Uuid\Exception\BuilderNotFoundException; | |
| 17 | -use Dudlewebs\WPMCS\Ramsey\Uuid\Exception\UnableToBuildUuidException; | |
| 18 | -use Dudlewebs\WPMCS\Ramsey\Uuid\UuidInterface; | |
| 15 | +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Codec\CodecInterface; | |
| 16 | +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Exception\BuilderNotFoundException; | |
| 17 | +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Exception\UnableToBuildUuidException; | |
| 18 | +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\UuidInterface; | |
| 19 | 19 | /** |
| 20 | - * FallbackBuilder builds a UUID by stepping through a list of UUID builders | |
| 21 | - * until a UUID can be constructed without exceptions | |
| 20 | + * FallbackBuilder builds a UUID by stepping through a list of UUID builders until a UUID can be constructed without exceptions | |
| 22 | 21 | * |
| 23 | - * @psalm-immutable | |
| 22 | + * @immutable | |
| 24 | 23 | */ |
| 25 | 24 | class FallbackBuilder implements UuidBuilderInterface |
| 26 | 25 | { |
| 27 | 26 | /** |
| 28 | - * @var BuilderCollection | |
| 27 | + * @param iterable<UuidBuilderInterface> $builders An array of UUID builders | |
| 29 | 28 | */ |
| 30 | - private $builders; | |
| 31 | - /** | |
| 32 | - * @param BuilderCollection $builders An array of UUID builders | |
| 33 | - */ | |
| 34 | - public function __construct(BuilderCollection $builders) | |
| 29 | + public function __construct(private iterable $builders) | |
| 35 | 30 | { |
| 36 | - $this->builders = $builders; | |
| 37 | 31 | } |
| 38 | 32 | /** |
| 39 | - * Builds and returns a UuidInterface instance using the first builder that | |
| 40 | - * succeeds | |
| 33 | + * Builds and returns a UuidInterface instance using the first builder that succeeds | |
| 41 | 34 | * |
| 42 | 35 | * @param CodecInterface $codec The codec to use for building this instance |
| 43 | 36 | * @param string $bytes The byte string from which to construct a UUID |
| 44 | 37 | * |
| @@ -43,11 +36,11 @@ | ||
| 43 | 36 | * @param string $bytes The byte string from which to construct a UUID |
| 44 | 37 | * |
| 45 | 38 | * @return UuidInterface an instance of a UUID object |
| 46 | 39 | * |
| 47 | - * @psalm-pure | |
| 40 | + * @pure | |
| 48 | 41 | */ |
| 49 | - public function build(CodecInterface $codec, string $bytes): UuidInterface | |
| 42 | + public function build(CodecInterface $codec, string $bytes) : UuidInterface | |
| 50 | 43 | { |
| 51 | 44 | $lastBuilderException = null; |
| 52 | 45 | foreach ($this->builders as $builder) { |
| 53 | 46 | try { |