From 832ddbbc6a31d7c2e233692aba655cfb2420b857 Mon Sep 17 00:00:00 2001 From: Jay Klehr Date: Tue, 16 Apr 2024 15:42:35 -0600 Subject: [PATCH] Preparing for PHP 8.3 (#282) --- .github/workflows/build.yml | 104 +++++++++++++++---------------- .gitignore | 1 + composer.json | 8 +-- grumphp.yml.dist | 1 + phpunit.xml.dist | 24 +++++-- phpunit.xml.dist.bak | 23 ------- tests/Zend/Locale/FormatTest.php | 4 +- 7 files changed, 78 insertions(+), 87 deletions(-) delete mode 100644 phpunit.xml.dist.bak diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e422fff..ba1d512 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.gitignore b/.gitignore index e5b8007..6a8821b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .php_cs.cache .phpunit.result.cache .php-cs-fixer.cache +.phpunit.cache \ No newline at end of file diff --git a/composer.json b/composer.json index e70bfef..07e9e85 100644 --- a/composer.json +++ b/composer.json @@ -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", @@ -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" }, diff --git a/grumphp.yml.dist b/grumphp.yml.dist index 70ff16c..8c6ae67 100644 --- a/grumphp.yml.dist +++ b/grumphp.yml.dist @@ -10,6 +10,7 @@ grumphp: config: .php-cs-fixer.php phpstan: configuration: phpstan.neon + memory_limit: "768M" phpunit: metadata: priority: 100 diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 9e3f6bd..498b606 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,10 +1,17 @@ - - - - ./src - - + @@ -14,4 +21,9 @@ ./tests + + + ./src + + diff --git a/phpunit.xml.dist.bak b/phpunit.xml.dist.bak deleted file mode 100644 index ea8e60d..0000000 --- a/phpunit.xml.dist.bak +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - ./tests - - - - - ./src - - - diff --git a/tests/Zend/Locale/FormatTest.php b/tests/Zend/Locale/FormatTest.php index f129436..6b0ff32 100644 --- a/tests/Zend/Locale/FormatTest.php +++ b/tests/Zend/Locale/FormatTest.php @@ -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); }