Skip to content

Commit

Permalink
Add PHP 8.3 to CI (#1881)
Browse files Browse the repository at this point in the history
* test against php 8.3

* fix deprecation note in test

* Configure platform for php 8.3

* update sidz/phpstan-rules to latest version (compatible with php 8.3)
  • Loading branch information
sidz committed Oct 16, 2023
1 parent 6e64b85 commit ef73c10
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 16 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- { operating-system: 'ubuntu-latest', php-version: '8.1', composer: 'composer:v2.1', coverage-driver: 'pcov', e2e-runner: 'build/infection.phar' }
- { operating-system: 'ubuntu-latest', php-version: '8.1', composer: 'composer:v2.1', coverage-driver: 'xdebug', e2e-runner: 'build/infection.phar' }
- { operating-system: 'ubuntu-latest', php-version: '8.2', composer: 'composer:v2.1', coverage-driver: 'xdebug', e2e-runner: 'bin/infection' }
- { operating-system: 'ubuntu-latest', php-version: '8.3', composer: 'composer:v2.1', coverage-driver: 'pcov', e2e-runner: 'bin/infection' }

name: E2E tests on ${{ matrix.operating-system }} with PHP ${{ matrix.php-version }} (${{ matrix.composer }}; ${{ matrix.dependencies }}), using ${{ matrix.coverage-driver }} with ${{ matrix.e2e-runner }}

Expand Down Expand Up @@ -96,8 +97,8 @@ jobs:
- name: Install Composer dependencies for E2E tests
shell: bash
run: |
if [[ "${{ matrix.php-version }}" == '8.2' ]]; then
ls tests/e2e/*/composer.json | xargs dirname | xargs -I{} composer --working-dir={} config platform.php 8.1.99
if [[ "${{ matrix.php-version }}" == '8.3' ]]; then
ls tests/e2e/*/composer.json | xargs dirname | xargs -I{} composer --working-dir={} config platform.php 8.2.99
ls tests/e2e/*/composer.json | xargs dirname | xargs -I{} composer --working-dir={} install --no-interaction --prefer-dist --no-progress
else
ls tests/e2e/*/composer.json | xargs dirname |
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest ]
php-version: [ '8.1', '8.2' ]
php-version: [ '8.1', '8.2', '8.3' ]
dependencies: [ locked, lowest, highest ]
coverage-driver: [ pcov, xdebug ]
symfony-version: [ '5.4.*', '6.*.*' ]
Expand Down Expand Up @@ -47,6 +47,11 @@ jobs:
if: matrix.dependencies != 'locked'
run: composer config --unset platform.php

- name: Configure for PHP >= 8.3
if: "matrix.php-version >= '8.3'"
run: |
composer config platform.php 8.2.99
- name: Enforce the Symfony version used
if: matrix.dependencies != 'locked'
run: composer config extra.symfony.require ${{ matrix.symfony-version }}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"phpstan/phpstan-webmozart-assert": "^1.0.2",
"phpunit/phpunit": "^9.5.5",
"rector/rector": "^0.16.0",
"sidz/phpstan-rules": "^0.3.0",
"sidz/phpstan-rules": "^0.4.0",
"symfony/phpunit-bridge": "^5.4 || ^6.0",
"symfony/yaml": "^5.4 || ^6.0",
"thecodingmachine/phpstan-safe-rule": "^1.2.0"
Expand Down
17 changes: 9 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions devTools/phpstan-src.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ parameters:
tmpDir: ../build/cache/phpstan-src
inferPrivatePropertyTypeFromConstructor: true
sidzIgnoreMagicNumbers: [0, 0.0, 1, -1, 1.0, -1.0, 100]
sidzIgnoreNumericStrings: true
ignoreErrors:
- '#generic class ReflectionClass (but )?does not specify its types#'
- '#^Call to static method Webmozart\\Assert\\[a-zA-Z]+::[a-zA-Z]+\(\) with .* will always evaluate to true\.$#'
Expand Down
17 changes: 13 additions & 4 deletions tests/phpunit/Resource/Memory/MemoryLimiterEnvironmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use Composer\XdebugHandler\XdebugHandler;
use Infection\Resource\Memory\MemoryLimiterEnvironment;
use const PHP_SAPI;
use const PHP_VERSION_ID;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use function Safe\ini_get;
Expand Down Expand Up @@ -111,15 +112,23 @@ public function test_it_does_not_use_the_system_ini_if_phpdbg_is_disabled_and_xd
$this->markTestSkipped('This test requires running without PHPDBG');
}

$skipped = (new ReflectionClass(XdebugHandler::class))->getProperty('skipped');
$skipped->setAccessible(true);
$skipped->setValue('infection-fake');
$reflectionClass = new ReflectionClass(XdebugHandler::class);

if (PHP_VERSION_ID < 80300) {
$reflectionClass->getProperty('skipped')->setValue('infection-fake');
} else {
$reflectionClass->setStaticPropertyValue('skipped', 'infection-fake');
}

try {
$this->assertFalse($this->environment->isUsingSystemIni());
} finally {
// Restore original value
$skipped->setValue(null);
if (PHP_VERSION_ID < 80300) {
$reflectionClass->getProperty('skipped')->setValue(null);
} else {
$reflectionClass->setStaticPropertyValue('skipped', null);
}
}
}

Expand Down

0 comments on commit ef73c10

Please sign in to comment.