| Conditions | 2 |
| Paths | 2 |
| Total Lines | 6 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | 1 | public function assertTraitExists($expected, $object, $message = '') |
|
| 32 | { |
||
| 33 | 1 | $traits = class_uses($object); |
|
| 34 | 1 | $message = $message ?: sprintf("Failed asserting not exists Trait instance of interface '%s'.", $expected); |
|
| 35 | 1 | PHPUnit::assertArrayHasKey($expected, $traits, $message); |
|
| 36 | 1 | } |
|
| 37 | |||
| 53 |
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: