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 | 76 | public function __construct($internalErrorMessage = null, LoggerInterface $logger = null, array $exceptionMap = []) |
|
| 34 | { |
||
| 35 | 76 | $this->logger = (null === $logger) ? new NullLogger() : $logger; |
|
| 36 | 76 | if (empty($internalErrorMessage)) { |
|
| 37 | 69 | $internalErrorMessage = self::DEFAULT_ERROR_MESSAGE; |
|
| 38 | } |
||
| 39 | 76 | $this->internalErrorMessage = $internalErrorMessage; |
|
| 40 | 76 | $this->exceptionMap = $exceptionMap; |
|
| 41 | 76 | } |
|
| 42 | |||
| 43 | 71 | public function setUserWarningClass($userWarningClass) |
|
| 44 | { |
||
| 45 | 71 | $this->userWarningClass = $userWarningClass; |
|
| 46 | |||
| 47 | 71 | return $this; |
|
| 48 | } |
||
| 49 | |||
| 50 | 71 | public function setUserErrorClass($userErrorClass) |
|
| 56 | |||
| 57 | /** |
||
| 58 | * @param GraphQLError[] $errors |
||
| 59 | * @param bool $throwRawException |
||
| 60 | * |
||
| 61 | * @return array |
||
| 62 | * |
||
| 63 | * @throws \Exception |
||
| 64 | */ |
||
| 65 | 62 | protected function treatExceptions(array $errors, $throwRawException) |
|
| 130 | |||
| 131 | /** |
||
| 132 | * @param \Exception|\Error $exception |
||
| 133 | * @param string $errorLevel |
||
| 134 | */ |
||
| 135 | 3 | public function logException($exception, $errorLevel = LogLevel::ERROR) |
|
| 148 | |||
| 149 | 62 | public function handleErrors(ExecutionResult $executionResult, $throwRawException = false) |
|
| 158 | |||
| 159 | /** |
||
| 160 | * Tries to convert a raw exception into a user warning or error |
||
| 161 | * that is displayed to the user. |
||
| 162 | * |
||
| 163 | * @param \Exception|\Error $rawException |
||
| 164 | * |
||
| 165 | * @return \Exception|\Error |
||
| 166 | */ |
||
| 167 | 17 | protected function convertException($rawException = null) |
|
| 182 | } |
||
| 183 |
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: