Compare commits

...

13 commits
1.2.0 ... main

Author SHA1 Message Date
b7e3418f0f
remove deprecated rectors
All checks were successful
/ ls (push) Successful in 28s
2024-08-18 09:17:23 +02:00
e40beaa2d1
bump-dependencies
All checks were successful
/ ls (push) Successful in 29s
2024-08-18 09:09:16 +02:00
2793c36fa9 Merge pull request 'add_ClassAttributeSeparationFixer' (#3) from add_ClassAttributeSeparationFixer into main
All checks were successful
/ ls (push) Successful in 13s
Reviewed-on: #3
2024-05-04 18:26:43 +00:00
e7ecf55e04
ci-fix
All checks were successful
/ ls (push) Successful in 12s
2024-05-04 20:24:57 +02:00
Continuous Integration
00f72e3be9 Continuous Integration Fixes 2024-05-04 17:42:09 +00:00
9993d760d6
add ClassAttributeSeparationFixer
All checks were successful
/ ls (push) Successful in 17s
2024-05-04 19:41:48 +02:00
b1792809e1 Merge pull request 'add workflow' (#2) from add_actions into main
All checks were successful
/ ls (push) Successful in 16s
Reviewed-on: #2
2024-05-04 17:34:39 +00:00
713b047068
add workflow
All checks were successful
/ ls (push) Successful in 16s
2024-05-04 19:33:42 +02:00
d668217619 temporary skip linelengthfixer 2024-04-25 21:01:06 +02:00
cfd59433a4 bump dependencies 2024-04-25 18:07:52 +02:00
894d6ec850 clean up rector config 2024-02-03 10:58:53 +01:00
8c90c27762 bump versions and set php83 as new target 2024-02-03 01:07:15 +01:00
f30fbd3758 bump dependencies and update config 2024-01-25 18:31:04 +01:00
9 changed files with 222 additions and 186 deletions

View file

@ -0,0 +1,34 @@
on: [push]
jobs:
ls:
runs-on: docker
container:
image: git.php.fail/lubiana/container/php:ci
steps:
- name: Manually checkout
env:
REPO: '${{ github.repository }}'
TOKEN: '${{ secrets.GITHUB_TOKEN }}'
GIT_SERVER: 'git.php.fail'
run: |
git clone --branch $GITHUB_REF_NAME https://${TOKEN}@${GIT_SERVER}/${REPO}.git .
git fetch
git checkout ${{ github.head_ref }}
- name: composer install
env:
COMPOSER_CACHE_DIR: /opt/hostedtoolcache/.composer/cache/files
run: |
mkdir -p ${{ env.COMPOSER_CACHE_DIR }}
composer install
- run: composer lint
- name: GIT commit and push all changed files
env:
CI_COMMIT_MESSAGE: Continuous Integration Fixes
CI_COMMIT_AUTHOR: Continuous Integration
run: |
if [[ -n "$(git status -s)" ]]; then
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "gitbot@users.noreply.php.fail"
git commit -am "${{ env.CI_COMMIT_MESSAGE }}"
git push
fi

View file

@ -8,9 +8,10 @@
}
},
"require": {
"slevomat/coding-standard": "^8.14.1",
"symplify/easy-coding-standard": "^12.0.9",
"rector/rector": "^0.18.11"
"php": "^8.3",
"slevomat/coding-standard": "^8.15",
"symplify/easy-coding-standard": "^12.3.5",
"rector/rector": "^1.0.5"
},
"config": {
"allow-plugins": {
@ -18,7 +19,7 @@
}
},
"scripts": {
"fix": [
"lint": [
"rector",
"ecs --fix",
"ecs --fix"

143
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "caab951f25d21bb036acd27159bfa81b",
"content-hash": "6eb7806e6594ecc073d158d2f9b483f0",
"packages": [
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
@ -86,16 +86,16 @@
},
{
"name": "phpstan/phpdoc-parser",
"version": "1.24.4",
"version": "1.28.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496"
"reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6bd0c26f3786cd9b7c359675cb789e35a8e07496",
"reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb",
"reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb",
"shasum": ""
},
"require": {
@ -127,22 +127,22 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.4"
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.28.0"
},
"time": "2023-11-26T18:29:22+00:00"
"time": "2024-04-03T18:51:33+00:00"
},
{
"name": "phpstan/phpstan",
"version": "1.10.46",
"version": "1.10.67",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "90d3d25c5b98b8068916bbf08ce42d5cb6c54e70"
"reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/90d3d25c5b98b8068916bbf08ce42d5cb6c54e70",
"reference": "90d3d25c5b98b8068916bbf08ce42d5cb6c54e70",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/16ddbe776f10da6a95ebd25de7c1dbed397dc493",
"reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493",
"shasum": ""
},
"require": {
@ -185,31 +185,27 @@
{
"url": "https://github.com/phpstan",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
"type": "tidelift"
}
],
"time": "2023-11-28T14:57:26+00:00"
"time": "2024-04-16T07:22:02+00:00"
},
{
"name": "rector/rector",
"version": "0.18.11",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/rectorphp/rector.git",
"reference": "9621124c860066f56a4ab841349cb7c284edfaee"
"reference": "73eb63e4f9011dba6b7c66c3262543014e352f34"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/9621124c860066f56a4ab841349cb7c284edfaee",
"reference": "9621124c860066f56a4ab841349cb7c284edfaee",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/73eb63e4f9011dba6b7c66c3262543014e352f34",
"reference": "73eb63e4f9011dba6b7c66c3262543014e352f34",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0",
"phpstan/phpstan": "^1.10.35"
"phpstan/phpstan": "^1.10.57"
},
"conflict": {
"rector/rector-doctrine": "*",
@ -217,6 +213,9 @@
"rector/rector-phpunit": "*",
"rector/rector-symfony": "*"
},
"suggest": {
"ext-dom": "To manipulate phpunit.xml via the custom-rule command"
},
"bin": [
"bin/rector"
],
@ -239,7 +238,7 @@
],
"support": {
"issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/0.18.11"
"source": "https://github.com/rectorphp/rector/tree/1.0.5"
},
"funding": [
{
@ -247,36 +246,36 @@
"type": "github"
}
],
"time": "2023-11-27T13:27:43+00:00"
"time": "2024-05-10T05:31:15+00:00"
},
{
"name": "slevomat/coding-standard",
"version": "8.14.1",
"version": "8.15.0",
"source": {
"type": "git",
"url": "https://github.com/slevomat/coding-standard.git",
"reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926"
"reference": "7d1d957421618a3803b593ec31ace470177d7817"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fea1fd6f137cc84f9cba0ae30d549615dbc6a926",
"reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926",
"url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7d1d957421618a3803b593ec31ace470177d7817",
"reference": "7d1d957421618a3803b593ec31ace470177d7817",
"shasum": ""
},
"require": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0",
"php": "^7.2 || ^8.0",
"phpstan/phpdoc-parser": "^1.23.1",
"squizlabs/php_codesniffer": "^3.7.1"
"squizlabs/php_codesniffer": "^3.9.0"
},
"require-dev": {
"phing/phing": "2.17.4",
"php-parallel-lint/php-parallel-lint": "1.3.2",
"phpstan/phpstan": "1.10.37",
"phpstan/phpstan": "1.10.60",
"phpstan/phpstan-deprecation-rules": "1.1.4",
"phpstan/phpstan-phpunit": "1.3.14",
"phpstan/phpstan-strict-rules": "1.5.1",
"phpunit/phpunit": "8.5.21|9.6.8|10.3.5"
"phpstan/phpstan-phpunit": "1.3.16",
"phpstan/phpstan-strict-rules": "1.5.2",
"phpunit/phpunit": "8.5.21|9.6.8|10.5.11"
},
"type": "phpcodesniffer-standard",
"extra": {
@ -300,7 +299,7 @@
],
"support": {
"issues": "https://github.com/slevomat/coding-standard/issues",
"source": "https://github.com/slevomat/coding-standard/tree/8.14.1"
"source": "https://github.com/slevomat/coding-standard/tree/8.15.0"
},
"funding": [
{
@ -312,20 +311,20 @@
"type": "tidelift"
}
],
"time": "2023-10-08T07:28:08+00:00"
"time": "2024-03-09T15:20:58+00:00"
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.7.2",
"version": "3.9.2",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879"
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
"reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879",
"reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879",
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480",
"reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480",
"shasum": ""
},
"require": {
@ -335,11 +334,11 @@
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4"
},
"bin": [
"bin/phpcs",
"bin/phpcbf"
"bin/phpcbf",
"bin/phpcs"
],
"type": "library",
"extra": {
@ -354,44 +353,70 @@
"authors": [
{
"name": "Greg Sherwood",
"role": "lead"
"role": "Former lead"
},
{
"name": "Juliette Reinders Folmer",
"role": "Current lead"
},
{
"name": "Contributors",
"homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors"
}
],
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
"homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer",
"keywords": [
"phpcs",
"standards",
"static analysis"
],
"support": {
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
"issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues",
"security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy",
"source": "https://github.com/PHPCSStandards/PHP_CodeSniffer",
"wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki"
},
"time": "2023-02-22T23:07:41+00:00"
"funding": [
{
"url": "https://github.com/PHPCSStandards",
"type": "github"
},
{
"url": "https://github.com/jrfnl",
"type": "github"
},
{
"url": "https://opencollective.com/php_codesniffer",
"type": "open_collective"
}
],
"time": "2024-04-23T20:25:34+00:00"
},
{
"name": "symplify/easy-coding-standard",
"version": "12.0.9",
"version": "12.3.5",
"source": {
"type": "git",
"url": "https://github.com/easy-coding-standard/easy-coding-standard.git",
"reference": "24b7b28c25d698e64496c4d19c798ccd01617c7d"
"reference": "0d7c2cfee3debdf11c12135e90d69d1d9f4eef03"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/24b7b28c25d698e64496c4d19c798ccd01617c7d",
"reference": "24b7b28c25d698e64496c4d19c798ccd01617c7d",
"url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/0d7c2cfee3debdf11c12135e90d69d1d9f4eef03",
"reference": "0d7c2cfee3debdf11c12135e90d69d1d9f4eef03",
"shasum": ""
},
"require": {
"php": ">=7.2"
},
"conflict": {
"friendsofphp/php-cs-fixer": "<3.0",
"squizlabs/php_codesniffer": "<3.6",
"symplify/coding-standard": "<11.3"
"friendsofphp/php-cs-fixer": "<3.46",
"phpcsstandards/php_codesniffer": "<3.8",
"symplify/coding-standard": "<12.1"
},
"suggest": {
"ext-dom": "Needed to support checkstyle output format in class CheckstyleOutputFormatter"
},
"bin": [
"bin/ecs"
@ -415,7 +440,7 @@
],
"support": {
"issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues",
"source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.0.9"
"source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.3.5"
},
"funding": [
{
@ -427,7 +452,7 @@
"type": "github"
}
],
"time": "2023-11-29T09:35:09+00:00"
"time": "2024-08-08T08:43:50+00:00"
}
],
"packages-dev": [],
@ -436,7 +461,9 @@
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform": {
"php": "^8.3"
},
"platform-dev": [],
"plugin-api-version": "2.6.0"
}

View file

@ -1,7 +1,10 @@
<?php declare(strict_types=1);
use PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer;
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
use PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer;
use PhpCsFixer\Fixer\Operator\NewWithBracesFixer;
use PhpCsFixer\Fixer\Operator\NewWithParenthesesFixer;
use PhpCsFixer\Fixer\Operator\OperatorLinebreakFixer;
use PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer;
use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer;
@ -19,52 +22,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(
symplify: true,
arrays: true,
comments: true,
docblocks: true,
spaces: true,
namespaces: true,
controlStructures: true,
strict: true,
cleanCode: true
)
->withPhpCsFixerSets(
perCS: true,
perCSRisky: true,
php80MigrationRisky: true,
php83Migration: 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 +66,57 @@ 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(
ClassAttributesSeparationFixer::class,
[
'elements' => [
'const' => 'none',
'method' => 'one',
'property' => 'none',
'trait_import' => 'none',
'case' => 'none',
],
],
)->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(
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,
NewWithParenthesesFixer::class,
NewWithBracesFixer::class,
LineLengthFixer::class,
]);
};

View file

@ -16,7 +16,6 @@ use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\If_\NullableCompareToNullRector;
use Rector\Config\RectorConfig;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
@ -24,7 +23,6 @@ use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
use Rector\EarlyReturn\Rector\StmtsAwareInterface\ReturnEarlyIfVariableRector;
use Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeFromPropertyTypeRector;
@ -33,7 +31,6 @@ use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnDirectArrayRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictBoolReturnExprRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictConstantReturnRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNativeCallRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector;
@ -41,12 +38,18 @@ 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 {
$c->sets([LevelSetList::UP_TO_PHP_82]);
$c->rules([
return RectorConfig::configure()
->withPhpSets(php83: true)
->withPreparedSets(
deadCode: true,
codeQuality: true,
typeDeclarations: true,
earlyReturn: true,
strictBooleans: true,
)
->withRules([
AddArrowFunctionReturnTypeRector::class,
AddMethodCallBasedStrictParamTypeRector::class,
AddParamTypeFromPropertyTypeRector::class,
@ -54,7 +57,6 @@ return static function (RectorConfig $c): void {
AddReturnTypeDeclarationBasedOnParentClassMethodRector::class,
AddReturnTypeDeclarationFromYieldsRector::class,
BooleanNotIdenticalToNotIdenticalRector::class,
ChangeAndIfToEarlyReturnRector::class,
ChangeNestedForeachIfsToEarlyContinueRector::class,
ChangeNestedIfsToEarlyReturnRector::class,
ChangeOrIfContinueToMultiContinueRector::class,
@ -67,14 +69,12 @@ return static function (RectorConfig $c): void {
NullableCompareToNullRector::class,
ParamTypeByMethodCallTypeRector::class,
ParamTypeByParentCallTypeRector::class,
ParamTypeFromStrictTypedPropertyRector::class,
PreparedValueToEarlyReturnRector::class,
ReplaceMultipleBooleanNotRector::class,
ReturnBinaryOrToEarlyReturnRector::class,
ReturnEarlyIfVariableRector::class,
ReturnTypeFromReturnDirectArrayRector::class,
ReturnTypeFromReturnNewRector::class,
ReturnTypeFromStrictBoolReturnExprRector::class,
ReturnTypeFromStrictConstantReturnRector::class,
ReturnTypeFromStrictNativeCallRector::class,
ReturnTypeFromStrictNewArrayRector::class,
@ -88,5 +88,5 @@ return static function (RectorConfig $c): void {
ThrowWithPreviousExceptionRector::class,
TypedPropertyFromStrictConstructorRector::class,
RemoveAlwaysElseRector::class,
]);
};
])
;

18
ecs.php
View file

@ -3,13 +3,11 @@
use Lubiana\CodeQuality\LubiSetList;
use Symplify\EasyCodingStandard\Config\ECSConfig;
return static function (ECSConfig $c): void {
$c->paths([
__DIR__ . '/src',
__DIR__ . '/config',
__DIR__ . '/rector.php',
__DIR__ . '/ecs.php',
]);
$c->sets([LubiSetList::ECS]);
};
return ECSConfig::configure()
->withSets([LubiSetList::ECS])
->withPaths(
[
__DIR__ . '/src',
__DIR__ . '/config',
]
)->withRootFiles();

View file

@ -3,13 +3,11 @@
use Lubiana\CodeQuality\LubiSetList;
use Rector\Config\RectorConfig;
return static function (RectorConfig $c): void {
$c->paths([
return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/config',
__DIR__ . '/rector.php',
__DIR__ . '/ecs.php',
]);
$c->sets([LubiSetList::RECTOR]);
};
])
->withSets([LubiSetList::RECTOR])
->withRootFiles()
;

View file

@ -4,7 +4,6 @@ namespace Lubiana\CodeQuality;
final class LubiSetList
{
public const RECTOR = __DIR__ . '/../config/rector.php';
public const ECS = __DIR__ . '/../config/ecs.php';
public const string RECTOR = __DIR__ . '/../config/rector.php';
public const string ECS = __DIR__ . '/../config/ecs.php';
}

View file

@ -1,17 +0,0 @@
<?php declare(strict_types=1);
namespace Lubiana\CodeQuality;
/** @deprecated use LubiSetList */
final class SetList
{
/**
* @deprecated use LubiSetList::RECTOR
*/
public const RECTOR = LubiSetList::RECTOR;
/**
* @deprecated use LubiSetList::ECS
*/
public const ECS = LubiSetList::ECS;
}