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