diff --git a/lib/SimpleSAML/SessionHandler.php b/lib/SimpleSAML/SessionHandler.php index c69e8f233a9061a166101f56f3c5b01940c875f2..324c4f52117b8a3eecf8f93bbe51b02603febe69 100644 --- a/lib/SimpleSAML/SessionHandler.php +++ b/lib/SimpleSAML/SessionHandler.php @@ -34,11 +34,11 @@ abstract class SessionHandler * The session handler will be instantiated if this is the first call * to this function. * - * @return \SimpleSAML\SessionHandler The current session handler. + * @return null|self The current session handler. * * @throws \Exception If we cannot instantiate the session handler. */ - public static function getSessionHandler(): SessionHandler + public static function getSessionHandler(): ?self { if (self::$sessionHandler === null) { self::createSessionHandler(); diff --git a/lib/SimpleSAML/Stats.php b/lib/SimpleSAML/Stats.php index 6176cbe87500960e2fdb76860d8a191c9bfbf193..4b3d020accd5a0f6fc0769244ddf1dd0c9a8f62b 100644 --- a/lib/SimpleSAML/Stats.php +++ b/lib/SimpleSAML/Stats.php @@ -71,6 +71,7 @@ class Stats * @param string $event The event. * @param array $data Event data. Optional. * + * @return false|null */ public static function log(string $event, array $data = []) { diff --git a/modules/core/lib/Auth/Process/PHP.php b/modules/core/lib/Auth/Process/PHP.php index d2005eec3667ba21cd423fa28969e4c7146880a1..b6706c4a07538eb0961af8a91c664cf0186bed62 100644 --- a/modules/core/lib/Auth/Process/PHP.php +++ b/modules/core/lib/Auth/Process/PHP.php @@ -59,7 +59,7 @@ class PHP extends Auth\ProcessingFilter $function = function ( /** @scrutinizer ignore-unused */ array &$attributes, /** @scrutinizer ignore-unused */ array &$state - ) { + ): void { eval($this->code); }; $function($state['Attributes'], $state); diff --git a/modules/saml/lib/IdP/SQLNameID.php b/modules/saml/lib/IdP/SQLNameID.php index 7a43e101698a44428b4c999eaaca2b87841eca71..b0dda950c285e032be7d928d63e59545f1b5ef33 100644 --- a/modules/saml/lib/IdP/SQLNameID.php +++ b/modules/saml/lib/IdP/SQLNameID.php @@ -85,7 +85,7 @@ class SQLNameID /** * @param array $config */ - private static function create(array $config = []) + private static function create(array $config = []): void { $store = empty($config) ? self::getStore() : null; $table = self::tableName($config); @@ -134,7 +134,7 @@ class SQLNameID * @param string $table The table name. * @param array $config */ - private static function createTable(string $table, array $config = []) + private static function createTable(string $table, array $config = []): void { $query = 'CREATE TABLE ' . $table . ' ( _idp VARCHAR(256) NOT NULL, diff --git a/tests/lib/SimpleSAML/Utils/TranslateTest.php b/tests/lib/SimpleSAML/Utils/TranslateTest.php index f94c72cee8af760560d63499ce91ba7e9f49a6d0..c4d042cdc3d53107914af42ff1261e8d26ced087 100644 --- a/tests/lib/SimpleSAML/Utils/TranslateTest.php +++ b/tests/lib/SimpleSAML/Utils/TranslateTest.php @@ -64,7 +64,7 @@ class TranslateTest extends TestCase $this->filesystem->remove($this->tempdir); } - protected function checkAllFilesAreCompiledTemplates(string $dir) + protected function checkAllFilesAreCompiledTemplates(string $dir): void { $finder = new Finder(); $finder->files()->in($dir); diff --git a/tests/lib/SimpleSAML/XHTML/TemplateTranslationTest.php b/tests/lib/SimpleSAML/XHTML/TemplateTranslationTest.php index 7d8df502d4e5adb37c97e2b604306314f6c02b14..3a5c6bf57efff36b6a4597f572f705bef1322ad1 100644 --- a/tests/lib/SimpleSAML/XHTML/TemplateTranslationTest.php +++ b/tests/lib/SimpleSAML/XHTML/TemplateTranslationTest.php @@ -34,7 +34,7 @@ class TemplateTranslationTest extends TestCase 'test 2' => [1, 2], ]; - $getContent = function () { + $getContent = function (): string { /** @var \SimpleSAML\XHTML\Template $this */ return $this->getContents(); }; @@ -57,7 +57,7 @@ class TemplateTranslationTest extends TestCase $t->data['rememberMeEnabled'] = false; $t->data['stateparams'] = []; - $getContent = function () { + $getContent = function (): string { /** @var \SimpleSAML\XHTML\Template $this */ return $this->getContents(); }; @@ -91,7 +91,7 @@ class TemplateTranslationTest extends TestCase ], ]; - $getContent = function () { + $getContent = function (): string { /** @var \SimpleSAML\XHTML\Template $this */ return $this->getContents(); }; @@ -112,7 +112,7 @@ class TemplateTranslationTest extends TestCase $t->data['trackid'] = ''; $t->data['authData'] = false; - $getContent = function () { + $getContent = function (): string { /** @var \SimpleSAML\XHTML\Template $this */ return $this->getContents(); }; diff --git a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php index 3054455362b082080df926d98ab875101a0f5caa..27387a74f83db57ab6ff6769fdae15a49f057573 100644 --- a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php +++ b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php @@ -61,7 +61,7 @@ class TargetedIDTest extends TestCase /** * Test the most basic functionality */ - public function testBasic() + public function testBasic(): void { $config = ['identifyingAttribute' => 'uid']; $request = [ @@ -78,7 +78,7 @@ class TargetedIDTest extends TestCase * Test with src and dst entityIds. * Make sure to overwrite any present eduPersonTargetedId */ - public function testWithSrcDst() + public function testWithSrcDst(): void { $config = ['identifyingAttribute' => 'uid']; $request = [ @@ -107,7 +107,7 @@ class TargetedIDTest extends TestCase /** * Test with nameId config option set. */ - public function testNameIdGeneration() + public function testNameIdGeneration(): void { $nameid = new NameID(); $nameid->setFormat(Constants::NAMEID_PERSISTENT); @@ -151,7 +151,7 @@ class TargetedIDTest extends TestCase /** * Test the outcome to make sure the algorithm remains unchanged */ - public function testOutcome() + public function testOutcome(): void { $config = ['identifyingAttribute' => 'uid']; $request = [ @@ -167,7 +167,7 @@ class TargetedIDTest extends TestCase /** * Test the outcome when multiple values are given */ - public function testOutcomeMultipleValues() + public function testOutcomeMultipleValues(): void { $config = ['identifyingAttribute' => 'uid']; $request = [ @@ -183,7 +183,7 @@ class TargetedIDTest extends TestCase /** * Test that Id is the same for subsequent invocations with same input. */ - public function testIdIsPersistent() + public function testIdIsPersistent(): void { $config = ['identifyingAttribute' => 'uid']; $request = [ @@ -216,7 +216,7 @@ class TargetedIDTest extends TestCase /** * Test that Id is different for two different usernames and two different sp's */ - public function testIdIsUnique() + public function testIdIsUnique(): void { $config = ['identifyingAttribute' => 'uid']; $request = [ diff --git a/tests/modules/unittest/hooks/hook_valid.php b/tests/modules/unittest/hooks/hook_valid.php index b45dcd25ea7611ac8506ab175f76157e0a603172..d264360aee16da13445c5a3cf86a69cc629429e2 100644 --- a/tests/modules/unittest/hooks/hook_valid.php +++ b/tests/modules/unittest/hooks/hook_valid.php @@ -8,7 +8,7 @@ use SimpleSAML\Auth; * * @param array &$data Some data */ -function unittest_hook_valid(array &$data) +function unittest_hook_valid(array &$data): void { $data['summary'][] = 'success'; } diff --git a/www/_include.php b/www/_include.php index fab854a12e44871ec6dbb5a8546ea65c46193ffc..c18e3a9da560854a2dde24a49f0a4d997e556c02 100644 --- a/www/_include.php +++ b/www/_include.php @@ -4,7 +4,7 @@ require_once(dirname(dirname(__FILE__)) . '/lib/_autoload.php'); // show error page on unhandled exceptions -function SimpleSAML_exception_handler($exception) +function SimpleSAML_exception_handler($exception): void { \SimpleSAML\Module::callHooks('exception_handler', $exception); @@ -22,13 +22,16 @@ function SimpleSAML_exception_handler($exception) set_exception_handler('SimpleSAML_exception_handler'); // log full backtrace on errors and warnings +/** + * @return false + */ function SimpleSAML_error_handler( $errno, $errstr, $errfile = null, $errline = 0, /** @scrutinizer ignore-unused */ $errcontext = null -) { +): bool { if (\SimpleSAML\Logger::isErrorMasked($errno)) { // masked error return false;