Skip to content

Commit 5c25a79

Browse files
committed
Simplify exception logical condition
When rendering the custom exception page, we test if the MissingRequiredAttributeException. But it also had to be a HTTP exception. That was never the case (also before #313). By removing the first part of the statement, the error message is displayed correctly once again.
1 parent e4bb4c5 commit 5c25a79

File tree

2 files changed

+1
-32
lines changed

2 files changed

+1
-32
lines changed

ci/qa/phpstan-baseline.php

-30
Original file line numberDiff line numberDiff line change
@@ -301,41 +301,11 @@
301301
'count' => 1,
302302
'path' => __DIR__ . '/../../src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/EntryPointController.php',
303303
];
304-
$ignoreErrors[] = [
305-
'message' => '#^Instanceof between Symfony\\\\Component\\\\HttpKernel\\\\Exception\\\\HttpException and Surfnet\\\\StepupSelfService\\\\SelfServiceBundle\\\\Exception\\\\MissingRequiredAttributeException will always evaluate to false\\.$#',
306-
'count' => 1,
307-
'path' => __DIR__ . '/../../src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/ExceptionController.php',
308-
];
309304
$ignoreErrors[] = [
310305
'message' => '#^Method Surfnet\\\\StepupSelfService\\\\SelfServiceBundle\\\\Controller\\\\ExceptionController\\:\\:getPageTitleAndDescription\\(\\) return type has no value type specified in iterable type array\\.$#',
311306
'count' => 1,
312307
'path' => __DIR__ . '/../../src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/ExceptionController.php',
313308
];
314-
$ignoreErrors[] = [
315-
'message' => '#^Result of && is always false\\.$#',
316-
'count' => 2,
317-
'path' => __DIR__ . '/../../src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/ExceptionController.php',
318-
];
319-
$ignoreErrors[] = [
320-
'message' => '#^Undefined variable\\: \\$description$#',
321-
'count' => 1,
322-
'path' => __DIR__ . '/../../src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/ExceptionController.php',
323-
];
324-
$ignoreErrors[] = [
325-
'message' => '#^Undefined variable\\: \\$title$#',
326-
'count' => 1,
327-
'path' => __DIR__ . '/../../src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/ExceptionController.php',
328-
];
329-
$ignoreErrors[] = [
330-
'message' => '#^Variable \\$description in isset\\(\\) is never defined\\.$#',
331-
'count' => 1,
332-
'path' => __DIR__ . '/../../src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/ExceptionController.php',
333-
];
334-
$ignoreErrors[] = [
335-
'message' => '#^Variable \\$title in isset\\(\\) is never defined\\.$#',
336-
'count' => 1,
337-
'path' => __DIR__ . '/../../src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/ExceptionController.php',
338-
];
339309
$ignoreErrors[] = [
340310
'message' => '#^Cannot call method getIdentity\\(\\) on Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\|null\\.$#',
341311
'count' => 2,

src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/ExceptionController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use Throwable;
2929
use Surfnet\StepupBundle\Controller\ExceptionController as BaseExceptionController;
3030
use Surfnet\StepupSelfService\SelfServiceBundle\Exception\MissingRequiredAttributeException;
31-
use Symfony\Component\HttpKernel\Exception\HttpException;
3231

3332
final class ExceptionController extends BaseExceptionController
3433
{
@@ -39,7 +38,7 @@ protected function getPageTitleAndDescription(Throwable $exception): array
3938
{
4039
$translator = $this->getTranslator();
4140

42-
if ($exception instanceof HttpException && $exception instanceof MissingRequiredAttributeException) {
41+
if ($exception instanceof MissingRequiredAttributeException) {
4342
$title = $translator->trans('stepup.error.missing_required_attribute.title');
4443
$description = $exception->getMessage();
4544
}

0 commit comments

Comments
 (0)