ebs/src/Faker/Provider/UuidProvider.php
2023-12-21 08:49:38 +01:00

19 lines
431 B
PHP

<?php
declare(strict_types=1);
namespace App\Faker\Provider;
use Faker\Provider\Base as BaseProvider;
use Symfony\Component\Uid\Uuid;
/**
* Allows to always use the same uuid so the tests are easier to write and indempotent.
*/
final class UuidProvider extends BaseProvider
{
public function uuid(?string $provided = null): Uuid
{
return $provided === null ? Uuid::v6() : Uuid::fromString($provided);
}
}