From 5109fb909cee28d187ea14523bcdfca03b6e9e72 Mon Sep 17 00:00:00 2001 From: otsch Date: Wed, 6 Nov 2024 18:53:21 +0100 Subject: [PATCH] Updates for PHP 8.4 * Run tests on PHP 8.4 in CI and merge PHPStan and CS Fixer jobs to improve performance. * Update PEST * Run PHP CS Fixer in parallel --- .github/workflows/ci.yml | 28 ++++--------------- .gitignore | 1 + .php-cs-fixer.php | 9 ++++-- CHANGELOG.md | 4 +++ composer.json | 16 +++++++---- src/Html2Text.php | 6 ++-- src/NodeConverters/Table/TableCell.php | 2 +- tests/DomDocumentFactoryTest.php | 2 +- tests/Html2TextTest.php | 4 +-- .../AbstractBlockElementConverterTest.php | 8 +++--- ...tractBlockElementWithDefaultMarginTest.php | 6 ++-- .../AbstractInlineElementConverterTest.php | 12 ++++---- .../AbstractNodeConverterTest.php | 14 +++++----- 13 files changed, 55 insertions(+), 57 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb8b94d..98b1010 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,31 +3,12 @@ name: CI on: pull_request jobs: - cs: - name: PHP CS Fixer - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - - - name: Install dependencies - run: composer install --prefer-dist --no-progress - - - name: Run PHP CS Fixer - run: composer cs - tests: name: PestPHP Tests runs-on: ubuntu-latest strategy: matrix: - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout code @@ -44,8 +25,8 @@ jobs: - name: Run tests run: composer test - stan: - name: PHPStan + stanAndCs: + name: Static Analysis (PHPStan) and Code Style (PHP CS Fixer) runs-on: ubuntu-latest steps: @@ -62,3 +43,6 @@ jobs: - name: Run PHPStan run: composer stan + + - name: Run PHP CS Fixer + run: composer cs diff --git a/.gitignore b/.gitignore index 10a3463..a995a5f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ vendor .php-cs-fixer.cache .phpunit.result.cache +.phpunit.cache composer.lock diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 59b02ea..2b78156 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -2,17 +2,20 @@ use PhpCsFixer\Config; use PhpCsFixer\Finder; +use PhpCsFixer\Runner\Parallel\ParallelConfigFactory; $finder = Finder::create() ->exclude(['.github', 'bin', 'git-hooks']) ->in(__DIR__); -$config = new Config(); -return $config->setFinder($finder) +return (new Config()) + ->setFinder($finder) + ->setParallelConfig(ParallelConfigFactory::detect()) ->setRules([ '@PER-CS' => true, 'strict_param' => true, 'array_syntax' => ['syntax' => 'short'], 'no_unused_imports' => true, ]) - ->setRiskyAllowed(true); + ->setRiskyAllowed(true) + ->setUsingCache(true); diff --git a/CHANGELOG.md b/CHANGELOG.md index 7106c7d..92d212a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.1.2] - 2024-11-06 +### Fixed +* Improvements for deprecations in PHP 8.4. + ## [0.1.1] - 2024-02-21 ### Fixed - An issue that occurred when the HTML contains something that looks like a charset definition within a `