Skip to content

Commit

Permalink
Preparing for PHP 8.3 (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydiablo authored Apr 16, 2024
1 parent a6d0cf8 commit 832ddbb
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 87 deletions.
104 changes: 52 additions & 52 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
name: Build
on:
push:
branches:
- master
pull_request:
branches:
- master
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: PHP ${{ matrix.php-versions }} ${{ matrix.composer-args }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4', '8.0', '8.1', '8.2']
composer-args: ['', '--prefer-lowest']
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@2.25.1
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring
coverage: pcov
tools: cs2pr
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: php${{ matrix.php-versions }}-composer-${{ matrix.composer-args }}-${{ hashFiles('**/composer.json') }}
restore-keys: php${{ matrix.php-versions }}-composer-${{ matrix.composer-args }}-
- name: Install Dependencies
run: |
composer update --no-progress --no-suggest --prefer-stable --optimize-autoloader ${{ matrix.composer-args }}
- name: PHPStan
run: composer phpstan
- name: Code Style Check
env:
PHP_CS_FIXER_IGNORE_ENV: true
run: composer style-check -- --format=checkstyle | cs2pr
- name: Test
run: composer test-with-coverage
- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
files: ./clover.xml
verbose: true
build:
name: PHP ${{ matrix.php-versions }} ${{ matrix.composer-args }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ["8.0", "8.1", "8.2", "8.3"]
composer-args: ["", "--prefer-lowest"]
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@2.30.2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring
coverage: pcov
tools: cs2pr
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: php${{ matrix.php-versions }}-composer-${{ matrix.composer-args }}-${{ hashFiles('**/composer.json') }}
restore-keys: php${{ matrix.php-versions }}-composer-${{ matrix.composer-args }}-
- name: Install Dependencies
run: |
composer update --no-progress --no-suggest --prefer-stable --optimize-autoloader ${{ matrix.composer-args }}
- name: PHPStan
run: composer phpstan
- name: Code Style Check
env:
PHP_CS_FIXER_IGNORE_ENV: true
run: composer style-check -- --format=checkstyle | cs2pr
- name: Test
run: composer test-with-coverage
- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
files: ./clover.xml
verbose: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.php_cs.cache
.phpunit.result.cache
.php-cs-fixer.cache
.phpunit.cache
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"license": "BSD-3-Clause",
"require": {
"ext-iconv": "*",
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0",
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"diablomedia/zendframework1-exception": "^1.0.0",
"diablomedia/zendframework1-registry": "^1.0.2",
"diablomedia/zendframework1-xml": "^1.0.5",
Expand All @@ -36,9 +36,9 @@
}
},
"require-dev": {
"phpunit/phpunit": "^9.5.10",
"phpstan/phpstan": "1.10.15",
"friendsofphp/php-cs-fixer": "3.16.0",
"phpunit/phpunit": "^9.6.19 || ^10.5.18",
"phpstan/phpstan": "1.10.67",
"friendsofphp/php-cs-fixer": "3.53.0",
"maglnet/composer-require-checker": "^3.0.0",
"phpro/grumphp-shim": "^1.5.0"
},
Expand Down
1 change: 1 addition & 0 deletions grumphp.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ grumphp:
config: .php-cs-fixer.php
phpstan:
configuration: phpstan.neon
memory_limit: "768M"
phpunit:
metadata:
priority: 100
Expand Down
24 changes: 18 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" beStrictAboutTestsThatDoNotTestAnything="true" backupGlobals="true" stderr="true" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
beStrictAboutTestsThatDoNotTestAnything="true"
backupGlobals="true"
stderr="true"
colors="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
>
<php>
<const name="TESTS_ZEND_LOCALE_FORMAT_SETLOCALE" value="false"/>
<const name="TESTS_ZEND_LOCALE_BCMATH_ENABLED" value="true"/>
Expand All @@ -14,4 +21,9 @@
<directory>./tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
23 changes: 0 additions & 23 deletions phpunit.xml.dist.bak

This file was deleted.

4 changes: 2 additions & 2 deletions tests/Zend/Locale/FormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public function tearDown(): void
// I'm anticipating possible platform inconsistencies, so I'm leaving some debug comments for now.
//echo '<<<', setlocale(LC_NUMERIC, '0'); // show locale before changing
setlocale(LC_ALL, 'C'); // attempt to restore global setting i.e. test teardown
//echo '>>>', setlocale(LC_NUMERIC, '0'); // show locale after changing
//echo "\n";
//echo '>>>', setlocale(LC_NUMERIC, '0'); // show locale after changing
//echo "\n";
} elseif (defined('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE')) {
setlocale(LC_ALL, TESTS_ZEND_LOCALE_FORMAT_SETLOCALE);
}
Expand Down

0 comments on commit 832ddbb

Please sign in to comment.