diff --git a/lib/SimpleSAML/Command/RouterDebugCommand.php b/lib/SimpleSAML/Command/RouterDebugCommand.php index 0df7febce3d4c5f6c3cc95042aaf40bbe573124f..a144b56816e1af470c5a54b69ae14d406c78966c 100644 --- a/lib/SimpleSAML/Command/RouterDebugCommand.php +++ b/lib/SimpleSAML/Command/RouterDebugCommand.php @@ -15,7 +15,7 @@ use Symfony\Component\Routing\RouterInterface; class RouterDebugCommand extends Command { /** - * @var string + * @var string|null */ protected static $defaultName = 'debug:router'; diff --git a/lib/SimpleSAML/Locale/TwigTranslator.php b/lib/SimpleSAML/Locale/TwigTranslator.php index 4017bab9fbe39d5cc54affc69afe15a2f6416dae..80592998d63c718172c071811386fabf4536072a 100644 --- a/lib/SimpleSAML/Locale/TwigTranslator.php +++ b/lib/SimpleSAML/Locale/TwigTranslator.php @@ -14,6 +14,10 @@ use Symfony\Contracts\Translation\TranslatorInterface; class TwigTranslator implements TranslatorInterface { + /** @var string|null $locale */ + private ?string $locale = null; + + /** @var callable $translator */ private $translator; /** diff --git a/lib/SimpleSAML/Module.php b/lib/SimpleSAML/Module.php index 8b1d9dde8fb7e9ad26e8909d6f899e72e3e29494..7d84ddd15d68a08c25a648444cff4921a2162ade 100644 --- a/lib/SimpleSAML/Module.php +++ b/lib/SimpleSAML/Module.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace SimpleSAML; +use Exception; use SimpleSAML\Assert\Assert; use SimpleSAML\Kernel; use SimpleSAML\Utils; @@ -348,7 +349,7 @@ class Module return $mod_config[$module]; } - throw new \Exception("Invalid module.enable value for the '$module' module."); + throw new Exception("Invalid module.enable value for the '$module' module."); } $core_module = array_key_exists($module, self::$core_modules) ? true : false; @@ -375,7 +376,7 @@ class Module $dh = scandir($path); if ($dh === false) { - throw new \Exception('Unable to open module directory "' . $path . '".'); + throw new Exception('Unable to open module directory "' . $path . '".'); } foreach ($dh as $f) { @@ -420,14 +421,14 @@ class Module // no module involved $className = $tmp[0]; if (!class_exists($className)) { - throw new \Exception("Could not resolve '$id': no class named '$className'."); + throw new Exception("Could not resolve '$id': no class named '$className'."); } } elseif (!in_array($tmp[0], self::getModules())) { // Module not installed - throw new \Exception('No module named \'' . $tmp[0] . '\' has been installed.'); + throw new Exception('No module named \'' . $tmp[0] . '\' has been installed.'); } elseif (!self::isModuleEnabled($tmp[0])) { // Module installed, but not enabled - throw new \Exception('The module \'' . $tmp[0] . '\' is not enabled.'); + throw new Exception('The module \'' . $tmp[0] . '\' is not enabled.'); } else { // should be a module // make sure empty types are handled correctly @@ -437,7 +438,7 @@ class Module } if ($subclass !== null && !is_subclass_of($className, $subclass)) { - throw new \Exception( + throw new Exception( 'Could not resolve \'' . $id . '\': The class \'' . $className . '\' isn\'t a subclass of \'' . $subclass . '\'.' ); diff --git a/lib/SimpleSAML/Utils/Random.php b/lib/SimpleSAML/Utils/Random.php index d5c7bc8965c2c5143f658046852c73682a3bf44f..f0b303c1a474aa40394833ef628bd3fdf277902a 100644 --- a/lib/SimpleSAML/Utils/Random.php +++ b/lib/SimpleSAML/Utils/Random.php @@ -24,6 +24,6 @@ class Random */ public function generateID(): string { - return '_' . bin2hex(openssl_random_pseudo_bytes((int) ((self::ID_LENGTH - 1) / 2))); + return '_' . bin2hex(openssl_random_pseudo_bytes((self::ID_LENGTH - 1) / 2)); } } diff --git a/modules/core/lib/Storage/SQLPermanentStorage.php b/modules/core/lib/Storage/SQLPermanentStorage.php index 7c21976aa743d17207a270715e4209d8b6fd4a67..b5e20ebd80959fac4d44c71153cb8f6a03d618ff 100644 --- a/modules/core/lib/Storage/SQLPermanentStorage.php +++ b/modules/core/lib/Storage/SQLPermanentStorage.php @@ -47,7 +47,8 @@ class SQLPermanentStorage } $dbfile = 'sqlite:' . $sqllitedir . $name . '.sqlite'; - if ($this->db = new PDO($dbfile)) { + $this->db = new PDO($dbfile); + if ($this->db) { $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); $q = @$this->db->query('SELECT key1 FROM data LIMIT 1'); if ($q === false) { diff --git a/modules/saml/lib/Auth/Source/SP.php b/modules/saml/lib/Auth/Source/SP.php index 94f67f8f5b9c955f2cfeaaf9b615c187424904d9..4424b9c666b59b10e91ed25bb8f2a0d8f57b802c 100644 --- a/modules/saml/lib/Auth/Source/SP.php +++ b/modules/saml/lib/Auth/Source/SP.php @@ -512,7 +512,7 @@ class SP extends \SimpleSAML\Auth\Source $policy = null; if (is_string($state['saml:NameIDPolicy'])) { $policy = [ - 'Format' => (string) $state['saml:NameIDPolicy'], + 'Format' => $state['saml:NameIDPolicy'], 'AllowCreate' => true, ]; } elseif (is_array($state['saml:NameIDPolicy'])) {