From 2d54e18435ea39c6c43576f26030299066d68617 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 2 Dec 2024 22:18:58 +0100 Subject: [PATCH] Start testing PHP 8.4 --- .github/workflows/php.yml | 39 +++++++++++------------------------- phpstan-dev.neon | 4 ++++ phpstan.neon | 4 ++++ psalm-dev.xml | 27 ------------------------- psalm.xml | 30 --------------------------- src/Auth/Source/Hash.php | 8 ++++---- src/Auth/Source/Htpasswd.php | 10 ++++----- 7 files changed, 29 insertions(+), 93 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 7f3f194..798f65e 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -53,10 +53,9 @@ jobs: uses: shivammathur/setup-php@v2 with: # Should be the higest supported version, so we can use the newest tools - php-version: '8.3' - tools: composer, composer-require-checker, composer-unused, phpcs, psalm - # optional performance gain for psalm: opcache - extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, posix, spl, xml + php-version: '8.4' + tools: composer, composer-require-checker, composer-unused, phpcs, phpstan + extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml - name: Setup problem matchers for PHP run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" @@ -88,27 +87,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 --debug - - 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 --debug security: name: Security checks @@ -159,7 +144,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 @@ -199,15 +184,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 @@ -221,7 +206,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 diff --git a/phpstan-dev.neon b/phpstan-dev.neon new file mode 100644 index 0000000..4d29b8b --- /dev/null +++ b/phpstan-dev.neon @@ -0,0 +1,4 @@ +parameters: + level: 9 + 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 6116331..0000000 --- a/psalm-dev.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index 10072a2..0000000 --- a/psalm.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Auth/Source/Hash.php b/src/Auth/Source/Hash.php index 0c44d77..890f4bb 100644 --- a/src/Auth/Source/Hash.php +++ b/src/Auth/Source/Hash.php @@ -26,7 +26,7 @@ class Hash extends UserPassBase * Our users, stored in an associative array. The key of the array is ":", * while the value of each element is a new array with the attributes for each user. * - * @var array + * @var array */ private array $users; @@ -34,8 +34,8 @@ class Hash extends UserPassBase /** * Constructor for this authentication source. * - * @param array $info Information about this authentication source. - * @param array $config Configuration. + * @param array $info Information about this authentication source. + * @param array $config Configuration. * * @throws \Exception in case of a configuration error. */ @@ -87,7 +87,7 @@ public function __construct(array $info, array $config) * @param string $username The username the user wrote. * @param string $password The password the user wrote. * - * @return array Associative array with the users attributes. + * @return array Associative array with the users attributes. * * @throws \SimpleSAML\Error\Error if authentication fails. */ diff --git a/src/Auth/Source/Htpasswd.php b/src/Auth/Source/Htpasswd.php index 783e5f5..a8137eb 100644 --- a/src/Auth/Source/Htpasswd.php +++ b/src/Auth/Source/Htpasswd.php @@ -26,14 +26,14 @@ class Htpasswd extends UserPassBase /** * Our users, stored in an array, where each value is ":". * - * @var array + * @var array */ private array $users; /** * An array containing static attributes for our users. * - * @var array + * @var array */ private array $attributes = []; @@ -41,8 +41,8 @@ class Htpasswd extends UserPassBase /** * Constructor for this authentication source. * - * @param array $info Information about this authentication source. - * @param array $config Configuration. + * @param array $info Information about this authentication source. + * @param array $config Configuration. * * @throws \Exception if the htpasswd file is not readable or the static_attributes array is invalid. */ @@ -81,7 +81,7 @@ public function __construct(array $info, array $config) * @param string $username The username the user wrote. * @param string $password The password the user wrote. * - * @return array Associative array with the users attributes. + * @return array Associative array with the users attributes. * * @throws \SimpleSAML\Error\Error if authentication fails. */