Skip to content

Commit 72c94de

Browse files
committed
Fix several issues reported by Psalm
1 parent a8d1b9e commit 72c94de

15 files changed

Lines changed: 200 additions & 183 deletions

File tree

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
extensions: intl, mbstring, mysql, pdo, pdo_sqlite, xml
2929
tools: composer:v2
3030
ini-values: error_reporting=E_ALL
31-
coverage: pcov
31+
coverage: xdebug
3232

3333
- name: Setup problem matchers for PHP
3434
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

composer.lock

Lines changed: 154 additions & 155 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/core/src/Auth/Source/Selector/RequestedAuthnContextSelector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace SimpleSAML\Module\core\Auth\Source\Selector;
66

7+
use Exception;
78
use SAML2\Constants as C;
89
use SAML2\Exception\Protocol\NoAuthnContextException;
910
use SimpleSAML\Assert\Assert;

modules/core/src/Auth/Source/Selector/SourceIPSelector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace SimpleSAML\Module\core\Auth\Source\Selector;
66

7+
use Exception;
78
use SimpleSAML\Assert\Assert;
89
use SimpleSAML\Logger;
910
use SimpleSAML\Module\core\Auth\Source\AbstractSourceSelector;

modules/saml/src/Controller/Disco.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(
3939
/**
4040
* Built-in IdP discovery service
4141
*
42-
* @return \SimpleSAML\Http\RunnableResponse
42+
* @return \SimpleSAML\HTTP\RunnableResponse
4343
*/
4444
public function disco(): RunnableResponse
4545
{

modules/saml/src/Controller/ServiceProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function setAuthUtils(Utils\Auth $authUtils): void
109109
* Handler for response from IdP discovery service.
110110
*
111111
* @param \Symfony\Component\HttpFoundation\Request $request
112-
* @return \SimpleSAML\Http\RunnableResponse
112+
* @return \SimpleSAML\HTTP\RunnableResponse
113113
*/
114114
public function discoResponse(Request $request): RunnableResponse
115115
{
@@ -155,7 +155,7 @@ public function wrongAuthnContextClassRef(): Template
155155
* Handler for the Assertion Consumer Service.
156156
*
157157
* @param string $sourceId
158-
* @return \SimpleSAML\Http\RunnableResponse
158+
* @return \SimpleSAML\HTTP\RunnableResponse
159159
*/
160160
public function assertionConsumerService(string $sourceId): RunnableResponse
161161
{
@@ -423,7 +423,7 @@ public function assertionConsumerService(string $sourceId): RunnableResponse
423423
* This endpoint handles both logout requests and logout responses.
424424
*
425425
* @param string $sourceId
426-
* @return \SimpleSAML\Http\RunnableResponse
426+
* @return \SimpleSAML\HTTP\RunnableResponse
427427
*/
428428
public function singleLogoutService(string $sourceId): RunnableResponse
429429
{

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
<directory name="config" />
7373
<directory name="metadata" />
7474
<directory name="modules/adfs/metadata-templates" />
75+
<directory name="tests/src/SimpleSAML/Metadata/test-metadata" />
7576
</errorLevel>
7677
</PossiblyUndefinedGlobalVariable>
7778

public/saml2/idp/initSLO.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
$request = Request::createFromGlobals();
1818
$config = Configuration::getInstance();
1919
$controller = new Controller\SingleLogout($config);
20-
$controller->initSingleLogout()->send($request);
20+
$controller->initSingleLogout($request)->send();

src/SimpleSAML/Session.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace SimpleSAML;
66

7+
use DOMNodeList;
78
use SAML2\XML\saml\AttributeValue;
89
use SimpleSAML\Assert\Assert;
910
use SimpleSAML\Error;
@@ -621,7 +622,7 @@ public function doLogin(string $authority, array $data = []): void
621622
}
622623

623624
// at this point, this should be a DOMNodeList object...
624-
if (!is_a($value, 'DOMNodeList')) {
625+
if (!is_a($value, DOMNodeList::class)) {
625626
continue;
626627
}
627628

@@ -894,7 +895,7 @@ public function setData(string $type, string $id, $data, $timeout = null): void
894895
if ($timeout === self::DATA_TIMEOUT_SESSION_END) {
895896
$expires = self::DATA_TIMEOUT_SESSION_END;
896897
} else {
897-
$expires = time() + $timeout;
898+
$expires = time() + intval($timeout);
898899
}
899900

900901
$dataInfo = [

src/SimpleSAML/XHTML/Template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ class_exists($controller)
198198
public function asset(string $asset, string $module = null): string
199199
{
200200
$baseDir = $this->configuration->getBaseDir();
201+
$basePath = $this->configuration->getBasePath();
201202
if (is_null($module)) {
202203
$file = $baseDir . 'public/assets/base/' . $asset;
203-
$basePath = $this->configuration->getBasePath();
204204
$path = $basePath . 'assets/base/' . $asset;
205205
} elseif (file_exists($baseDir . 'public/assets/' . $module)) {
206206
$file = $baseDir . '/public/assets/' . $module . '/' . $asset;

0 commit comments

Comments
 (0)