diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml
index cfc066d..3ff53ea 100644
--- a/.github/workflows/documentation.yml
+++ b/.github/workflows/documentation.yml
@@ -18,7 +18,7 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- name: Lint markdown files
uses: nosborn/github-action-markdown-cli@v3
diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml
index bd5c799..26a4274 100644
--- a/.github/workflows/php.yml
+++ b/.github/workflows/php.yml
@@ -70,7 +70,7 @@ jobs:
git config --global core.autocrlf false
git config --global core.eol lf
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- name: Get composer cache directory
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
@@ -117,7 +117,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
+ extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml, zip
tools: composer
ini-values: error_reporting=E_ALL
coverage: none
@@ -133,7 +133,7 @@ jobs:
git config --global core.autocrlf false
git config --global core.eol lf
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- name: Get composer cache directory
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env:GITHUB_ENV"
@@ -172,7 +172,7 @@ jobs:
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- name: Get composer cache directory
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
@@ -201,27 +201,13 @@ jobs:
- name: PHP Code Sniffer
run: phpcs
- - name: Psalm
- continue-on-error: true
- run: |
- psalm -c psalm.xml \
- --show-info=true \
- --shepherd \
- --php-version=${{ steps.setup-php.outputs.php-version }}
-
- - name: Psalm (testsuite)
+ - name: PHPStan
run: |
- psalm -c psalm-dev.xml \
- --show-info=true \
- --shepherd \
- --php-version=${{ steps.setup-php.outputs.php-version }}
+ vendor/bin/phpstan analyze -c phpstan.neon
- - name: Psalter
+ - name: PHPStan (testsuite)
run: |
- psalm --alter \
- --issues=UnnecessaryVarAnnotation \
- --dry-run \
- --php-version=${{ steps.setup-php.outputs.php-version }}
+ vendor/bin/phpstan analyze -c phpstan-dev.neon
security:
name: Security checks
@@ -242,7 +228,7 @@ jobs:
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- name: Get composer cache directory
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
@@ -272,9 +258,9 @@ jobs:
needs: [unit-tests-linux]
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
- - uses: actions/download-artifact@v4
+ - uses: actions/download-artifact@v5
with:
name: coverage-data
path: ${{ github.workspace }}/build
diff --git a/phpstan-dev.neon b/phpstan-dev.neon
new file mode 100644
index 0000000..09d9773
--- /dev/null
+++ b/phpstan-dev.neon
@@ -0,0 +1,4 @@
+parameters:
+ level: 5
+ paths:
+ - tests
diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644
index 0000000..db37782
--- /dev/null
+++ b/phpstan.neon
@@ -0,0 +1,4 @@
+parameters:
+ level: 6
+ paths:
+ - src
diff --git a/psalm-dev.xml b/psalm-dev.xml
deleted file mode 100644
index 1e6671f..0000000
--- a/psalm-dev.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/psalm.xml b/psalm.xml
deleted file mode 100644
index 07896f6..0000000
--- a/psalm.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/PowerIdPDisco.php b/src/PowerIdPDisco.php
index d4dc21c..539af97 100644
--- a/src/PowerIdPDisco.php
+++ b/src/PowerIdPDisco.php
@@ -51,16 +51,16 @@ class PowerIdPDisco extends IdPDisco
/**
* The default sort weight for entries without 'discopower.weight'.
*
- * @var int|null
+ * @var int
*/
- private static ?int $defaultWeight = 100;
+ private static int $defaultWeight = 100;
/**
* Initializes this discovery service.
*
* The constructor does the parsing of the request. If this is an invalid request, it will throw an exception.
*
- * @param array $metadataSets Array with metadata sets we find remote entities in.
+ * @param array $metadataSets Array with metadata sets we find remote entities in.
* @param string $instance The name of this instance of the discovery service.
*/
public function __construct(array $metadataSets, string $instance)
@@ -102,8 +102,8 @@ protected function log(string $message): void
* higher, and will always put IdP's with names configured before those with
* only an entityID.
*
- * @param array $a The metadata of the first entity.
- * @param array $b The metadata of the second entity.
+ * @param array $a The metadata of the first entity.
+ * @param array $b The metadata of the second entity.
*
* @return int How $a compares to $b.
*/
@@ -135,9 +135,9 @@ public static function mcmp(array $a, array $b): int
/**
* Structure the list of IdPs in a hierarchy based upon the tags.
*
- * @param array $list A list of IdPs.
+ * @param array $list A list of IdPs.
*
- * @return array The list of IdPs structured accordingly.
+ * @return array The list of IdPs structured accordingly.
*/
protected function idplistStructured(array $list): array
{
@@ -178,8 +178,8 @@ protected function idplistStructured(array $list): array
/**
* Do the actual filtering according the rules defined.
*
- * @param array $filter A set of rules regarding filtering.
- * @param array $entry An entry to be evaluated by the filters.
+ * @param array $filter A set of rules regarding filtering.
+ * @param array $entry An entry to be evaluated by the filters.
* @param boolean $default What to do in case the entity does not match any rules. Defaults to true.
*
* @return boolean True if the entity should be kept, false if it should be discarded according to the filters.
@@ -213,9 +213,9 @@ private function processFilter(array $filter, array $entry, bool $default = true
* Filter a list of entities according to any filters defined in the parent class, plus discopower configuration
* options regarding filtering.
*
- * @param array $list A list of entities to filter.
+ * @param array $list A list of entities to filter.
*
- * @return array The list in $list after filtering entities.
+ * @return array The list in $list after filtering entities.
*/
protected function filterList(array $list): array
{
@@ -358,8 +358,8 @@ public function handleRequest(): void
/**
* @param \SimpleSAML\XHTML\Template $t
- * @param array $metadata
- * @return array
+ * @param array $metadata
+ * @return array
*/
private function processMetadata(Template $t, array $metadata): array
{
@@ -389,7 +389,7 @@ private function processMetadata(Template $t, array $metadata): array
/**
* Get the IdP entities saved in the common domain cookie.
*
- * @return array List of IdP entities.
+ * @return string[] List of IdP entities.
*/
private function getCDC(): array
{
@@ -401,10 +401,6 @@ private function getCDC(): array
$ret = explode(' ', $ret);
foreach ($ret as &$idp) {
$idp = base64_decode($idp);
- if ($idp === false) {
- // not properly base64 encoded
- return [];
- }
}
return $ret;