Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 810e4a1

Browse files
[ErrorHandler] add missing return types
1 parent 7ec445b commit 810e4a1

File tree

2 files changed

+30
-16
lines changed

2 files changed

+30
-16
lines changed

src/Symfony/Component/ErrorHandler/ErrorHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@
4545
*
4646
* @author Nicolas Grekas <[email protected]>
4747
* @author Grégoire Pineau <[email protected]>
48+
*
49+
* @final
4850
*/
49-
final class ErrorHandler
51+
class ErrorHandler
5052
{
5153
private $levels = [
5254
E_DEPRECATED => 'Deprecated',

src/Symfony/Component/ErrorHandler/Exception/FlattenException.php

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static function createFromThrowable(\Throwable $exception, int $statusCod
8383
return $e;
8484
}
8585

86-
public function toArray()
86+
public function toArray(): array
8787
{
8888
$exceptions = [];
8989
foreach (array_merge([$this], $this->getAllPrevious()) as $exception) {
@@ -97,7 +97,7 @@ public function toArray()
9797
return $exceptions;
9898
}
9999

100-
public function getStatusCode()
100+
public function getStatusCode(): int
101101
{
102102
return $this->statusCode;
103103
}
@@ -112,7 +112,7 @@ public function setStatusCode($code): self
112112
return $this;
113113
}
114114

115-
public function getHeaders()
115+
public function getHeaders(): array
116116
{
117117
return $this->headers;
118118
}
@@ -127,7 +127,7 @@ public function setHeaders(array $headers): self
127127
return $this;
128128
}
129129

130-
public function getClass()
130+
public function getClass(): string
131131
{
132132
return $this->class;
133133
}
@@ -142,7 +142,7 @@ public function setClass($class): self
142142
return $this;
143143
}
144144

145-
public function getFile()
145+
public function getFile(): string
146146
{
147147
return $this->file;
148148
}
@@ -157,7 +157,7 @@ public function setFile($file): self
157157
return $this;
158158
}
159159

160-
public function getLine()
160+
public function getLine(): int
161161
{
162162
return $this->line;
163163
}
@@ -172,7 +172,7 @@ public function setLine($line): self
172172
return $this;
173173
}
174174

175-
public function getStatusText()
175+
public function getStatusText(): string
176176
{
177177
return $this->statusText;
178178
}
@@ -184,7 +184,7 @@ public function setStatusText(string $statusText): self
184184
return $this;
185185
}
186186

187-
public function getMessage()
187+
public function getMessage(): string
188188
{
189189
return $this->message;
190190
}
@@ -205,7 +205,7 @@ public function setMessage($message): self
205205
return $this;
206206
}
207207

208-
public function getCode()
208+
public function getCode(): int
209209
{
210210
return $this->code;
211211
}
@@ -220,6 +220,9 @@ public function setCode($code): self
220220
return $this;
221221
}
222222

223+
/**
224+
* @return self|null
225+
*/
223226
public function getPrevious()
224227
{
225228
return $this->previous;
@@ -235,7 +238,10 @@ final public function setPrevious(LegacyFlattenException $previous): self
235238
return $this;
236239
}
237240

238-
public function getAllPrevious()
241+
/**
242+
* @return self[]
243+
*/
244+
public function getAllPrevious(): array
239245
{
240246
$exceptions = [];
241247
$e = $this;
@@ -246,7 +252,7 @@ public function getAllPrevious()
246252
return $exceptions;
247253
}
248254

249-
public function getTrace()
255+
public function getTrace(): array
250256
{
251257
return $this->trace;
252258
}
@@ -261,7 +267,10 @@ public function setTraceFromException(\Exception $exception)
261267
$this->setTraceFromThrowable($exception);
262268
}
263269

264-
public function setTraceFromThrowable(\Throwable $throwable)
270+
/**
271+
* @return $this
272+
*/
273+
public function setTraceFromThrowable(\Throwable $throwable): self
265274
{
266275
$this->traceAsString = $throwable->getTraceAsString();
267276

@@ -351,19 +360,22 @@ private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value): str
351360
return $array['__PHP_Incomplete_Class_Name'];
352361
}
353362

354-
public function getTraceAsString()
363+
public function getTraceAsString(): ?string
355364
{
356365
return $this->traceAsString;
357366
}
358367

359-
public function setAsString(?string $asString)
368+
/**
369+
* @return $this
370+
*/
371+
public function setAsString(?string $asString): self
360372
{
361373
$this->asString = $asString;
362374

363375
return $this;
364376
}
365377

366-
public function getAsString()
378+
public function getAsString(): string
367379
{
368380
if (null !== $this->asString) {
369381
return $this->asString;

0 commit comments

Comments
 (0)