bump dependencies and update config
This commit is contained in:
parent
3c81249b90
commit
f30fbd3758
6 changed files with 134 additions and 147 deletions
133
config/ecs.php
133
config/ecs.php
|
@ -19,52 +19,38 @@ use SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff;
|
|||
use SlevomatCodingStandard\Sniffs\TypeHints\UnionTypeHintFormatSniff;
|
||||
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
|
||||
use Symplify\EasyCodingStandard\Config\ECSConfig;
|
||||
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
|
||||
|
||||
return static function (ECSConfig $c): void {
|
||||
$c->skip([
|
||||
BlankLineAfterOpeningTagFixer::class,
|
||||
OrderedImportsFixer::class,
|
||||
FunctionToConstantFixer::class,
|
||||
]);
|
||||
|
||||
$c->sets([
|
||||
SetList::ARRAY,
|
||||
SetList::CLEAN_CODE,
|
||||
SetList::COMMENTS,
|
||||
SetList::COMMON,
|
||||
SetList::CONTROL_STRUCTURES,
|
||||
SetList::DOCBLOCK,
|
||||
SetList::NAMESPACES,
|
||||
SetList::PSR_12,
|
||||
SetList::SPACES,
|
||||
SetList::STRICT,
|
||||
SetList::SYMPLIFY,
|
||||
]);
|
||||
|
||||
$c->dynamicSets([
|
||||
'@PER-CS',
|
||||
'@PER-CS:risky',
|
||||
'@PHP83Migration',
|
||||
'@PHP80Migration:risky',
|
||||
]);
|
||||
|
||||
// force visibility declaration on class constants
|
||||
$c->ruleWithConfiguration(ClassConstantVisibilitySniff::class, [
|
||||
'fixable' => true,
|
||||
]);
|
||||
|
||||
// sort all use statements
|
||||
$c->rules([
|
||||
return ECSConfig::configure()
|
||||
->withPreparedSets(
|
||||
arrays: true,
|
||||
cleanCode: true,
|
||||
comments: true,
|
||||
controlStructures: true,
|
||||
docblocks: true,
|
||||
namespaces: true,
|
||||
spaces: true,
|
||||
strict: true,
|
||||
symplify: true
|
||||
)
|
||||
->withPhpCsFixerSets(
|
||||
perCS: true,
|
||||
perCSRisky: true,
|
||||
php83Migration: true,
|
||||
php80MigrationRisky: true,
|
||||
)
|
||||
->withRules([
|
||||
AlphabeticallySortedUsesSniff::class,
|
||||
DisallowGroupUseSniff::class,
|
||||
MultipleUsesPerLineSniff::class,
|
||||
NamespaceSpacingSniff::class,
|
||||
OperatorLinebreakFixer::class,
|
||||
]);
|
||||
|
||||
// import all namespaces, and even php core functions and classes
|
||||
$c->ruleWithConfiguration(
|
||||
NoWhitespaceInBlankLineFixer::class,
|
||||
NewWithoutParenthesesSniff::class,
|
||||
])
|
||||
->withConfiguredRule(ClassConstantVisibilitySniff::class, [
|
||||
'fixable' => true,
|
||||
])
|
||||
->withConfiguredRule(
|
||||
ReferenceUsedNamesOnlySniff::class,
|
||||
[
|
||||
'allowFallbackGlobalConstants' => false,
|
||||
|
@ -77,50 +63,49 @@ return static function (ECSConfig $c): void {
|
|||
'allowFullyQualifiedNameForCollidingFunctions' => true,
|
||||
'searchAnnotations' => true,
|
||||
]
|
||||
);
|
||||
)
|
||||
|
||||
// define newlines between use statements
|
||||
$c->ruleWithConfiguration(UseSpacingSniff::class, [
|
||||
'linesCountAfterLastUse' => 1,
|
||||
'linesCountBeforeFirstUse' => 1,
|
||||
'linesCountBetweenUseTypes' => 1,
|
||||
]);
|
||||
|
||||
// strict types declaration should be on same line as opening tag
|
||||
$c->ruleWithConfiguration(
|
||||
->withConfiguredRule(
|
||||
UseSpacingSniff::class,
|
||||
[
|
||||
'linesCountAfterLastUse' => 1,
|
||||
'linesCountBeforeFirstUse' => 1,
|
||||
'linesCountBetweenUseTypes' => 1,
|
||||
]
|
||||
)
|
||||
->withConfiguredRule(
|
||||
DeclareStrictTypesSniff::class,
|
||||
[
|
||||
'declareOnFirstLine' => true,
|
||||
'spacesCountAroundEqualsSign' => 0,
|
||||
]
|
||||
);
|
||||
|
||||
// disallow ?Foo typehint in favor of Foo|null
|
||||
$c->ruleWithConfiguration(UnionTypeHintFormatSniff::class, [
|
||||
'nullPosition' => 'last',
|
||||
'shortNullable' => 'no',
|
||||
'withSpaces' => 'no',
|
||||
]);
|
||||
|
||||
// Remove useless parentheses in new statements
|
||||
$c->rule(NewWithoutParenthesesSniff::class);
|
||||
|
||||
// do not inline short multilinestatements
|
||||
$c->ruleWithConfiguration(LineLengthFixer::class, [
|
||||
LineLengthFixer::INLINE_SHORT_LINES => false,
|
||||
]);
|
||||
|
||||
$c->ruleWithConfiguration(
|
||||
)
|
||||
->withConfiguredRule(
|
||||
UnionTypeHintFormatSniff::class,
|
||||
[
|
||||
'nullPosition' => 'last',
|
||||
'shortNullable' => 'no',
|
||||
'withSpaces' => 'no',
|
||||
]
|
||||
)
|
||||
->withConfiguredRule(
|
||||
LineLengthFixer::class,
|
||||
[
|
||||
LineLengthFixer::INLINE_SHORT_LINES => false,
|
||||
]
|
||||
)
|
||||
->withConfiguredRule(
|
||||
NoExtraBlankLinesFixer::class,
|
||||
[
|
||||
'tokens' => ['square_brace_block', 'return', 'extra'],
|
||||
]
|
||||
);
|
||||
|
||||
$c->rule(NoWhitespaceInBlankLineFixer::class);
|
||||
|
||||
// make sure that the attribute target is on the line after the attribute
|
||||
$c->ruleWithConfiguration(AttributeAndTargetSpacingSniff::class, [
|
||||
)
|
||||
->withConfiguredRule(AttributeAndTargetSpacingSniff::class, [
|
||||
'linesCount' => 0,
|
||||
])
|
||||
->withSkip([
|
||||
BlankLineAfterOpeningTagFixer::class,
|
||||
OrderedImportsFixer::class,
|
||||
FunctionToConstantFixer::class,
|
||||
]);
|
||||
};
|
||||
|
|
|
@ -41,7 +41,6 @@ use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRecto
|
|||
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector;
|
||||
use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector;
|
||||
use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector;
|
||||
use Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector;
|
||||
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
|
||||
|
||||
return static function (RectorConfig $c): void {
|
||||
|
@ -67,7 +66,6 @@ return static function (RectorConfig $c): void {
|
|||
NullableCompareToNullRector::class,
|
||||
ParamTypeByMethodCallTypeRector::class,
|
||||
ParamTypeByParentCallTypeRector::class,
|
||||
ParamTypeFromStrictTypedPropertyRector::class,
|
||||
PreparedValueToEarlyReturnRector::class,
|
||||
ReplaceMultipleBooleanNotRector::class,
|
||||
ReturnBinaryOrToEarlyReturnRector::class,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue