Skip to content

Commit

Permalink
Show warning regarding PHP 8.4 support (laravel#312)
Browse files Browse the repository at this point in the history
* Show warning regarding PHP 8.4 support

* Fix workflows

* Update DefaultCommand.php

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
Jubeki and taylorotwell authored Nov 29, 2024
1 parent fc6a920 commit 43a25d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ jobs:
composer install
- name: Execute lint tests with Laravel preset
if: matrix.php == '8.4'
run: PINT_IGNORE_ENV=1 ./pint --test

- name: Execute lint tests with Laravel preset
if: matrix.php != '8.4'
run: ./pint --test

- name: Execute static analysis
Expand Down
8 changes: 8 additions & 0 deletions app/Commands/DefaultCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ protected function configure()
*/
public function handle($fixCode, $elaborateSummary)
{
if (! ($_ENV['PINT_IGNORE_ENV'] ?? false) && version_compare(PHP_VERSION, '8.4.0', '>=')) {
$this->warn('PHP 8.4 is not currently supported by PHP CS Fixer and you may encounter unexpected behavior.');
$this->warn('You can still force Pint to run by setting the environment variable:');
$this->warn('PINT_IGNORE_ENV=1 vendor/bin/pint');

return 1;
}

[$totalFiles, $changes] = $fixCode->execute();

return $elaborateSummary->execute($totalFiles, $changes);
Expand Down

0 comments on commit 43a25d9

Please sign in to comment.