| 1 | <?php |
||
| 11 | class UUID extends StringLiteral |
||
| 12 | { |
||
| 13 | /** @var BaseUuid */ |
||
| 14 | protected $value; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param string $uuid |
||
|
|
|||
| 18 | * @return UUID |
||
| 19 | * @throws \ValueObjects\Exception\InvalidNativeArgumentException |
||
| 20 | */ |
||
| 21 | 1 | public static function fromNative() |
|
| 28 | |||
| 29 | /** |
||
| 30 | * Generate a new UUID string |
||
| 31 | * |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | 1 | public static function generateAsString() |
|
| 41 | |||
| 42 | 4 | public function __construct($value = null) |
|
| 43 | { |
||
| 44 | 4 | $uuid_str = BaseUuid::uuid4(); |
|
| 45 | |||
| 46 | 4 | if (null !== $value) { |
|
| 47 | 2 | $pattern = '/'.BaseUuid::VALID_PATTERN.'/'; |
|
| 48 | |||
| 49 | 2 | if (! \preg_match($pattern, $value)) { |
|
| 50 | 1 | throw new InvalidNativeArgumentException($value, array('UUID string')); |
|
| 51 | } |
||
| 52 | |||
| 53 | 1 | $uuid_str = $value; |
|
| 54 | 1 | } |
|
| 55 | |||
| 56 | 3 | $this->value = \strval($uuid_str); |
|
| 57 | 3 | } |
|
| 58 | |||
| 59 | /** |
||
| 60 | * Tells whether two UUID are equal by comparing their values |
||
| 61 | * |
||
| 62 | * @param UUID $uuid |
||
| 63 | * @return bool |
||
| 64 | */ |
||
| 65 | 2 | public function sameValueAs(ValueObjectInterface $uuid) |
|
| 73 | } |
||
| 74 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.