Skip to content
Snippets Groups Projects
Commit b9bdbbec authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Psalm fixes

parent 45986395
Branches
Tags
No related merge requests found
...@@ -391,6 +391,7 @@ class Simple ...@@ -391,6 +391,7 @@ class Simple
$port = ''; $port = '';
} }
/** @psalm-var \SimpleSAML\Configuration $this->app_config */
$base = trim($this->app_config->getString( $base = trim($this->app_config->getString(
'baseURL', 'baseURL',
$scheme . '://' . $host . $port $scheme . '://' . $host . $port
......
...@@ -33,7 +33,7 @@ class Exception extends \Exception ...@@ -33,7 +33,7 @@ class Exception extends \Exception
/** /**
* The cause of this exception. * The cause of this exception.
* *
* @var Exception|null * @var \SimpleSAML\Error\Exception|null
*/ */
private $cause = null; private $cause = null;
...@@ -68,7 +68,7 @@ class Exception extends \Exception ...@@ -68,7 +68,7 @@ class Exception extends \Exception
* *
* @param \Throwable $e The 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 public static function fromException(Throwable $e): Exception
{ {
......
...@@ -42,8 +42,8 @@ class UnserializableException extends Exception ...@@ -42,8 +42,8 @@ class UnserializableException extends Exception
$msg = $original->getMessage(); $msg = $original->getMessage();
$code = $original->getCode(); $code = $original->getCode();
if (is_string($code)) { if (!is_int($code)) {
// PDOException uses a string as the code. Filter it out here. // PDOException and possibly others use a string for the code. Filter it out here.
$code = -1; $code = -1;
} }
......
...@@ -526,6 +526,7 @@ class Translate ...@@ -526,6 +526,7 @@ class Translate
// we don't have a translation for the current language, load alternative priorities // we don't have a translation for the current language, load alternative priorities
$sspcfg = Configuration::getInstance(); $sspcfg = Configuration::getInstance();
/** @psalm-var \SimpleSAML\Configuration $langcfg */
$langcfg = $sspcfg->getConfigItem('language'); $langcfg = $sspcfg->getConfigItem('language');
$priorities = $langcfg->getArray('priorities', []); $priorities = $langcfg->getArray('priorities', []);
......
...@@ -155,6 +155,8 @@ class SAMLBuilder ...@@ -155,6 +155,8 @@ class SAMLBuilder
$metadata = Configuration::loadFromArray($metadata, $metadata['entityid']); $metadata = Configuration::loadFromArray($metadata, $metadata['entityid']);
$defaultEndpoint = $metadata->getDefaultEndpoint('SingleSignOnService'); $defaultEndpoint = $metadata->getDefaultEndpoint('SingleSignOnService');
/** @psalm-suppress UndefinedClass */
$e = new SecurityTokenServiceType(); $e = new SecurityTokenServiceType();
$e->setLocation($defaultEndpoint['Location']); $e->setLocation($defaultEndpoint['Location']);
......
...@@ -247,9 +247,7 @@ class MDQ extends \SimpleSAML\Metadata\MetaDataStorageSource ...@@ -247,9 +247,7 @@ class MDQ extends \SimpleSAML\Metadata\MetaDataStorageSource
case 'shib13-sp-remote': case 'shib13-sp-remote':
return $entity->getMetadata1xSP(); return $entity->getMetadata1xSP();
case 'attributeauthority-remote': case 'attributeauthority-remote':
$ret = $entity->getAttributeAuthorities(); return $entity->getAttributeAuthorities();
return $ret[0];
default: default:
Logger::warning(__CLASS__ . ': unknown metadata set: \'' . $set . '\'.'); Logger::warning(__CLASS__ . ': unknown metadata set: \'' . $set . '\'.');
} }
......
...@@ -187,7 +187,7 @@ class Module ...@@ -187,7 +187,7 @@ class Module
$request->request->all(), $request->request->all(),
$request->attributes->all(), $request->attributes->all(),
$request->cookies->all(), $request->cookies->all(),
$request_files ?? [], $request_files,
$request->server->all(), $request->server->all(),
$request->getContent() $request->getContent()
); );
...@@ -291,14 +291,16 @@ class Module ...@@ -291,14 +291,16 @@ class Module
} }
} }
/** @psalm-var \SimpleSAML\Configuration $assetConfig */
$assetConfig = $config->getConfigItem('assets'); $assetConfig = $config->getConfigItem('assets');
/** @psalm-var \SimpleSAML\Configuration $cacheConfig */
$cacheConfig = $assetConfig->getConfigItem('caching'); $cacheConfig = $assetConfig->getConfigItem('caching');
$response = new BinaryFileResponse($path); $response = new BinaryFileResponse($path);
$response->setCache([ $response->setCache([
// "public" allows response caching even if the request was authenticated, // "public" allows response caching even if the request was authenticated,
// which is exactly what we want for static resources // which is exactly what we want for static resources
'public' => true, 'public' => true,
'max_age' => (string)$cacheConfig->getInteger('max_age', 86400) 'max_age' => strval($cacheConfig->getInteger('max_age', 86400))
]); ]);
$response->setAutoLastModified(); $response->setAutoLastModified();
if ($cacheConfig->getBoolean('etag', false)) { if ($cacheConfig->getBoolean('etag', false)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment