| Conditions | 5 |
| Paths | 4 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | 56 | public function hasChanged(): bool |
|
| 10 | { |
||
| 11 | 56 | if ($this->hasChanged) { |
|
|
|
|||
| 12 | 52 | return true; |
|
| 13 | } |
||
| 14 | |||
| 15 | 48 | foreach ($this->arguments as $argument) { |
|
| 16 | 48 | if ($argument instanceof MutationObject && $argument->hasChanged()) { |
|
| 17 | 44 | $this->hasChanged = true; |
|
| 18 | |||
| 19 | 44 | return true; |
|
| 20 | } |
||
| 21 | } |
||
| 22 | |||
| 23 | 24 | return false; |
|
| 24 | } |
||
| 25 | } |
||
| 26 |
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: