| Total Complexity | 4 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class ClassBasedTraitTest extends UnitTestCase |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var ClassBasedTrait |
||
| 15 | */ |
||
| 16 | private $trait; |
||
| 17 | |||
| 18 | protected function setUp(): void |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @throws StorageException |
||
| 27 | */ |
||
| 28 | public function testSetClass(): void |
||
| 29 | { |
||
| 30 | $this->assertInstanceOf(get_class($this->trait), $this->trait->setClass(static::class)); |
||
| 31 | } |
||
| 32 | |||
| 33 | public function testSetClassFailed(): void |
||
| 34 | { |
||
| 35 | $wrongClass = static::class . 1; |
||
| 36 | |||
| 37 | $this->expectException(StorageException::class); |
||
| 38 | $this->expectExceptionMessage( |
||
| 39 | \sprintf('Class `%s` not exists. %s', $wrongClass, '') |
||
| 40 | ); |
||
| 41 | |||
| 42 | $this->trait->setClass($wrongClass); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @throws StorageException |
||
| 47 | */ |
||
| 48 | public function testGetClass(): void |
||
| 53 | } |
||
| 54 | } |
||
| 55 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..