1 | <?php |
||
11 | class Result implements Arrayable, Jsonable |
||
12 | { |
||
13 | /** |
||
14 | * @var bool |
||
15 | */ |
||
16 | private $success; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $error; |
||
22 | |||
23 | /** |
||
24 | * @var string[] |
||
25 | */ |
||
26 | private $messages; |
||
27 | |||
28 | /** |
||
29 | * @var null|stdClass |
||
30 | */ |
||
31 | private $data; |
||
32 | |||
33 | /** |
||
34 | * Result constructor. |
||
35 | * |
||
36 | * @param bool $success |
||
37 | * @param string $error |
||
38 | * @param string[] $messages |
||
39 | * @param mixed $extra |
||
40 | */ |
||
41 | public function __construct( |
||
52 | |||
53 | /** |
||
54 | * @return bool |
||
55 | */ |
||
56 | public function isSuccess(): bool |
||
60 | |||
61 | /** |
||
62 | * @param bool $success |
||
63 | * |
||
64 | * @return self |
||
65 | */ |
||
66 | public function setSuccess(bool $success): self |
||
73 | |||
74 | /** |
||
75 | * @return string |
||
76 | */ |
||
77 | public function getError(): string |
||
81 | |||
82 | /** |
||
83 | * @param string $error |
||
84 | * |
||
85 | * @return self |
||
86 | */ |
||
87 | public function setError(string $error): self |
||
95 | |||
96 | /** |
||
97 | * @return null|stdClass |
||
98 | */ |
||
99 | public function getData(): ?stdClass |
||
103 | |||
104 | /** |
||
105 | * @param stdClass $data |
||
106 | * |
||
107 | * @return self |
||
108 | */ |
||
109 | public function setData(stdClass $data): self |
||
116 | |||
117 | /** |
||
118 | * @return string |
||
119 | */ |
||
120 | public function getMessage(): string |
||
124 | |||
125 | /** |
||
126 | * @param string $message |
||
127 | * |
||
128 | * @return self |
||
129 | */ |
||
130 | public function setMessage(string $message): self |
||
134 | |||
135 | /** |
||
136 | * @return string[] |
||
137 | */ |
||
138 | public function getMessages(): array |
||
142 | |||
143 | /** |
||
144 | * @param string ...$messages |
||
145 | * |
||
146 | * @return self |
||
147 | */ |
||
|
|||
148 | public function setMessages(string ...$messages): self |
||
155 | |||
156 | /** |
||
157 | * @param string $message |
||
158 | * |
||
159 | * @return self |
||
160 | */ |
||
161 | public function addMessage(string $message): self |
||
168 | |||
169 | /** |
||
170 | * {@inheritdoc} |
||
171 | * |
||
172 | * @return array |
||
173 | */ |
||
174 | public function toArray() |
||
178 | |||
179 | /** |
||
180 | * {@inheritdoc} |
||
181 | * |
||
182 | * @param int $options |
||
183 | * |
||
184 | * @return string |
||
185 | */ |
||
186 | public function toJson($options = 0) |
||
190 | } |
||
191 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.