-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add trait for compatibility with 3.59.2 and 3.59.3 * Cleanup solution and add note about why this hack has been introduced * Suppress PHPStan for method_exists call --------- Co-authored-by: ErickSkrauch <[email protected]>
- Loading branch information
1 parent
1c1c04b
commit 91e7c98
Showing
4 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace ErickSkrauch\PhpCsFixer\Fixer; | ||
|
||
use PhpCsFixer\AbstractFixer; | ||
|
||
// PHP-CS-Fixer 3.59.3 has changed implementation of the AbstractFixer by removing method `configure` from it | ||
// and introducing a separate trait \PhpCsFixer\Fixer\ConfigurableFixerTrait with this method inside. | ||
// To mitigate these changes and maintain compatibility with older versions of PHP-CS-Fixer, this solution was created. | ||
// | ||
// Commit: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/commit/064efa1f#diff-e1fb45756cd1d53b6d67072d8a026692c07af55617018229b0bf4ab6c22e3e53L105 | ||
// See https://github.com/erickskrauch/php-cs-fixer-custom-fixers/issues/12 | ||
// @phpstan-ignore-next-line sometimes it exists, sometime it's not ;) | ||
if (method_exists(AbstractFixer::class, 'configure')) { | ||
trait ConfigurableFixerTrait { | ||
|
||
} | ||
} else { | ||
trait ConfigurableFixerTrait { | ||
use \PhpCsFixer\Fixer\ConfigurableFixerTrait; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters