Issues (27)

src/Model/Error.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VasilDakov\Econt\Model;
6
7
use JMS\Serializer\Annotation as Serializer;
8
use VasilDakov\Econt\Constants;
9
10
final readonly class Error
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_READONLY, expecting T_CLASS on line 10 at column 6
Loading history...
11
{
12
    public function __construct(
13
        #[Serializer\Type('string')]
14
        public ?string $type = null,
15
16
        #[Serializer\Type('string')]
17
        public ?string $message = null,
18
19
        #[Serializer\Type('string')]
20
        public ?string $fields = null,
21
22
        #[Serializer\Type('string')]
23
        public ?string $innerErrors = null,
24
    ) {
25
26
    }
27
28
    public function toArray(): array
29
    {
30
        return [
31
            Constants::TYPE => $this->type,
32
            Constants::MESSAGE => $this->message,
33
            Constants::FIELDS => $this->fields,
34
            Constants::INNER_ERRORS => $this->innerErrors
35
        ];
36
    }
37
}