| Total Complexity | 3 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class ValueObject |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Convenient method to create a value object statically. |
||
| 11 | * |
||
| 12 | * @param mixed $values |
||
| 13 | * |
||
| 14 | * @return static |
||
| 15 | */ |
||
| 16 | 19 | public static function make(...$values): static |
|
| 17 | { |
||
| 18 | 19 | return new static(...$values); |
|
|
|
|||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param string $name |
||
| 23 | * @param mixed $value |
||
| 24 | * |
||
| 25 | * @return void |
||
| 26 | */ |
||
| 27 | 4 | public function __set(string $name, mixed $value): void |
|
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Check if objects are instances of same class |
||
| 34 | * and share the same properties and values. |
||
| 35 | * |
||
| 36 | * @param ValueObject $object |
||
| 37 | * |
||
| 38 | * @return bool |
||
| 39 | */ |
||
| 40 | 1 | public function equals(ValueObject $object): bool |
|
| 43 | } |
||
| 44 | } |
||
| 45 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.