diff --git a/bin/ecs.php b/bin/ecs.php index 6177f183ba..23c1eada2f 100755 --- a/bin/ecs.php +++ b/bin/ecs.php @@ -19,7 +19,7 @@ define('__ECS_RUNNING__', true); -# 1. autoload +// 1. autoload $autoloadIncluder = new ECSAutoloadIncluder(); $autoloadIncluder->includeCwdVendorAutoloadIfExists(); diff --git a/build/target-repository/README.md b/build/target-repository/README.md index d828564ff6..0d3ef1d1e2 100644 --- a/build/target-repository/README.md +++ b/build/target-repository/README.md @@ -89,6 +89,42 @@ return ECSConfig::configure()
+### Prepared Sets + +`->withPreparedSets()` bundles curated rule sets. Enable the whole `common` set, or pick single topics: + +```php +use Symplify\EasyCodingStandard\Config\ECSConfig; + +return ECSConfig::configure() + ->withPaths([__DIR__ . '/src', __DIR__ . '/tests']) + ->withPreparedSets( + arrays: true, + spaces: true, + namespaces: true, + docblocks: true, + controlStructures: true, + comments: true, + casing: true, + cleanup: true, + ); +``` + +| Set | What it covers | +| --- | --- | +| `arrays` | array syntax, spacing, trailing commas, indentation | +| `spaces` | whitespace, operator/type spacing, blank lines | +| `namespaces` | imports ordering, unused/needless-alias imports | +| `docblocks` | phpdoc tags, types, alignment, cleanup | +| `controlStructures` | control flow, casing, operators, class structure | +| `comments` | comment style, spacing, empty-comment cleanup | +| `casing` | native function/type, magic method, literal casing | +| `cleanup` | dead statements, useless returns/casts, unused closure imports | + +Or enable everything at once with `->withPreparedSets(common: true)`. + +
+ Do you want to include one of sets from [php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst)? You can: diff --git a/config/set/common.php b/config/set/common.php index 156b6d8f26..8ae083f43d 100644 --- a/config/set/common.php +++ b/config/set/common.php @@ -13,5 +13,7 @@ SetList::DOCBLOCK, SetList::NAMESPACES, SetList::SPACES, + SetList::CASING, + SetList::CLEANUP, SetList::CLEAN_CODE, ]); diff --git a/config/set/common/casing.php b/config/set/common/casing.php new file mode 100644 index 0000000000..c98d491647 --- /dev/null +++ b/config/set/common/casing.php @@ -0,0 +1,19 @@ +withRules([ + NativeFunctionCasingFixer::class, + NativeTypeDeclarationCasingFixer::class, + IntegerLiteralCaseFixer::class, + MagicMethodCasingFixer::class, + ClassReferenceNameCasingFixer::class, + ]); diff --git a/config/set/common/cleanup.php b/config/set/common/cleanup.php new file mode 100644 index 0000000000..3281d3c273 --- /dev/null +++ b/config/set/common/cleanup.php @@ -0,0 +1,19 @@ +withRules([ + NoEmptyStatementFixer::class, + NoUselessReturnFixer::class, + LambdaNotUsedImportFixer::class, + NoNullPropertyInitializationFixer::class, + NoShortBoolCastFixer::class, + ]); diff --git a/config/set/common/comments.php b/config/set/common/comments.php index e24cf765e8..5bb82a9d3f 100644 --- a/config/set/common/comments.php +++ b/config/set/common/comments.php @@ -3,7 +3,17 @@ declare(strict_types=1); use PHP_CodeSniffer\Standards\Generic\Sniffs\VersionControl\GitMergeConflictSniff; +use PhpCsFixer\Fixer\Comment\MultilineCommentOpeningClosingFixer; +use PhpCsFixer\Fixer\Comment\NoEmptyCommentFixer; +use PhpCsFixer\Fixer\Comment\SingleLineCommentSpacingFixer; +use PhpCsFixer\Fixer\Comment\SingleLineCommentStyleFixer; use Symplify\EasyCodingStandard\Config\ECSConfig; return ECSConfig::configure() - ->withRules([GitMergeConflictSniff::class]); + ->withRules([ + GitMergeConflictSniff::class, + NoEmptyCommentFixer::class, + SingleLineCommentSpacingFixer::class, + SingleLineCommentStyleFixer::class, + MultilineCommentOpeningClosingFixer::class, + ]); diff --git a/config/set/common/namespaces.php b/config/set/common/namespaces.php index ee345d61b6..d2b2b2301d 100644 --- a/config/set/common/namespaces.php +++ b/config/set/common/namespaces.php @@ -2,12 +2,16 @@ declare(strict_types=1); +use PhpCsFixer\Fixer\Import\NoUnneededImportAliasFixer; use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer; use PhpCsFixer\Fixer\Import\OrderedImportsFixer; use PhpCsFixer\Fixer\NamespaceNotation\SingleBlankLineBeforeNamespaceFixer; use Symplify\EasyCodingStandard\Config\ECSConfig; return ECSConfig::configure() - ->withRules( - [NoUnusedImportsFixer::class, OrderedImportsFixer::class, SingleBlankLineBeforeNamespaceFixer::class] - ); + ->withRules([ + NoUnusedImportsFixer::class, + OrderedImportsFixer::class, + SingleBlankLineBeforeNamespaceFixer::class, + NoUnneededImportAliasFixer::class, + ]); diff --git a/packages/coding-standard/src/TokenRunner/TokenFinder.php b/packages/coding-standard/src/TokenRunner/TokenFinder.php index 9158bf2403..422bae71c4 100644 --- a/packages/coding-standard/src/TokenRunner/TokenFinder.php +++ b/packages/coding-standard/src/TokenRunner/TokenFinder.php @@ -13,7 +13,7 @@ final class TokenFinder /** * @param Tokens $tokens */ - public function getPreviousMeaningfulToken(Tokens $tokens, int | Token $position): Token + public function getPreviousMeaningfulToken(Tokens $tokens, int|Token $position): Token { if (is_int($position)) { return $this->findPreviousTokenByPosition($tokens, $position); diff --git a/src/Config/ECSConfig.php b/src/Config/ECSConfig.php index 26125cdcfc..0b140f8be1 100644 --- a/src/Config/ECSConfig.php +++ b/src/Config/ECSConfig.php @@ -201,7 +201,7 @@ public function reportingRealPath(bool $absolute = true): void } /** - * @link https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst + * @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst * @param string[] $setNames */ public function dynamicSets(array $setNames): void diff --git a/src/Config/Level/ArrayLevel.php b/src/Config/Level/ArrayLevel.php index a828113d4c..cbd21569b3 100644 --- a/src/Config/Level/ArrayLevel.php +++ b/src/Config/Level/ArrayLevel.php @@ -6,12 +6,15 @@ use PHP_CodeSniffer\Sniffs\Sniff; use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer; +use PhpCsFixer\Fixer\ArrayNotation\NoMultilineWhitespaceAroundDoubleArrowFixer; use PhpCsFixer\Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer; +use PhpCsFixer\Fixer\ArrayNotation\NoWhitespaceInEmptyArrayFixer; use PhpCsFixer\Fixer\ArrayNotation\TrimArraySpacesFixer; use PhpCsFixer\Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer; use PhpCsFixer\Fixer\Basic\NoTrailingCommaInSinglelineFixer; use PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer; use PhpCsFixer\Fixer\FixerInterface; +use PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer; use PhpCsFixer\Fixer\Whitespace\ArrayIndentationFixer; use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer; use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer; @@ -34,10 +37,13 @@ final class ArrayLevel NoWhitespaceBeforeCommaInArrayFixer::class, WhitespaceAfterCommaInArrayFixer::class, TrimArraySpacesFixer::class, + NoWhitespaceInEmptyArrayFixer::class, + NoMultilineWhitespaceAroundDoubleArrowFixer::class, NoTrailingCommaInSinglelineFixer::class, // syntax normalization ArraySyntaxFixer::class, + ListSyntaxFixer::class, TrailingCommaInMultilineFixer::class, // invasive layout changes @@ -57,6 +63,9 @@ final class ArrayLevel ArraySyntaxFixer::class => [ 'syntax' => 'short', ], + ListSyntaxFixer::class => [ + 'syntax' => 'short', + ], TrailingCommaInMultilineFixer::class => [ 'elements' => [TrailingCommaInMultilineFixer::ELEMENTS_ARRAYS], ], diff --git a/src/Config/Level/ControlStructuresLevel.php b/src/Config/Level/ControlStructuresLevel.php index 9ba95af700..b09a9be1b2 100644 --- a/src/Config/Level/ControlStructuresLevel.php +++ b/src/Config/Level/ControlStructuresLevel.php @@ -10,14 +10,27 @@ use PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer; use PhpCsFixer\Fixer\ClassNotation\SelfAccessorFixer; use PhpCsFixer\Fixer\ClassNotation\SingleClassElementPerStatementFixer; +use PhpCsFixer\Fixer\ControlStructure\IncludeFixer; +use PhpCsFixer\Fixer\ControlStructure\NoAlternativeSyntaxFixer; +use PhpCsFixer\Fixer\ControlStructure\NoSuperfluousElseifFixer; use PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer; +use PhpCsFixer\Fixer\ControlStructure\SimplifiedIfReturnFixer; +use PhpCsFixer\Fixer\ControlStructure\SwitchContinueToBreakFixer; use PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer; use PhpCsFixer\Fixer\FixerInterface; +use PhpCsFixer\Fixer\FunctionNotation\NullableTypeDeclarationForDefaultNullValueFixer; use PhpCsFixer\Fixer\LanguageConstruct\ExplicitIndirectVariableFixer; use PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer; use PhpCsFixer\Fixer\LanguageConstruct\IsNullFixer; +use PhpCsFixer\Fixer\Operator\AssignNullCoalescingToCoalesceEqualFixer; +use PhpCsFixer\Fixer\Operator\LongToShorthandOperatorFixer; use PhpCsFixer\Fixer\Operator\NewWithBracesFixer; +use PhpCsFixer\Fixer\Operator\NoUselessConcatOperatorFixer; +use PhpCsFixer\Fixer\Operator\NoUselessNullsafeOperatorFixer; +use PhpCsFixer\Fixer\Operator\ObjectOperatorWithoutWhitespaceFixer; use PhpCsFixer\Fixer\Operator\StandardizeIncrementFixer; +use PhpCsFixer\Fixer\Operator\StandardizeNotEqualsFixer; +use PhpCsFixer\Fixer\Operator\TernaryToNullCoalescingFixer; use PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer; use PhpCsFixer\Fixer\StringNotation\ExplicitStringVariableFixer; use PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer; @@ -45,6 +58,16 @@ final class ControlStructuresLevel FunctionToConstantFixer::class, StandardizeIncrementFixer::class, NewWithBracesFixer::class, + NullableTypeDeclarationForDefaultNullValueFixer::class, + + // operator spacing and simplification + ObjectOperatorWithoutWhitespaceFixer::class, + StandardizeNotEqualsFixer::class, + NoUselessConcatOperatorFixer::class, + NoUselessNullsafeOperatorFixer::class, + LongToShorthandOperatorFixer::class, + TernaryToNullCoalescingFixer::class, + AssignNullCoalescingToCoalesceEqualFixer::class, // string and variable handling ExplicitStringVariableFixer::class, @@ -55,9 +78,16 @@ final class ControlStructuresLevel ClassDefinitionFixer::class, SingleClassElementPerStatementFixer::class, + // control-flow normalization + IncludeFixer::class, + NoAlternativeSyntaxFixer::class, + NoSuperfluousElseifFixer::class, + SwitchContinueToBreakFixer::class, + // invasive control-flow / ordering changes YodaStyleFixer::class, NoUselessElseFixer::class, + SimplifiedIfReturnFixer::class, OrderedClassElementsFixer::class, ]; diff --git a/src/Config/Level/DocblockLevel.php b/src/Config/Level/DocblockLevel.php index 23ca458a5d..22cd53894e 100644 --- a/src/Config/Level/DocblockLevel.php +++ b/src/Config/Level/DocblockLevel.php @@ -7,12 +7,22 @@ use PHP_CodeSniffer\Sniffs\Sniff; use PhpCsFixer\Fixer\Comment\NoTrailingWhitespaceInCommentFixer; use PhpCsFixer\Fixer\FixerInterface; +use PhpCsFixer\Fixer\Phpdoc\AlignMultilineCommentFixer; +use PhpCsFixer\Fixer\Phpdoc\NoBlankLinesAfterPhpdocFixer; use PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer; use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer; use PhpCsFixer\Fixer\Phpdoc\PhpdocIndentFixer; +use PhpCsFixer\Fixer\Phpdoc\PhpdocInlineTagNormalizerFixer; use PhpCsFixer\Fixer\Phpdoc\PhpdocLineSpanFixer; +use PhpCsFixer\Fixer\Phpdoc\PhpdocNoAccessFixer; +use PhpCsFixer\Fixer\Phpdoc\PhpdocNoAliasTagFixer; +use PhpCsFixer\Fixer\Phpdoc\PhpdocNoDuplicateTypesFixer; use PhpCsFixer\Fixer\Phpdoc\PhpdocNoEmptyReturnFixer; +use PhpCsFixer\Fixer\Phpdoc\PhpdocNoPackageFixer; +use PhpCsFixer\Fixer\Phpdoc\PhpdocOrderByValueFixer; use PhpCsFixer\Fixer\Phpdoc\PhpdocReturnSelfReferenceFixer; +use PhpCsFixer\Fixer\Phpdoc\PhpdocScalarFixer; +use PhpCsFixer\Fixer\Phpdoc\PhpdocTagCasingFixer; use PhpCsFixer\Fixer\Phpdoc\PhpdocTrimConsecutiveBlankLineSeparationFixer; use PhpCsFixer\Fixer\Phpdoc\PhpdocTrimFixer; use PhpCsFixer\Fixer\Phpdoc\PhpdocTypesFixer; @@ -68,14 +78,24 @@ final class DocblockLevel PhpdocTrimFixer::class, PhpdocTrimConsecutiveBlankLineSeparationFixer::class, PhpdocIndentFixer::class, + NoBlankLinesAfterPhpdocFixer::class, + AlignMultilineCommentFixer::class, // type / formatting normalization + PhpdocTagCasingFixer::class, + PhpdocInlineTagNormalizerFixer::class, + PhpdocNoDuplicateTypesFixer::class, + PhpdocScalarFixer::class, PhpdocTypesFixer::class, PhpdocLineSpanFixer::class, PhpdocVarWithoutNameFixer::class, PhpdocReturnSelfReferenceFixer::class, + PhpdocOrderByValueFixer::class, // dropping content + PhpdocNoAliasTagFixer::class, + PhpdocNoAccessFixer::class, + PhpdocNoPackageFixer::class, NoEmptyPhpdocFixer::class, PhpdocNoEmptyReturnFixer::class, RemoveUselessDefaultCommentFixer::class, diff --git a/src/Config/Level/SpacesLevel.php b/src/Config/Level/SpacesLevel.php index 9c7ed11be5..04742a82d4 100644 --- a/src/Config/Level/SpacesLevel.php +++ b/src/Config/Level/SpacesLevel.php @@ -28,6 +28,7 @@ use PhpCsFixer\Fixer\Whitespace\NoSpacesAroundOffsetFixer; use PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer; use PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer; +use PhpCsFixer\Fixer\Whitespace\TypesSpacesFixer; use Symplify\CodingStandard\Fixer\Spacing\StandaloneLinePromotedPropertyFixer; /** @@ -65,6 +66,7 @@ final class SpacesLevel TernaryOperatorSpacesFixer::class, ReturnTypeDeclarationFixer::class, TypeDeclarationSpacesFixer::class, + TypesSpacesFixer::class, SuperfluousWhitespaceSniff::class, // configurable, more impactful diff --git a/src/Configuration/ECSConfigBuilder.php b/src/Configuration/ECSConfigBuilder.php index 753baa9d7b..9fe12796c3 100644 --- a/src/Configuration/ECSConfigBuilder.php +++ b/src/Configuration/ECSConfigBuilder.php @@ -63,7 +63,7 @@ final class ECSConfigBuilder private array $rules = []; /** - * @var array, mixed> + * @var array, mixed> */ private array $rulesWithConfiguration = []; @@ -252,6 +252,10 @@ public function withPreparedSets( bool $namespaces = false, /** @see SetList::CONTROL_STRUCTURES */ bool $controlStructures = false, + /** @see SetList::CASING */ + bool $casing = false, + /** @see SetList::CLEANUP */ + bool $cleanup = false, /** * @deprecated as never worked, used different rules. Use Rector instead. * @see SetList::PHPUNIT @@ -286,6 +290,8 @@ public function withPreparedSets( 'docblocks' => $docblocks, 'controlStructures' => $controlStructures, 'comments' => $comments, + 'casing' => $casing, + 'cleanup' => $cleanup, ]))) !== []) { throw new SuperfluousConfigurationException( sprintf( @@ -324,6 +330,14 @@ public function withPreparedSets( if ($comments) { $this->sets[] = SetList::COMMENTS; } + + if ($casing) { + $this->sets[] = SetList::CASING; + } + + if ($cleanup) { + $this->sets[] = SetList::CLEANUP; + } } if ($strict) { @@ -725,7 +739,7 @@ public function withSpacing(?string $indentation = null, ?string $lineEnding = n } /** - * @param class-string<(FixerInterface | Sniff)> $checkerClass + * @param class-string<(FixerInterface|Sniff)> $checkerClass * @param mixed[] $configuration */ public function withConfiguredRule(string $checkerClass, array $configuration): self diff --git a/src/FileSystem/PathNormalizer.php b/src/FileSystem/PathNormalizer.php index bd82d0e301..49be64625c 100644 --- a/src/FileSystem/PathNormalizer.php +++ b/src/FileSystem/PathNormalizer.php @@ -20,7 +20,7 @@ final class PathNormalizer /** * @see https://regex101.com/r/d4F5Fm/1 */ - private const string SCHEME_PATH_REGEX = '#^([a-z]+)\\:\\/\\/(.+)#'; + private const string SCHEME_PATH_REGEX = '#^([a-z]+)\:\/\/(.+)#'; /** * @see https://regex101.com/r/no28vw/1 diff --git a/src/Skipper/Contract/SkipVoterInterface.php b/src/Skipper/Contract/SkipVoterInterface.php index 2918d8962e..8c914a01f3 100644 --- a/src/Skipper/Contract/SkipVoterInterface.php +++ b/src/Skipper/Contract/SkipVoterInterface.php @@ -8,7 +8,7 @@ interface SkipVoterInterface { - public function match(string | object $element): bool; + public function match(string|object $element): bool; - public function shouldSkip(string | object $element, SplFileInfo | string $file): bool; + public function shouldSkip(string|object $element, SplFileInfo|string $file): bool; } diff --git a/src/Skipper/Matcher/FileInfoMatcher.php b/src/Skipper/Matcher/FileInfoMatcher.php index f38f880dff..58f13454cd 100644 --- a/src/Skipper/Matcher/FileInfoMatcher.php +++ b/src/Skipper/Matcher/FileInfoMatcher.php @@ -21,7 +21,7 @@ public function __construct( /** * @param string[] $filePatterns */ - public function doesFileInfoMatchPatterns(SplFileInfo | string $fileInfo, array $filePatterns): bool + public function doesFileInfoMatchPatterns(SplFileInfo|string $fileInfo, array $filePatterns): bool { return array_any( $filePatterns, @@ -32,7 +32,7 @@ public function doesFileInfoMatchPatterns(SplFileInfo | string $fileInfo, array /** * Supports both relative and absolute $file path. They differ for PHP-CS-Fixer and PHP_CodeSniffer. */ - private function doesFileInfoMatchPattern(SplFileInfo | string $file, string $ignoredPath): bool + private function doesFileInfoMatchPattern(SplFileInfo|string $file, string $ignoredPath): bool { $filePath = $file instanceof SplFileInfo ? $file->getRealPath() : $file; diff --git a/src/Skipper/SkipVoter/ClassAndCodeSkipVoter.php b/src/Skipper/SkipVoter/ClassAndCodeSkipVoter.php index 59fbf7ecff..83f063fb2f 100644 --- a/src/Skipper/SkipVoter/ClassAndCodeSkipVoter.php +++ b/src/Skipper/SkipVoter/ClassAndCodeSkipVoter.php @@ -20,7 +20,7 @@ public function __construct( ) { } - public function match(string | object $element): bool + public function match(string|object $element): bool { if (! is_string($element)) { return false; @@ -29,7 +29,7 @@ public function match(string | object $element): bool return substr_count($element, '.') === 1; } - public function shouldSkip(string | object $element, SplFileInfo | string $file): bool + public function shouldSkip(string|object $element, SplFileInfo|string $file): bool { if (is_object($element)) { return false; diff --git a/src/Skipper/SkipVoter/ClassSkipVoter.php b/src/Skipper/SkipVoter/ClassSkipVoter.php index 3ad72af82a..2829bf6d05 100644 --- a/src/Skipper/SkipVoter/ClassSkipVoter.php +++ b/src/Skipper/SkipVoter/ClassSkipVoter.php @@ -17,7 +17,7 @@ public function __construct( ) { } - public function match(string | object $element): bool + public function match(string|object $element): bool { if (is_object($element)) { return true; @@ -26,7 +26,7 @@ public function match(string | object $element): bool return class_exists($element) || interface_exists($element); } - public function shouldSkip(string | object $element, SplFileInfo | string $file): bool + public function shouldSkip(string|object $element, SplFileInfo|string $file): bool { $skippedClasses = $this->skippedClassResolver->resolve(); return $this->skipSkipper->doesMatchSkip($element, $file, $skippedClasses); diff --git a/src/Skipper/SkipVoter/MessageSkipVoter.php b/src/Skipper/SkipVoter/MessageSkipVoter.php index feb055bc36..7ae4f26c1e 100644 --- a/src/Skipper/SkipVoter/MessageSkipVoter.php +++ b/src/Skipper/SkipVoter/MessageSkipVoter.php @@ -17,7 +17,7 @@ public function __construct( ) { } - public function match(string | object $element): bool + public function match(string|object $element): bool { if (is_object($element)) { return false; @@ -26,7 +26,7 @@ public function match(string | object $element): bool return substr_count($element, ' ') > 0; } - public function shouldSkip(string | object $element, SplFileInfo | string $file): bool + public function shouldSkip(string|object $element, SplFileInfo|string $file): bool { if (is_object($element)) { return false; diff --git a/src/Skipper/SkipVoter/PathSkipVoter.php b/src/Skipper/SkipVoter/PathSkipVoter.php index ffda005398..4b8f974313 100644 --- a/src/Skipper/SkipVoter/PathSkipVoter.php +++ b/src/Skipper/SkipVoter/PathSkipVoter.php @@ -17,12 +17,12 @@ public function __construct( ) { } - public function match(string | object $element): bool + public function match(string|object $element): bool { return true; } - public function shouldSkip(string | object $element, SplFileInfo | string $file): bool + public function shouldSkip(string|object $element, SplFileInfo|string $file): bool { $skippedPaths = $this->skippedPathsResolver->resolve(); return $this->fileInfoMatcher->doesFileInfoMatchPatterns($file, $skippedPaths); diff --git a/src/Skipper/Skipper/SkipSkipper.php b/src/Skipper/Skipper/SkipSkipper.php index eeaa8b12ab..fb40a766c5 100644 --- a/src/Skipper/Skipper/SkipSkipper.php +++ b/src/Skipper/Skipper/SkipSkipper.php @@ -20,7 +20,7 @@ public function __construct( /** * @param array $skippedClasses */ - public function doesMatchSkip(object | string $checker, SplFileInfo | string $file, array $skippedClasses): bool + public function doesMatchSkip(object|string $checker, SplFileInfo|string $file, array $skippedClasses): bool { foreach ($skippedClasses as $skippedClass => $skippedFiles) { if (! is_a($checker, $skippedClass, true)) { diff --git a/src/Skipper/Skipper/Skipper.php b/src/Skipper/Skipper/Skipper.php index 5e82240beb..f7cd23b1ff 100644 --- a/src/Skipper/Skipper/Skipper.php +++ b/src/Skipper/Skipper/Skipper.php @@ -32,7 +32,7 @@ public function __construct( $this->skipVoters = [$classAndCodeSkipVoter, $classSkipVoter, $messageSkipVoter, $pathSkipVoter]; } - public function shouldSkipElement(string | object $element): bool + public function shouldSkipElement(string|object $element): bool { return $this->shouldSkipElementAndFilePath($element, __FILE__); } @@ -42,7 +42,7 @@ public function shouldSkipFilePath(string $filePath): bool return $this->shouldSkipElementAndFilePath(self::FILE_ELEMENT, $filePath); } - public function shouldSkipElementAndFilePath(string | object $element, string $filePath): bool + public function shouldSkipElementAndFilePath(string|object $element, string $filePath): bool { foreach ($this->skipVoters as $skipVoter) { if (! $skipVoter->match($element)) { diff --git a/src/ValueObject/Configuration.php b/src/ValueObject/Configuration.php index 1c2dfa900f..1536eec2e4 100644 --- a/src/ValueObject/Configuration.php +++ b/src/ValueObject/Configuration.php @@ -20,9 +20,9 @@ public function __construct( private string $outputFormat = ConsoleOutputFormatter::NAME, private bool $isParallel = false, private ?string $config = null, - private string | null $parallelPort = null, - private string | null $parallelIdentifier = null, - private string | null $memoryLimit = null, + private string|null $parallelPort = null, + private string|null $parallelIdentifier = null, + private string|null $memoryLimit = null, private bool $showDiffs = true, private bool $reportingWithRealPath = false ) { diff --git a/src/ValueObject/Set/SetList.php b/src/ValueObject/Set/SetList.php index 4dc18204bc..5c236d985b 100644 --- a/src/ValueObject/Set/SetList.php +++ b/src/ValueObject/Set/SetList.php @@ -71,6 +71,16 @@ final class SetList */ public const string STRICT = __DIR__ . '/../../../config/set/common/strict.php'; + /** + * @api + */ + public const string CASING = __DIR__ . '/../../../config/set/common/casing.php'; + + /** + * @api + */ + public const string CLEANUP = __DIR__ . '/../../../config/set/common/cleanup.php'; + /** * @api */