bump dependencies and update config

This commit is contained in:
lubiana 2024-01-25 18:31:04 +01:00
parent 3c81249b90
commit f30fbd3758
6 changed files with 134 additions and 147 deletions

View file

@ -9,8 +9,8 @@
}, },
"require": { "require": {
"slevomat/coding-standard": "^8.14.1", "slevomat/coding-standard": "^8.14.1",
"symplify/easy-coding-standard": "^12.0.9", "symplify/easy-coding-standard": "^12.1.8",
"rector/rector": "^0.18.11" "rector/rector": "^0.19.2"
}, },
"config": { "config": {
"allow-plugins": { "allow-plugins": {

107
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "caab951f25d21bb036acd27159bfa81b", "content-hash": "a2ee536230b7262151afd736f0600119",
"packages": [ "packages": [
{ {
"name": "dealerdirect/phpcodesniffer-composer-installer", "name": "dealerdirect/phpcodesniffer-composer-installer",
@ -86,16 +86,16 @@
}, },
{ {
"name": "phpstan/phpdoc-parser", "name": "phpstan/phpdoc-parser",
"version": "1.24.4", "version": "1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git", "url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496" "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6bd0c26f3786cd9b7c359675cb789e35a8e07496", "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bd84b629c8de41aa2ae82c067c955e06f1b00240",
"reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496", "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -127,22 +127,22 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types", "description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": { "support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues", "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.25.0"
}, },
"time": "2023-11-26T18:29:22+00:00" "time": "2024-01-04T17:06:16+00:00"
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.10.46", "version": "1.10.57",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "90d3d25c5b98b8068916bbf08ce42d5cb6c54e70" "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/90d3d25c5b98b8068916bbf08ce42d5cb6c54e70", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e",
"reference": "90d3d25c5b98b8068916bbf08ce42d5cb6c54e70", "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -191,25 +191,25 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-11-28T14:57:26+00:00" "time": "2024-01-24T11:51:34+00:00"
}, },
{ {
"name": "rector/rector", "name": "rector/rector",
"version": "0.18.11", "version": "0.19.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/rectorphp/rector.git", "url": "https://github.com/rectorphp/rector.git",
"reference": "9621124c860066f56a4ab841349cb7c284edfaee" "reference": "bc96a99895bf47c6bfe70ea1b799f0081ed5a903"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/9621124c860066f56a4ab841349cb7c284edfaee", "url": "https://api.github.com/repos/rectorphp/rector/zipball/bc96a99895bf47c6bfe70ea1b799f0081ed5a903",
"reference": "9621124c860066f56a4ab841349cb7c284edfaee", "reference": "bc96a99895bf47c6bfe70ea1b799f0081ed5a903",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2|^8.0", "php": "^7.2|^8.0",
"phpstan/phpstan": "^1.10.35" "phpstan/phpstan": "^1.10.56"
}, },
"conflict": { "conflict": {
"rector/rector-doctrine": "*", "rector/rector-doctrine": "*",
@ -239,7 +239,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/rectorphp/rector/issues", "issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/0.18.11" "source": "https://github.com/rectorphp/rector/tree/0.19.2"
}, },
"funding": [ "funding": [
{ {
@ -247,7 +247,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-11-27T13:27:43+00:00" "time": "2024-01-19T10:58:30+00:00"
}, },
{ {
"name": "slevomat/coding-standard", "name": "slevomat/coding-standard",
@ -316,16 +316,16 @@
}, },
{ {
"name": "squizlabs/php_codesniffer", "name": "squizlabs/php_codesniffer",
"version": "3.7.2", "version": "3.8.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
"reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" "reference": "14f5fff1e64118595db5408e946f3a22c75807f7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7",
"reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "reference": "14f5fff1e64118595db5408e946f3a22c75807f7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -335,11 +335,11 @@
"php": ">=5.4.0" "php": ">=5.4.0"
}, },
"require-dev": { "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": [
"bin/phpcs", "bin/phpcbf",
"bin/phpcbf" "bin/phpcs"
], ],
"type": "library", "type": "library",
"extra": { "extra": {
@ -354,44 +354,67 @@
"authors": [ "authors": [
{ {
"name": "Greg Sherwood", "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.", "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": [ "keywords": [
"phpcs", "phpcs",
"standards", "standards",
"static analysis" "static analysis"
], ],
"support": { "support": {
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues",
"source": "https://github.com/squizlabs/PHP_CodeSniffer", "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" "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-01-11T20:47:48+00:00"
}, },
{ {
"name": "symplify/easy-coding-standard", "name": "symplify/easy-coding-standard",
"version": "12.0.9", "version": "12.1.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/easy-coding-standard/easy-coding-standard.git", "url": "https://github.com/easy-coding-standard/easy-coding-standard.git",
"reference": "24b7b28c25d698e64496c4d19c798ccd01617c7d" "reference": "7962c810a8eebc4174a38d7dff673f1999e61595"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/24b7b28c25d698e64496c4d19c798ccd01617c7d", "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/7962c810a8eebc4174a38d7dff673f1999e61595",
"reference": "24b7b28c25d698e64496c4d19c798ccd01617c7d", "reference": "7962c810a8eebc4174a38d7dff673f1999e61595",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2" "php": ">=7.2"
}, },
"conflict": { "conflict": {
"friendsofphp/php-cs-fixer": "<3.0", "friendsofphp/php-cs-fixer": "<3.46",
"squizlabs/php_codesniffer": "<3.6", "phpcsstandards/php_codesniffer": "<3.8",
"symplify/coding-standard": "<11.3" "symplify/coding-standard": "<12.1"
}, },
"bin": [ "bin": [
"bin/ecs" "bin/ecs"
@ -415,7 +438,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues", "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.1.8"
}, },
"funding": [ "funding": [
{ {
@ -427,7 +450,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-11-29T09:35:09+00:00" "time": "2024-01-16T22:56:06+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],

View file

@ -19,52 +19,38 @@ use SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff;
use SlevomatCodingStandard\Sniffs\TypeHints\UnionTypeHintFormatSniff; use SlevomatCodingStandard\Sniffs\TypeHints\UnionTypeHintFormatSniff;
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer; use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig; use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
return static function (ECSConfig $c): void { return ECSConfig::configure()
$c->skip([ ->withPreparedSets(
BlankLineAfterOpeningTagFixer::class, arrays: true,
OrderedImportsFixer::class, cleanCode: true,
FunctionToConstantFixer::class, comments: true,
]); controlStructures: true,
docblocks: true,
$c->sets([ namespaces: true,
SetList::ARRAY, spaces: true,
SetList::CLEAN_CODE, strict: true,
SetList::COMMENTS, symplify: true
SetList::COMMON, )
SetList::CONTROL_STRUCTURES, ->withPhpCsFixerSets(
SetList::DOCBLOCK, perCS: true,
SetList::NAMESPACES, perCSRisky: true,
SetList::PSR_12, php83Migration: true,
SetList::SPACES, php80MigrationRisky: true,
SetList::STRICT, )
SetList::SYMPLIFY, ->withRules([
]);
$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([
AlphabeticallySortedUsesSniff::class, AlphabeticallySortedUsesSniff::class,
DisallowGroupUseSniff::class, DisallowGroupUseSniff::class,
MultipleUsesPerLineSniff::class, MultipleUsesPerLineSniff::class,
NamespaceSpacingSniff::class, NamespaceSpacingSniff::class,
OperatorLinebreakFixer::class, OperatorLinebreakFixer::class,
]); NoWhitespaceInBlankLineFixer::class,
NewWithoutParenthesesSniff::class,
// import all namespaces, and even php core functions and classes ])
$c->ruleWithConfiguration( ->withConfiguredRule(ClassConstantVisibilitySniff::class, [
'fixable' => true,
])
->withConfiguredRule(
ReferenceUsedNamesOnlySniff::class, ReferenceUsedNamesOnlySniff::class,
[ [
'allowFallbackGlobalConstants' => false, 'allowFallbackGlobalConstants' => false,
@ -77,50 +63,49 @@ return static function (ECSConfig $c): void {
'allowFullyQualifiedNameForCollidingFunctions' => true, 'allowFullyQualifiedNameForCollidingFunctions' => true,
'searchAnnotations' => true, 'searchAnnotations' => true,
] ]
); )
// define newlines between use statements // define newlines between use statements
$c->ruleWithConfiguration(UseSpacingSniff::class, [ ->withConfiguredRule(
'linesCountAfterLastUse' => 1, UseSpacingSniff::class,
'linesCountBeforeFirstUse' => 1, [
'linesCountBetweenUseTypes' => 1, 'linesCountAfterLastUse' => 1,
]); 'linesCountBeforeFirstUse' => 1,
'linesCountBetweenUseTypes' => 1,
// strict types declaration should be on same line as opening tag ]
$c->ruleWithConfiguration( )
->withConfiguredRule(
DeclareStrictTypesSniff::class, DeclareStrictTypesSniff::class,
[ [
'declareOnFirstLine' => true, 'declareOnFirstLine' => true,
'spacesCountAroundEqualsSign' => 0, 'spacesCountAroundEqualsSign' => 0,
] ]
); )
->withConfiguredRule(
// disallow ?Foo typehint in favor of Foo|null UnionTypeHintFormatSniff::class,
$c->ruleWithConfiguration(UnionTypeHintFormatSniff::class, [ [
'nullPosition' => 'last', 'nullPosition' => 'last',
'shortNullable' => 'no', 'shortNullable' => 'no',
'withSpaces' => 'no', 'withSpaces' => 'no',
]); ]
)
// Remove useless parentheses in new statements ->withConfiguredRule(
$c->rule(NewWithoutParenthesesSniff::class); LineLengthFixer::class,
[
// do not inline short multilinestatements LineLengthFixer::INLINE_SHORT_LINES => false,
$c->ruleWithConfiguration(LineLengthFixer::class, [ ]
LineLengthFixer::INLINE_SHORT_LINES => false, )
]); ->withConfiguredRule(
$c->ruleWithConfiguration(
NoExtraBlankLinesFixer::class, NoExtraBlankLinesFixer::class,
[ [
'tokens' => ['square_brace_block', 'return', 'extra'], 'tokens' => ['square_brace_block', 'return', 'extra'],
] ]
); )
->withConfiguredRule(AttributeAndTargetSpacingSniff::class, [
$c->rule(NoWhitespaceInBlankLineFixer::class);
// make sure that the attribute target is on the line after the attribute
$c->ruleWithConfiguration(AttributeAndTargetSpacingSniff::class, [
'linesCount' => 0, 'linesCount' => 0,
])
->withSkip([
BlankLineAfterOpeningTagFixer::class,
OrderedImportsFixer::class,
FunctionToConstantFixer::class,
]); ]);
};

View file

@ -41,7 +41,6 @@ use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRecto
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector; use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector;
use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector; use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector;
use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector; use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector;
use Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
return static function (RectorConfig $c): void { return static function (RectorConfig $c): void {
@ -67,7 +66,6 @@ return static function (RectorConfig $c): void {
NullableCompareToNullRector::class, NullableCompareToNullRector::class,
ParamTypeByMethodCallTypeRector::class, ParamTypeByMethodCallTypeRector::class,
ParamTypeByParentCallTypeRector::class, ParamTypeByParentCallTypeRector::class,
ParamTypeFromStrictTypedPropertyRector::class,
PreparedValueToEarlyReturnRector::class, PreparedValueToEarlyReturnRector::class,
ReplaceMultipleBooleanNotRector::class, ReplaceMultipleBooleanNotRector::class,
ReturnBinaryOrToEarlyReturnRector::class, ReturnBinaryOrToEarlyReturnRector::class,

18
ecs.php
View file

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

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;
}