Conditions | 3 |
Paths | 4 |
Total Lines | 30 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
19 | 2 | public function showExceptionAction( |
|
20 | Request $request, |
||
21 | FlattenException $exception, |
||
22 | DebugLoggerInterface $logger = null |
||
23 | ) { |
||
24 | /** @var Translator $translator */ |
||
25 | 2 | $translator = $this->get('translator'); |
|
26 | 2 | $message = $translator->trans('error.messages.generic'); |
|
27 | |||
28 | // check if the error is whitelisted to overrule the message |
||
29 | 2 | if (in_array( |
|
30 | 2 | $exception->getClass(), |
|
31 | 2 | $this->container->getParameter('sumo_coders_framework_error.show_messages_for') |
|
32 | )) { |
||
33 | 1 | $message = $exception->getMessage(); |
|
34 | } |
||
35 | |||
36 | // translate page not found messages |
||
37 | 2 | if ('Symfony\Component\HttpKernel\Exception\NotFoundHttpException' == $exception->getClass()) { |
|
38 | 1 | $message = $translator->trans('error.messages.noRouteFound'); |
|
39 | } |
||
40 | |||
41 | 2 | return $this->render( |
|
42 | 2 | '::error.html.twig', |
|
43 | array( |
||
44 | 2 | 'status_code' => $exception->getStatusCode(), |
|
45 | 2 | 'status_text' => $message, |
|
46 | ) |
||
47 | ); |
||
48 | } |
||
49 | } |
||
50 |
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.