From 636b9b28f72943bd457cb942ac6c4de029b1c576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Fri, 14 Aug 2026 12:29:00 -0300 Subject: [PATCH] Add support for PHP 8.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- .github/workflows/lint-and-analyse-php.yml | 93 +++++++++--------- .github/workflows/lint-docs.yml | 28 +++--- .github/workflows/tests.yml | 104 +++++++++++---------- tests/Cache/ApcuCacheTest.php | 6 +- 4 files changed, 126 insertions(+), 105 deletions(-) diff --git a/.github/workflows/lint-and-analyse-php.yml b/.github/workflows/lint-and-analyse-php.yml index cc89c37..74fa5dd 100644 --- a/.github/workflows/lint-and-analyse-php.yml +++ b/.github/workflows/lint-and-analyse-php.yml @@ -4,46 +4,55 @@ on: push: pull_request: +permissions: + contents: read + jobs: - lint-php: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v7 - - - name: Set up PHP 7.2 - uses: shivammathur/setup-php@v2 - with: - php-version: 7.2 - tools: composer:v2 - - - name: Validate composer.json and composer.lock - run: composer validate --strict - - - name: Install Composer dependencies - uses: ramsey/composer-install@v4 - with: - dependency-versions: highest - - - name: Lint files - run: composer run phpcs - - analyse-php: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v7 - - - name: Set up PHP 7.2 - uses: shivammathur/setup-php@v2 - with: - php-version: 7.2 - tools: composer:v2 - - - name: Install Composer dependencies - uses: ramsey/composer-install@v4 - with: - dependency-versions: highest - - - name: Analyse files - run: composer run phpstan + lint-php: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v7 + with: + persist-credentials: false + + - name: Set up PHP 7.2 + uses: shivammathur/setup-php@v2 + with: + php-version: 7.2 + tools: composer:v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Install Composer dependencies + uses: ramsey/composer-install@v4 + with: + dependency-versions: highest + + - name: Lint files + run: composer run phpcs + + analyse-php: + name: Analyse + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v7 + with: + persist-credentials: false + + - name: Set up PHP 7.2 + uses: shivammathur/setup-php@v2 + with: + php-version: 7.2 + tools: composer:v2 + + - name: Install Composer dependencies + uses: ramsey/composer-install@v4 + with: + dependency-versions: highest + + - name: Analyse files + run: composer run phpstan diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml index 32967e8..89f71f1 100644 --- a/.github/workflows/lint-docs.yml +++ b/.github/workflows/lint-docs.yml @@ -4,16 +4,22 @@ on: push: pull_request: +permissions: + contents: read + jobs: - lint-docs: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v7 + lint-docs: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v7 + with: + persist-credentials: false - - name: Lint PHP documentation - uses: sudo-bot/action-doctum@v5 - with: - config-file: doctum-config.php - method: "parse" - cli-args: "--output-format=github --no-ansi --no-progress -v --ignore-parse-errors" + - name: Lint PHP documentation + uses: sudo-bot/action-doctum@v5 + with: + config-file: doctum-config.php + method: "parse" + cli-args: "--output-format=github --no-ansi --no-progress -v --ignore-parse-errors" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9af9bb7..8e6121d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,55 +4,57 @@ on: push: pull_request: +permissions: + contents: read + jobs: - test-php: - name: Test on PHP ${{ matrix.php-version }} (${{ matrix.extensions }}) - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.experimental }} - strategy: - matrix: - php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] - extensions: [':apcu, mbstring', 'apcu, mbstring'] - os: [ubuntu-latest] - experimental: [false] - composer-options: [''] - include: - - { php-version: '8.5', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: 'apcu, mbstring' } - - { php-version: '8.5', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: ':apcu, mbstring' } - steps: - - name: Checkout code - uses: actions/checkout@v7 - with: - # Fetch some commits for Scrutinizer coverage upload - fetch-depth: 15 - - - name: Set up PHP ${{ matrix.php-version }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: ${{ matrix.extensions }} - ini-values: "apc.enable_cli=1" - coverage: xdebug - - - name: Install Composer dependencies - uses: ramsey/composer-install@v4 - with: - dependency-versions: highest - composer-options: ${{ matrix.composer-options }} - - - name: Run PHP tests - run: composer run phpunit - - - name: Send coverage - uses: codecov/codecov-action@v7 - with: - flags: unit-${{ matrix.php-version }}-${{ matrix.os }} - name: phpunit-${{ matrix.php-version }}-${{ matrix.os }} - token: ${{ secrets.CODECOV_TOKEN }} - - - name: Send coverage to Scrutinizer - uses: sudo-bot/action-scrutinizer@latest - # Do not run this step on forked versions of the main repository (example: contributor forks) - if: github.repository == 'phpmyadmin/motranslator' - with: - cli-args: "--format=php-clover build/logs/clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}" + test-php: + name: Test on PHP ${{ matrix.php-version }} (${{ matrix.extensions }}) + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.experimental }} + strategy: + matrix: + php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] + extensions: [':apcu', 'apcu'] + experimental: [false] + composer-options: [''] + include: + - {php-version: '8.6', experimental: true, composer-options: '--ignore-platform-req=php+', extensions: 'apcu'} + - {php-version: '8.6', experimental: true, composer-options: '--ignore-platform-req=php+', extensions: ':apcu'} + steps: + - name: Checkout code + uses: actions/checkout@v7 + with: + fetch-depth: 15 # Fetch some commits for Scrutinizer coverage upload + persist-credentials: false + + - name: Set up PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: mbstring, ${{ matrix.extensions }} + ini-values: "apc.enable_cli=1" + coverage: xdebug + + - name: Install Composer dependencies + uses: ramsey/composer-install@v4 + with: + dependency-versions: highest + composer-options: ${{ matrix.composer-options }} + + - name: Run PHP tests + run: composer run phpunit ${{ case(matrix.php-version >= '8.1', '-- --display-all-issues', '') }} + + - name: Send coverage + uses: codecov/codecov-action@v7 + with: + flags: unit-${{ matrix.php-version }} + name: phpunit-${{ matrix.php-version }} + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Send coverage to Scrutinizer + uses: sudo-bot/action-scrutinizer@latest + # Do not run this step on forked versions of the main repository (example: contributor forks) + if: github.repository == 'phpmyadmin/motranslator' + with: + cli-args: "--format=php-clover build/logs/clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}" diff --git a/tests/Cache/ApcuCacheTest.php b/tests/Cache/ApcuCacheTest.php index cc3be25..9909257 100644 --- a/tests/Cache/ApcuCacheTest.php +++ b/tests/Cache/ApcuCacheTest.php @@ -20,6 +20,8 @@ use function implode; use function sleep; +use const PHP_VERSION_ID; + /** * @covers \PhpMyAdmin\MoTranslator\Cache\ApcuCache */ @@ -199,7 +201,9 @@ public function testReloadOnMissHonorsLock(): void $cache = new ApcuCache(new MoParser(null), $locale, $domain); $method = new ReflectionMethod($cache, 'reloadOnMiss'); - $method->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $method->setAccessible(true); + } $key = 'mo_' . $locale . '.' . $domain . '.' . $msgid; apcu_entry($key, static function () use ($expected): string {