inspirum /
balikobot-php
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Inspirum\Balikobot\Model\Service; |
||
| 6 | |||
| 7 | use Inspirum\Arrayable\BaseModel; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * @extends \Inspirum\Arrayable\BaseModel<string,string> |
||
| 11 | */ |
||
| 12 | final class DefaultServiceOption extends BaseModel implements ServiceOption |
||
| 13 | { |
||
| 14 | 7 | public function __construct( |
|
| 15 | private readonly string $code, |
||
| 16 | private readonly string $name, |
||
| 17 | ) { |
||
| 18 | 7 | } |
|
| 19 | |||
| 20 | 1 | public function getCode(): string |
|
| 21 | { |
||
| 22 | 1 | return $this->code; |
|
| 23 | } |
||
| 24 | |||
| 25 | 1 | public function getName(): string |
|
| 26 | { |
||
| 27 | 1 | return $this->name; |
|
| 28 | } |
||
| 29 | |||
| 30 | /** @inheritDoc */ |
||
| 31 | 4 | public function __toArray(): array |
|
| 32 | { |
||
| 33 | 4 | return [ |
|
|
0 ignored issues
–
show
|
|||
| 34 | 4 | 'code' => $this->code, |
|
| 35 | 4 | 'name' => $this->name, |
|
| 36 | 4 | ]; |
|
| 37 | } |
||
| 38 | } |
||
| 39 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: