From fc877d2f002882f6ff426f1d9a703590900d0fa3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:29:43 +0000 Subject: [PATCH 1/4] Bump actions/download-artifact from 4 to 5 in the all-actions group Bumps the all-actions group with 1 update: [actions/download-artifact](https://github.com/actions/download-artifact). Updates `actions/download-artifact` from 4 to 5 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major dependency-group: all-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 1451acc..03dd841 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -269,7 +269,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v5 with: name: coverage-data path: ${{ github.workspace }}/build From 878d8b328e15f2b82a2c767c0d6befac96b19830 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 12:48:38 +0000 Subject: [PATCH 2/4] Bump actions/checkout from 4 to 5 in the all-actions group Bumps the all-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 4 to 5 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major dependency-group: all-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/documentation.yml | 2 +- .github/workflows/php.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) 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 03dd841..893af9e 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -69,7 +69,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" @@ -131,7 +131,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" @@ -169,7 +169,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" @@ -237,7 +237,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" @@ -267,7 +267,7 @@ jobs: needs: [unit-tests-linux] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/download-artifact@v5 with: From abbee0fcf190d129e45ba504e7ec0d11c3d329f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Aug 2025 18:43:01 +0000 Subject: [PATCH 3/4] Bump simplesamlphp/simplesamlphp-test-framework in the all-actions group Bumps the all-actions group with 1 update: [simplesamlphp/simplesamlphp-test-framework](https://github.com/simplesamlphp/simplesamlphp-test-framework). Updates `simplesamlphp/simplesamlphp-test-framework` from 1.9.3 to 1.10.0 - [Commits](https://github.com/simplesamlphp/simplesamlphp-test-framework/compare/v1.9.3...v1.10.0) --- updated-dependencies: - dependency-name: simplesamlphp/simplesamlphp-test-framework dependency-version: 1.10.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/php.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 893af9e..c6e3571 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -21,7 +21,7 @@ jobs: matrix: php-version: ['8.1', '8.2', '8.3', '8.4'] - uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.9.3 + uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.10.0 with: php-version: ${{ matrix.php-version }} @@ -30,7 +30,7 @@ jobs: strategy: fail-fast: false - uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.9.3 + uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.10.0 with: enable_eslinter: false enable_jsonlinter: true From 03a3cebfd63ef141560d70acd99ea1b6ed66b452 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 25 Aug 2025 22:16:58 +0200 Subject: [PATCH 4/4] Replace super-linter with custom linters --- .github/workflows/php.yml | 35 ++++++++++++----------------------- composer.json | 6 +++--- phpstan-dev.neon | 4 ++++ phpstan.neon | 4 ++++ psalm-dev.xml | 18 ------------------ psalm.xml | 31 ------------------------------- src/Controller/Admin.php | 7 ------- src/Controller/Stats.php | 4 +--- templates/consentadmin.twig | 2 +- templates/consentstats.twig | 2 +- 10 files changed, 26 insertions(+), 87 deletions(-) create mode 100644 phpstan-dev.neon create mode 100644 phpstan.neon delete mode 100644 psalm-dev.xml delete mode 100644 psalm.xml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index c6e3571..28a147b 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -45,7 +45,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Setup PHP, with composer and extensions @@ -85,15 +85,15 @@ jobs: run: composer install --no-progress --prefer-dist --optimize-autoloader - name: Run unit tests with coverage - if: ${{ matrix.php-versions == '8.3' }} + if: ${{ matrix.php-versions == '8.4' }} run: vendor/bin/phpunit - name: Run unit tests (no coverage) - if: ${{ matrix.php-versions != '8.3' }} + if: ${{ matrix.php-versions != '8.4' }} run: vendor/bin/phpunit --no-coverage - name: Save coverage data - if: ${{ matrix.php-versions == '8.3' }} + if: ${{ matrix.php-versions == '8.4' }} uses: actions/upload-artifact@v4 with: name: coverage-data @@ -107,7 +107,7 @@ jobs: fail-fast: true matrix: operating-system: [windows-latest] - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Setup PHP, with composer and extensions @@ -115,7 +115,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 @@ -196,27 +196,16 @@ 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: PHP Code Sniffer + run: phpcs - - 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 diff --git a/composer.json b/composer.json index 7baa809..a45390b 100644 --- a/composer.json +++ b/composer.json @@ -30,12 +30,12 @@ "require": { "php": "^8.1", "simplesamlphp/composer-module-installer": "~1.4.0", - "simplesamlphp/simplesamlphp": "^2.2", - "simplesamlphp/simplesamlphp-module-consent": "^1.3", + "simplesamlphp/simplesamlphp": "^2.4", + "simplesamlphp/simplesamlphp-module-consent": "~1.4.1", "symfony/http-foundation": "^6.4" }, "require-dev": { - "simplesamlphp/simplesamlphp-test-framework": "^1.7.9" + "simplesamlphp/simplesamlphp-test-framework": "~1.9.3" }, "config": { "preferred-install": { 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 95c5632..0000000 --- a/psalm-dev.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index 000b7bf..0000000 --- a/psalm.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Controller/Admin.php b/src/Controller/Admin.php index 9520bae..3745e40 100644 --- a/src/Controller/Admin.php +++ b/src/Controller/Admin.php @@ -18,7 +18,6 @@ use function array_key_exists; use function count; use function sprintf; -use function strval; /** * Controller class for the consentsimpleadmin module. @@ -36,8 +35,6 @@ class Admin * * @param \SimpleSAML\Configuration $config The configuration to use by the controllers. * @param \SimpleSAML\Session $session The session to use by the controllers. - * - * @throws \Exception */ public function __construct( protected Configuration $config, @@ -129,10 +126,6 @@ public function admin(Request $request): Template $t->data['consentServices'] = count($consentServices); $t->data['consents'] = count($user_consent_list); - $t->data['granted'] = $translator->t('{consentSimpleAdmin:consentsimpleadmin:granted}', [ - '%NO%' => strval($this->data['consents']), - '%OF%' => strval($this->data['consentServices']), - ]); return $t; } diff --git a/src/Controller/Stats.php b/src/Controller/Stats.php index f44ec2b..da42fcb 100644 --- a/src/Controller/Stats.php +++ b/src/Controller/Stats.php @@ -27,8 +27,6 @@ class Stats * * @param \SimpleSAML\Configuration $config The configuration to use by the controllers. * @param \SimpleSAML\Session $session The session to use by the controllers. - * - * @throws \Exception */ public function __construct( protected Configuration $config, @@ -58,7 +56,7 @@ public function stats(Request $request): Template $stats = $consent_storage->getStatistics(); // Init template - $t = new Template($config, 'consentSimpleAdmin:consentstats.twig'); + $t = new Template($this->config, 'consentSimpleAdmin:consentstats.twig'); $translator = $t->getTranslator(); $t->data['stats'] = $stats; diff --git a/templates/consentadmin.twig b/templates/consentadmin.twig index 41dfd24..835c30d 100644 --- a/templates/consentadmin.twig +++ b/templates/consentadmin.twig @@ -3,7 +3,7 @@ {% block content %}

-

{{ granted }}

+

{{ 'You have earlier granted %NO% consents to %OF% different services.'|trans({'%NO%': consents, '%OF%': consentServices }) }}

{{ 'If you withdraw all consents given, you will be asked again each time you visit a new service, whether or not you would like to accept that a given set of personal information are transferred.'|trans }}

diff --git a/templates/consentstats.twig b/templates/consentstats.twig index d4eae07..59fefb7 100644 --- a/templates/consentstats.twig +++ b/templates/consentstats.twig @@ -2,9 +2,9 @@ {% extends "base.twig" %} {% block content %} -{% endblock %}

{{ stattotal }} }}

{{ statusers }} }}

{{ statservices }} }}

+{% endblock %}