Skip to content

Commit d81adb9

Browse files
committed
Fix several Psalm-issues
1 parent 96357ee commit d81adb9

5 files changed

Lines changed: 9 additions & 10 deletions

File tree

src/SimpleSAML/Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ public static function getModules(): array
420420
*
421421
* @param string $id The string we should resolve.
422422
* @param string $type The type of the class.
423-
* @param string|null $subclass The class should be a subclass of this class. Optional.
423+
* @param class-string|null $subclass The class should be a subclass of this class. Optional.
424424
*
425425
* @return string The classname.
426426
*

src/SimpleSAML/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public function __unserialize($serialized): void
262262
/**
263263
* Retrieves the current session. Creates a new session if there's not one.
264264
*
265-
* @return Session The current session.
265+
* @return \SimpleSAML\Session The current session.
266266
* @throws \Exception When session couldn't be initialized and the session fallback is disabled by configuration.
267267
*/
268268
public static function getSessionFromRequest(): Session

src/SimpleSAML/XHTML/Template.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,13 +558,15 @@ public function getContents(): string
558558
/**
559559
* Send this template as a response.
560560
*
561-
* @return \Symfony\Component\HttpFoundation\Response This response.
561+
* @return static This response.
562562
* @throws \Exception if the template cannot be found.
563563
*/
564564
public function send(): static
565565
{
566566
$this->content = $this->getContents();
567-
return /** @scrutinizer ignore-type */parent::send();
567+
parent::send();
568+
569+
return $this;
568570
}
569571

570572

src/SimpleSAML/XHTML/TemplateLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class TemplateLoader extends \Twig\Loader\FilesystemLoader
2929
*
3030
* @param string $name
3131
* @param bool $throw
32-
* @return string|false|null
32+
* @return string|null
3333
*
3434
* NOTE: cannot typehint due to upstream restrictions
3535
*/

src/SimpleSAML/XML/Signer.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ public function loadPublicKeyArray(array $publickey): void
182182
* @param bool $full_path Whether the filename found in the configuration contains the
183183
* full path to the private key or not. Default to false.
184184
* @throws \Exception
185+
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileException
185186
*/
186187
public function loadCertificate(string $file, bool $full_path = false): void
187188
{
@@ -197,11 +198,7 @@ public function loadCertificate(string $file, bool $full_path = false): void
197198
}
198199

199200
$file = new File($certFile);
200-
$cert = $file->getContent();
201-
if ($cert === false) {
202-
throw new Exception('Unable to read certificate file "' . $certFile . '".');
203-
}
204-
$this->certificate = $cert;
201+
$this->certificate = $file->getContent();
205202
}
206203

207204

0 commit comments

Comments
 (0)