Issues (2)

src/OrderedUuidIdentityGenerator.php (1 issue)

Labels
Severity
1
<?php
2
3
/*
4
 * identity (https://github.com/phpgears/identity).
5
 * Identity objects for PHP.
6
 *
7
 * @license MIT
8
 * @link https://github.com/phpgears/identity
9
 * @author Julián Gutiérrez <[email protected]>
10
 */
11
12
declare(strict_types=1);
13
14
namespace Gears\Identity;
15
16
use Gears\Identity\Exception\UnsupportedIdentityException;
17
use Ramsey\Uuid\Uuid;
18
19
/**
20
 * UUID version 6 (ordered UUID) identity generator.
21
 */
22
class OrderedUuidIdentityGenerator implements IdentityGenerator
23
{
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @return UuidIdentity
28
     */
29
    public function generate()
30
    {
31
        if (!\interface_exists('Ramsey\Uuid\DeprecatedUuidInterface')) {
32
            throw new UnsupportedIdentityException(
33
                'Ordered UUID (version 6) not available. Update ramsey/uuid to version ^4.0.'
34
            );
35
        }
36
37
        return UuidIdentity::fromString(Uuid::uuid6()->toString());
0 ignored issues
show
The method uuid6() does not exist on Ramsey\Uuid\Uuid. Did you maybe mean uuid3()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
        return UuidIdentity::fromString(Uuid::/** @scrutinizer ignore-call */ uuid6()->toString());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
    }
39
}
40