update rules

This commit is contained in:
lubiana 2023-11-29 18:27:33 +01:00
parent 3c9679da8e
commit 3c81249b90
2 changed files with 12 additions and 9 deletions

View file

@ -1,8 +1,8 @@
<?php declare(strict_types=1);
use PhpCsFixer\Fixer\Basic\BracesFixer;
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
use PhpCsFixer\Fixer\Operator\NewWithBracesFixer;
use PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer;
use PhpCsFixer\Fixer\Operator\OperatorLinebreakFixer;
use PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer;
use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer;
use PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer;
@ -24,8 +24,8 @@ use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
return static function (ECSConfig $c): void {
$c->skip([
BlankLineAfterOpeningTagFixer::class,
NewWithBracesFixer::class,
OrderedImportsFixer::class,
FunctionToConstantFixer::class,
]);
$c->sets([
@ -42,6 +42,13 @@ return static function (ECSConfig $c): void {
SetList::SYMPLIFY,
]);
$c->dynamicSets([
'@PER-CS',
'@PER-CS:risky',
'@PHP83Migration',
'@PHP80Migration:risky',
]);
// force visibility declaration on class constants
$c->ruleWithConfiguration(ClassConstantVisibilitySniff::class, [
'fixable' => true,
@ -53,9 +60,10 @@ return static function (ECSConfig $c): void {
DisallowGroupUseSniff::class,
MultipleUsesPerLineSniff::class,
NamespaceSpacingSniff::class,
OperatorLinebreakFixer::class,
]);
// import all namespaces, and event php core functions and classes
// import all namespaces, and even php core functions and classes
$c->ruleWithConfiguration(
ReferenceUsedNamesOnlySniff::class,
[
@ -95,7 +103,6 @@ return static function (ECSConfig $c): void {
]);
// Remove useless parentheses in new statements
$c->rule(BracesFixer::class);
$c->rule(NewWithoutParenthesesSniff::class);
// do not inline short multilinestatements

View file

@ -14,7 +14,6 @@ use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\If_\NullableCompareToNullRector;
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
use Rector\Config\RectorConfig;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector;
@ -44,7 +43,6 @@ use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector;
use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector;
use Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodReturnTypeRector;
return static function (RectorConfig $c): void {
$c->sets([LevelSetList::UP_TO_PHP_82]);
@ -65,7 +63,6 @@ return static function (RectorConfig $c): void {
ExplicitBoolCompareRector::class,
InlineArrayReturnAssignRector::class,
InlineIsAInstanceOfRector::class,
NewlineAfterStatementRector::class,
NewlineBeforeNewAssignSetRector::class,
NullableCompareToNullRector::class,
ParamTypeByMethodCallTypeRector::class,
@ -90,7 +87,6 @@ return static function (RectorConfig $c): void {
StaticClosureRector::class,
ThrowWithPreviousExceptionRector::class,
TypedPropertyFromStrictConstructorRector::class,
TypedPropertyFromStrictGetterMethodReturnTypeRector::class,
RemoveAlwaysElseRector::class,
]);
};