From eff0bc552641385188e5bc92e572550054c1bfa3 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Wed, 18 Aug 2021 12:41:59 +0200 Subject: [PATCH] QA fixes --- .../exampleauth/lib/Controller/ExampleAuth.php | 16 +++++++++------- .../lib/Auth/Process/SQLPersistentNameID.php | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/exampleauth/lib/Controller/ExampleAuth.php b/modules/exampleauth/lib/Controller/ExampleAuth.php index 00f178979..ada3e653b 100644 --- a/modules/exampleauth/lib/Controller/ExampleAuth.php +++ b/modules/exampleauth/lib/Controller/ExampleAuth.php @@ -78,9 +78,9 @@ class ExampleAuth * * @param \Symfony\Component\HttpFoundation\Request $request The current request. * - * @return \SimpleSAML\XHTML\Template + * @return \SimpleSAML\XHTML\Template|\SimpleSAML\HTTP\RunnableResponse */ - public function authpage(Request $request): Template + public function authpage(Request $request) { /** * This page serves as a dummy login page. @@ -88,12 +88,13 @@ class ExampleAuth * Note that we don't actually validate the user in this example. This page * just serves to make the example work out of the box. */ - if ($request->get('ReturnTo') === null) { + $returnTo = $request->get('ReturnTo'); + if ($returnTo === null) { throw new Error\Exception('Missing ReturnTo parameter.'); } $httpUtils = new Utils\HTTP(); - $returnTo = $httpUtils->checkURLAllowed($request->get('ReturnTo')); + $returnTo = $httpUtils->checkURLAllowed($returnTo); /** * The following piece of code would never be found in a real authentication page. Its @@ -179,12 +180,13 @@ class ExampleAuth /** * Request handler for redirect filter test. */ - if ($request->get('StateId') === null) { + $stateId = $request->get('StateId'); + if ($stateId === null) { throw new Error\BadRequest('Missing required StateId query parameter.'); } /** @var array $state */ - $state = $this->authState::loadState($request->get('StateId'), 'exampleauth:redirectfilter-test'); + $state = $this->authState::loadState($stateId, 'exampleauth:redirectfilter-test'); $state['Attributes']['RedirectTest2'] = ['OK']; return new RunnableResponse([Auth\ProcessingChain::class, 'resumeProcessing'], [$state]); @@ -198,7 +200,7 @@ class ExampleAuth * * @return \SimpleSAML\HTTP\RunnableResponse */ - public function resume(Request $request): RunnableResponse + public function resume(/** @scrutinizer ignore-unused */ Request $request): RunnableResponse { /** * This page serves as the point where the user's authentication diff --git a/modules/saml/lib/Auth/Process/SQLPersistentNameID.php b/modules/saml/lib/Auth/Process/SQLPersistentNameID.php index 60e8a0223..d166f7533 100644 --- a/modules/saml/lib/Auth/Process/SQLPersistentNameID.php +++ b/modules/saml/lib/Auth/Process/SQLPersistentNameID.php @@ -62,7 +62,7 @@ class SQLPersistentNameID extends BaseNameIDGenerator * * @throws \SimpleSAML\Error\Exception If the 'attribute' option is not specified. */ - public function __construct(array $config, $reserved) + public function __construct(array &$config, $reserved) { parent::__construct($config, $reserved); -- GitLab