Skip to content

Commit

Permalink
Merge branch 'erickskrauch:master' into feature/add-tests-php-84
Browse files Browse the repository at this point in the history
  • Loading branch information
alamirault authored Nov 25, 2024
2 parents b3d7123 + 36fb7f8 commit 876f1b9
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.3.0] - 2024-06-21
### Added
- Enh #4: Introduce `ErickSkrauch\ordered_overrides` fixer.

### Fixed
- Fix #14: Ensure compatibility with PHP-CS-Fixer 3.59.3 (alamirault).

## [1.2.4] - 2024-01-15
### Fixed
- Bug #9: `ErickSkrauch/align_multiline_parameters` now correctly aligns variadic arguments.
Expand Down Expand Up @@ -44,7 +49,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Initial implementation (extracted from [`elyby/php-code-style`](https://github.com/elyby/php-code-style/tree/0.5.0)).

[Unreleased]: https://github.com/erickskrauch/php-cs-fixer-custom-fixers/compare/1.2.4...HEAD
[Unreleased]: https://github.com/erickskrauch/php-cs-fixer-custom-fixers/compare/1.3.0...HEAD
[1.3.0]: https://github.com/erickskrauch/php-cs-fixer-custom-fixers/compare/1.3.0...1.2.4
[1.2.4]: https://github.com/erickskrauch/php-cs-fixer-custom-fixers/compare/1.2.3...1.2.4
[1.2.3]: https://github.com/erickskrauch/php-cs-fixer-custom-fixers/compare/1.2.2...1.2.3
[1.2.2]: https://github.com/erickskrauch/php-cs-fixer-custom-fixers/compare/1.2.1...1.2.2
Expand Down
24 changes: 24 additions & 0 deletions src/Fixer/ConfigurableFixerTrait.php
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;

}
}
2 changes: 2 additions & 0 deletions src/Fixer/FunctionNotation/AlignMultilineParametersFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace ErickSkrauch\PhpCsFixer\Fixer\FunctionNotation;

use ErickSkrauch\PhpCsFixer\Fixer\AbstractFixer;
use ErickSkrauch\PhpCsFixer\Fixer\ConfigurableFixerTrait;
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver;
Expand Down Expand Up @@ -34,6 +35,7 @@
* }
*/
final class AlignMultilineParametersFixer extends AbstractFixer implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface {
use ConfigurableFixerTrait;

/**
* @internal
Expand Down
2 changes: 2 additions & 0 deletions src/Fixer/Whitespace/BlankLineAroundClassBodyFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace ErickSkrauch\PhpCsFixer\Fixer\Whitespace;

use ErickSkrauch\PhpCsFixer\Fixer\AbstractFixer;
use ErickSkrauch\PhpCsFixer\Fixer\ConfigurableFixerTrait;
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver;
Expand Down Expand Up @@ -31,6 +32,7 @@
* } $configuration
*/
final class BlankLineAroundClassBodyFixer extends AbstractFixer implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface {
use ConfigurableFixerTrait;

/**
* @internal
Expand Down
2 changes: 2 additions & 0 deletions src/Fixer/Whitespace/MultilineIfStatementBracesFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace ErickSkrauch\PhpCsFixer\Fixer\Whitespace;

use ErickSkrauch\PhpCsFixer\Fixer\AbstractFixer;
use ErickSkrauch\PhpCsFixer\Fixer\ConfigurableFixerTrait;
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver;
Expand All @@ -23,6 +24,7 @@
* } $configuration
*/
final class MultilineIfStatementBracesFixer extends AbstractFixer implements ConfigurableFixerInterface, WhitespacesAwareFixerInterface {
use ConfigurableFixerTrait;

/**
* @internal
Expand Down

0 comments on commit 876f1b9

Please sign in to comment.