Conditions | 5 |
Paths | 4 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
9 | 32 | public function hasChanged(): bool |
|
10 | { |
||
11 | 32 | if ($this->hasChanged) { |
|
|
|||
12 | 28 | return true; |
|
13 | } |
||
14 | |||
15 | 32 | foreach ($this->arguments as $argument) { |
|
16 | 32 | if ($argument instanceof MutationObject && $argument->hasChanged()) { |
|
17 | 28 | $this->hasChanged = true; |
|
18 | |||
19 | 32 | return true; |
|
20 | } |
||
21 | } |
||
22 | |||
23 | 16 | return false; |
|
24 | } |
||
25 | |||
36 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: