We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
12 | class ErrorHandler |
||
13 | { |
||
14 | const DEFAULT_ERROR_MESSAGE = 'Internal server Error'; |
||
15 | const DEFAULT_USER_WARNING_CLASS = UserWarning::class; |
||
16 | const DEFAULT_USER_ERROR_CLASS = UserError::class; |
||
17 | |||
18 | /** @var LoggerInterface */ |
||
19 | private $logger; |
||
20 | |||
21 | /** @var string */ |
||
22 | private $internalErrorMessage; |
||
23 | |||
24 | /** @var array */ |
||
25 | private $exceptionMap; |
||
26 | |||
27 | /** @var string */ |
||
28 | private $userWarningClass = self::DEFAULT_USER_WARNING_CLASS; |
||
29 | |||
30 | /** @var string */ |
||
31 | private $userErrorClass = self::DEFAULT_USER_ERROR_CLASS; |
||
32 | |||
33 | /** @var bool */ |
||
34 | private $mapExceptionsToParent; |
||
35 | |||
36 | 83 | public function __construct( |
|
37 | $internalErrorMessage = null, |
||
38 | LoggerInterface $logger = null, |
||
39 | array $exceptionMap = [], |
||
40 | $mapExceptionsToParent = false |
||
41 | ) { |
||
42 | 83 | $this->logger = (null === $logger) ? new NullLogger() : $logger; |
|
43 | 83 | if (empty($internalErrorMessage)) { |
|
44 | 76 | $internalErrorMessage = self::DEFAULT_ERROR_MESSAGE; |
|
45 | } |
||
46 | 83 | $this->internalErrorMessage = $internalErrorMessage; |
|
47 | 83 | $this->exceptionMap = $exceptionMap; |
|
48 | 83 | $this->mapExceptionsToParent = $mapExceptionsToParent; |
|
49 | 83 | } |
|
50 | |||
51 | 71 | public function setUserWarningClass($userWarningClass) |
|
57 | |||
58 | 71 | public function setUserErrorClass($userErrorClass) |
|
64 | |||
65 | /** |
||
66 | * @param GraphQLError[] $errors |
||
67 | * @param bool $throwRawException |
||
68 | * |
||
69 | * @return array |
||
70 | * |
||
71 | * @throws \Exception |
||
72 | */ |
||
73 | 69 | protected function treatExceptions(array $errors, $throwRawException) |
|
138 | |||
139 | /** |
||
140 | * @param \Exception|\Error $exception |
||
141 | * @param string $errorLevel |
||
142 | */ |
||
143 | 9 | public function logException($exception, $errorLevel = LogLevel::ERROR) |
|
156 | |||
157 | 69 | public function handleErrors(ExecutionResult $executionResult, $throwRawException = false) |
|
166 | |||
167 | /** |
||
168 | * Tries to convert a raw exception into a user warning or error |
||
169 | * that is displayed to the user. |
||
170 | * |
||
171 | * @param \Exception|\Error $rawException |
||
172 | * |
||
173 | * @return \Exception|\Error |
||
174 | */ |
||
175 | 24 | protected function convertException($rawException = null) |
|
188 | |||
189 | /** |
||
190 | * @param \Exception|\Error $rawException |
||
191 | * |
||
192 | * @return string|null |
||
193 | */ |
||
194 | 16 | private function findErrorClass($rawException) |
|
207 | |||
208 | /** |
||
209 | * @param \Exception|\Error $rawException |
||
210 | * |
||
211 | * @return string|null |
||
212 | */ |
||
213 | 1 | private function findErrorClassUsingParentException($rawException) |
|
223 | } |
||
224 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: