Skip to content

Commit 7534f37

Browse files
authored
Merge pull request #2 from Cocolabs-SAS/bugfix/COCO-3689
COCO-3689 Fixed PHP warning
2 parents c4f99b0 + 54387fe commit 7534f37

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/EventListener/ExceptionListener.php

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,26 +62,14 @@ public function onKernelException(ExceptionEvent $event, string $eventName = nul
6262
parent::onKernelException($event);
6363
}
6464

65-
/**
66-
* @return Response
67-
*/
68-
public function showExceptionPageAction(FlattenException $exception)
65+
public function showExceptionPageAction(FlattenException $exception): Response
6966
{
70-
$entityConfig = isset($this->easyAdminConfig['entities'][$this->currentEntityName])
71-
? $this->easyAdminConfig['entities'][$this->currentEntityName] : null;
72-
$exceptionTemplatePath = isset($entityConfig['templates']['exception'])
73-
? $entityConfig['templates']['exception']
74-
: (
75-
isset($this->easyAdminConfig['design']['templates']['exception'])
76-
? $this->easyAdminConfig['design']['templates']['exception']
77-
: '@EasyAdmin/default/exception.html.twig'
67+
$entityConfig = $this->easyAdminConfig['entities'][$this->currentEntityName] ?? null;
68+
$exceptionTemplatePath = $entityConfig['templates']['exception'] ?? (
69+
$this->easyAdminConfig['design']['templates']['exception'] ?? '@EasyAdmin/default/exception.html.twig'
7870
);
79-
$exceptionLayoutTemplatePath = isset($entityConfig['templates']['layout'])
80-
? $entityConfig['templates']['layout']
81-
: (
82-
isset($this->easyAdminConfig['design']['templates']['layout'])
83-
? $this->easyAdminConfig['design']['templates']['layout']
84-
: '@EasyAdmin/default/layout.html.twig'
71+
$exceptionLayoutTemplatePath = $entityConfig['templates']['layout'] ?? (
72+
$this->easyAdminConfig['design']['templates']['layout'] ?? '@EasyAdmin/default/layout.html.twig'
8573
);
8674

8775
return new Response($this->twig->render($exceptionTemplatePath, [
@@ -90,7 +78,7 @@ public function showExceptionPageAction(FlattenException $exception)
9078
]), $exception->getStatusCode());
9179
}
9280

93-
protected function logException(Throwable $exception, string $message): void
81+
protected function logException(Throwable $exception, string $message, string $logLevel = null): void
9482
{
9583
if (!$exception instanceof BaseException) {
9684
parent::logException($exception, $message);

0 commit comments

Comments
 (0)