diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 9aaa3a8..e7c840d 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -18,15 +18,12 @@ jobs: strategy: matrix: + php-versions: ['8.1', '8.2', '8.3'] actions: - name: 'Composer Validate' run: composer validate - - - name: 'PHP-CS-Fixer' - run: composer lint - - name: 'Rector' run: composer rector @@ -35,14 +32,14 @@ jobs: name: 'PHPStan' run: composer phpstan - name: ${{ matrix.actions.name }} + name: ${{ matrix.actions.name }} - ${{ matrix.php-versions }} steps: - uses: actions/checkout@v4 - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: ${{ matrix.php-versions }} coverage: none - uses: ramsey/composer-install@v3 diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 16db377..d943495 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -13,14 +13,16 @@ use CodeIgniter\CodingStandard\CodeIgniter4; use Nexus\CsConfig\Factory; +use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer; +use Nexus\CsConfig\FixerGenerator; use PhpCsFixer\Finder; $finder = Finder::create() ->files() ->in([ - __DIR__ . '/src/', - __DIR__ . '/tests/', - __DIR__ . '/config/', + __DIR__ . '/src', + __DIR__ . '/config', + __DIR__ . '/tests', ]) ->append([ __FILE__, @@ -33,12 +35,23 @@ ]; $options = [ - 'finder' => $finder, - 'cacheFile' => '.php-cs-fixer.cache', + 'finder' => $finder, + 'cacheFile' => '.php-cs-fixer.cache', ]; -return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( +$config = Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( 'CodeIgniter Rector', 'PHPDevsr', 'admin@phpdevsr.com' ); + +// @TODO: remove this check when support for PHP 7.4 is dropped +if (PHP_VERSION_ID >= 80000) { + $config + ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) + ->setRules(array_merge($config->getRules(), [ + NoCodeSeparatorCommentFixer::name() => true, + ])); +} + +return $config; diff --git a/README.md b/README.md index bafe308..c687352 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Rector Rules for Codeigniter4 -[![Tests](https://github.com/PHPDevsr/rector-codeigniter4/actions/workflows/tests.yaml/badge.svg)](https://github.com/PHPDevsr/rector-codeigniter4/actions/workflows/test-phpunit.yaml) +[![Tests](https://github.com/PHPDevsr/rector-codeigniter4/actions/workflows/test-phpunit.yaml/badge.svg)](https://github.com/PHPDevsr/rector-codeigniter4/actions/workflows/test-phpunit.yaml) [![Code Analysis](https://github.com/PHPDevsr/rector-codeigniter4/actions/workflows/code_analysis.yaml/badge.svg)](https://github.com/PHPDevsr/rector-codeigniter4/actions/workflows/code_analysis.yaml) [![Packagist Downloads](https://img.shields.io/packagist/dm/PHPDevsr/rector-codeigniter4)](https://packagist.org/packages/PHPDevsr/rector-codeigniter4/stats) [![Packagist Version](https://img.shields.io/packagist/v/PHPDevsr/rector-codeigniter4)](https://packagist.org/packages/PHPDevsr/rector-codeigniter4)