diff --git a/lib/SimpleSAML/Auth/Simple.php b/lib/SimpleSAML/Auth/Simple.php index ac9e5afe8a1ba01b9273e16b3725460230bdd1ba..2be23efc9705c580e84ac0b4caf46d88e48db32c 100644 --- a/lib/SimpleSAML/Auth/Simple.php +++ b/lib/SimpleSAML/Auth/Simple.php @@ -391,6 +391,7 @@ class Simple $port = ''; } + /** @psalm-var \SimpleSAML\Configuration $this->app_config */ $base = trim($this->app_config->getString( 'baseURL', $scheme . '://' . $host . $port diff --git a/lib/SimpleSAML/Error/Exception.php b/lib/SimpleSAML/Error/Exception.php index 5177fd64d70514328a6cfede9bc9eaf4dcb30e38..9af638d9efa94c34aef98d89cda3a3f2fc12327e 100644 --- a/lib/SimpleSAML/Error/Exception.php +++ b/lib/SimpleSAML/Error/Exception.php @@ -33,7 +33,7 @@ class Exception extends \Exception /** * The cause of this exception. * - * @var Exception|null + * @var \SimpleSAML\Error\Exception|null */ private $cause = null; @@ -68,7 +68,7 @@ class Exception extends \Exception * * @param \Throwable $e The exception. * - * @return Exception The new exception. + * @return \SimpleSAML\Error\Exception The new exception. */ public static function fromException(Throwable $e): Exception { diff --git a/lib/SimpleSAML/Error/UnserializableException.php b/lib/SimpleSAML/Error/UnserializableException.php index 287475590a77aac54307544e2e95dcb1a4b78a9a..5c7d21206e884900c903362fe20a5a4ed35eaff5 100644 --- a/lib/SimpleSAML/Error/UnserializableException.php +++ b/lib/SimpleSAML/Error/UnserializableException.php @@ -42,8 +42,8 @@ class UnserializableException extends Exception $msg = $original->getMessage(); $code = $original->getCode(); - if (is_string($code)) { - // PDOException uses a string as the code. Filter it out here. + if (!is_int($code)) { + // PDOException and possibly others use a string for the code. Filter it out here. $code = -1; } diff --git a/lib/SimpleSAML/Locale/Translate.php b/lib/SimpleSAML/Locale/Translate.php index abec8afeaa26bdedc14ae3a098b75265d48e784c..5db3acc1ee5bdfe07eb8210de91e232910290b25 100644 --- a/lib/SimpleSAML/Locale/Translate.php +++ b/lib/SimpleSAML/Locale/Translate.php @@ -526,6 +526,7 @@ class Translate // we don't have a translation for the current language, load alternative priorities $sspcfg = Configuration::getInstance(); + /** @psalm-var \SimpleSAML\Configuration $langcfg */ $langcfg = $sspcfg->getConfigItem('language'); $priorities = $langcfg->getArray('priorities', []); diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php index 04a1b5d335983eefac8e0b767bf66061173b7f01..60adb3003c5aa1c600a9d2f90ccb5e195650d113 100644 --- a/lib/SimpleSAML/Metadata/SAMLBuilder.php +++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php @@ -155,6 +155,8 @@ class SAMLBuilder $metadata = Configuration::loadFromArray($metadata, $metadata['entityid']); $defaultEndpoint = $metadata->getDefaultEndpoint('SingleSignOnService'); + + /** @psalm-suppress UndefinedClass */ $e = new SecurityTokenServiceType(); $e->setLocation($defaultEndpoint['Location']); diff --git a/lib/SimpleSAML/Metadata/Sources/MDQ.php b/lib/SimpleSAML/Metadata/Sources/MDQ.php index e98bcf212f646e96185338aae4dce1eeb6658f82..833ae7608eafb3bd20fec06c09d21d888de46549 100644 --- a/lib/SimpleSAML/Metadata/Sources/MDQ.php +++ b/lib/SimpleSAML/Metadata/Sources/MDQ.php @@ -247,9 +247,7 @@ class MDQ extends \SimpleSAML\Metadata\MetaDataStorageSource case 'shib13-sp-remote': return $entity->getMetadata1xSP(); case 'attributeauthority-remote': - $ret = $entity->getAttributeAuthorities(); - return $ret[0]; - + return $entity->getAttributeAuthorities(); default: Logger::warning(__CLASS__ . ': unknown metadata set: \'' . $set . '\'.'); } diff --git a/lib/SimpleSAML/Module.php b/lib/SimpleSAML/Module.php index 861452149012ef84b8efe015a04ea4dc233e55b6..c68cf5e36cac105c19acd788dcc1e228aecaacaa 100644 --- a/lib/SimpleSAML/Module.php +++ b/lib/SimpleSAML/Module.php @@ -187,7 +187,7 @@ class Module $request->request->all(), $request->attributes->all(), $request->cookies->all(), - $request_files ?? [], + $request_files, $request->server->all(), $request->getContent() ); @@ -291,14 +291,16 @@ class Module } } + /** @psalm-var \SimpleSAML\Configuration $assetConfig */ $assetConfig = $config->getConfigItem('assets'); + /** @psalm-var \SimpleSAML\Configuration $cacheConfig */ $cacheConfig = $assetConfig->getConfigItem('caching'); $response = new BinaryFileResponse($path); $response->setCache([ // "public" allows response caching even if the request was authenticated, // which is exactly what we want for static resources 'public' => true, - 'max_age' => (string)$cacheConfig->getInteger('max_age', 86400) + 'max_age' => strval($cacheConfig->getInteger('max_age', 86400)) ]); $response->setAutoLastModified(); if ($cacheConfig->getBoolean('etag', false)) {