Total Complexity | 4 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait HasDuskReporter |
||
8 | { |
||
9 | public ?ReportFileContract $duskReporter = null; |
||
10 | |||
11 | /** |
||
12 | * Get dusk reporter instance. |
||
13 | * |
||
14 | * @return ReportFileContract|null |
||
15 | */ |
||
16 | public function duskReporter(): ?ReportFileContract |
||
17 | { |
||
18 | return $this->duskReporter; |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * Check is object has dusk reporter. |
||
23 | * |
||
24 | * @return bool |
||
25 | */ |
||
26 | public function hasDuskReporter(): bool |
||
27 | { |
||
28 | return !is_null($this->duskReporter()); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Set dusk reporter to object. |
||
33 | * |
||
34 | * @param ReportFileContract|null $reporter |
||
35 | * |
||
36 | * @return $this |
||
37 | */ |
||
38 | public function setDuskReporter(?ReportFileContract $reporter): static |
||
39 | { |
||
40 | $this->duskReporter = $reporter; |
||
41 | |||
42 | return $this; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Initialise instance with dusk reporter. |
||
47 | * |
||
48 | * @param ReportFileContract $reporter |
||
49 | * @param array $params |
||
50 | * |
||
51 | * @return static |
||
52 | */ |
||
53 | public static function makeWithDuskReporter(ReportFileContract $reporter, array $params = []): static |
||
56 | } |
||
57 | } |
||
58 |
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.