Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
51 changes: 20 additions & 31 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -107,15 +107,15 @@ 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
# https://github.com/shivammathur/setup-php
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
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -237,7 +226,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"
Expand Down Expand Up @@ -267,9 +256,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
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 4 additions & 0 deletions phpstan-dev.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: 5
paths:
- tests
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: 6
paths:
- src
18 changes: 0 additions & 18 deletions psalm-dev.xml

This file was deleted.

31 changes: 0 additions & 31 deletions psalm.xml

This file was deleted.

7 changes: 0 additions & 7 deletions src/Controller/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use function array_key_exists;
use function count;
use function sprintf;
use function strval;

/**
* Controller class for the consentsimpleadmin module.
Expand All @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 1 addition & 3 deletions src/Controller/Stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion templates/consentadmin.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{% block content %}
<p>
<p>{{ granted }}</p>
<p>{{ 'You have earlier granted %NO% consents to %OF% different services.'|trans({'%NO%': consents, '%OF%': consentServices }) }}</p>
<p>{{ '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 }}</p>
</p>

Expand Down
2 changes: 1 addition & 1 deletion templates/consentstats.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
{% extends "base.twig" %}

{% block content %}
{% endblock %}
<p>
<p>{{ stattotal }} }}</p>
<p>{{ statusers }} }}</p>
<p>{{ statservices }} }}</p>
</p>
{% endblock %}
Loading