[ErrorHandler] add missing return types

This commit is contained in:
Nicolas Grekas 2019-11-12 12:16:57 +01:00
parent 7ec445b130
commit 810e4a136f
2 changed files with 30 additions and 16 deletions

View File

@ -45,8 +45,10 @@ use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext;
* *
* @author Nicolas Grekas <p@tchwork.com> * @author Nicolas Grekas <p@tchwork.com>
* @author Grégoire Pineau <lyrixx@lyrixx.info> * @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @final
*/ */
final class ErrorHandler class ErrorHandler
{ {
private $levels = [ private $levels = [
E_DEPRECATED => 'Deprecated', E_DEPRECATED => 'Deprecated',

View File

@ -83,7 +83,7 @@ class FlattenException extends LegacyFlattenException
return $e; return $e;
} }
public function toArray() public function toArray(): array
{ {
$exceptions = []; $exceptions = [];
foreach (array_merge([$this], $this->getAllPrevious()) as $exception) { foreach (array_merge([$this], $this->getAllPrevious()) as $exception) {
@ -97,7 +97,7 @@ class FlattenException extends LegacyFlattenException
return $exceptions; return $exceptions;
} }
public function getStatusCode() public function getStatusCode(): int
{ {
return $this->statusCode; return $this->statusCode;
} }
@ -112,7 +112,7 @@ class FlattenException extends LegacyFlattenException
return $this; return $this;
} }
public function getHeaders() public function getHeaders(): array
{ {
return $this->headers; return $this->headers;
} }
@ -127,7 +127,7 @@ class FlattenException extends LegacyFlattenException
return $this; return $this;
} }
public function getClass() public function getClass(): string
{ {
return $this->class; return $this->class;
} }
@ -142,7 +142,7 @@ class FlattenException extends LegacyFlattenException
return $this; return $this;
} }
public function getFile() public function getFile(): string
{ {
return $this->file; return $this->file;
} }
@ -157,7 +157,7 @@ class FlattenException extends LegacyFlattenException
return $this; return $this;
} }
public function getLine() public function getLine(): int
{ {
return $this->line; return $this->line;
} }
@ -172,7 +172,7 @@ class FlattenException extends LegacyFlattenException
return $this; return $this;
} }
public function getStatusText() public function getStatusText(): string
{ {
return $this->statusText; return $this->statusText;
} }
@ -184,7 +184,7 @@ class FlattenException extends LegacyFlattenException
return $this; return $this;
} }
public function getMessage() public function getMessage(): string
{ {
return $this->message; return $this->message;
} }
@ -205,7 +205,7 @@ class FlattenException extends LegacyFlattenException
return $this; return $this;
} }
public function getCode() public function getCode(): int
{ {
return $this->code; return $this->code;
} }
@ -220,6 +220,9 @@ class FlattenException extends LegacyFlattenException
return $this; return $this;
} }
/**
* @return self|null
*/
public function getPrevious() public function getPrevious()
{ {
return $this->previous; return $this->previous;
@ -235,7 +238,10 @@ class FlattenException extends LegacyFlattenException
return $this; return $this;
} }
public function getAllPrevious() /**
* @return self[]
*/
public function getAllPrevious(): array
{ {
$exceptions = []; $exceptions = [];
$e = $this; $e = $this;
@ -246,7 +252,7 @@ class FlattenException extends LegacyFlattenException
return $exceptions; return $exceptions;
} }
public function getTrace() public function getTrace(): array
{ {
return $this->trace; return $this->trace;
} }
@ -261,7 +267,10 @@ class FlattenException extends LegacyFlattenException
$this->setTraceFromThrowable($exception); $this->setTraceFromThrowable($exception);
} }
public function setTraceFromThrowable(\Throwable $throwable) /**
* @return $this
*/
public function setTraceFromThrowable(\Throwable $throwable): self
{ {
$this->traceAsString = $throwable->getTraceAsString(); $this->traceAsString = $throwable->getTraceAsString();
@ -351,19 +360,22 @@ class FlattenException extends LegacyFlattenException
return $array['__PHP_Incomplete_Class_Name']; return $array['__PHP_Incomplete_Class_Name'];
} }
public function getTraceAsString() public function getTraceAsString(): ?string
{ {
return $this->traceAsString; return $this->traceAsString;
} }
public function setAsString(?string $asString) /**
* @return $this
*/
public function setAsString(?string $asString): self
{ {
$this->asString = $asString; $this->asString = $asString;
return $this; return $this;
} }
public function getAsString() public function getAsString(): string
{ {
if (null !== $this->asString) { if (null !== $this->asString) {
return $this->asString; return $this->asString;