Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rector improve #216

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update rector.php rules and .php-cs-fixer.php dirs
Plakhotnikov Vladimir committed Jun 28, 2024
commit 088ae482ec25a9a63c27f860c47831f2c0e08a2c
2 changes: 1 addition & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -15,6 +15,6 @@
(new PhpCsFixer\Finder())
->files()
->name('*.php')
->in([__DIR__ . '/app/src', __DIR__ . '/app/modules']),
->in([__DIR__ . '/app', __DIR__ . '/tests', __DIR__ . '/utils']),
)
->setCacheFile('.cache/.php-cs-fixer.cache');
21 changes: 12 additions & 9 deletions rector.php
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

declare(strict_types=1);

use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
use Rector\Config\RectorConfig;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector;
@@ -21,10 +22,15 @@
__DIR__ . '/app',
__DIR__ . '/tests',
])
->withImportNames(importShortClasses: false, removeUnusedImports: true)
->withCache(cacheDirectory: __DIR__ . '.cache/rector')
// uncomment to reach your current PHP version
// ->withPhpSets()
->withPhpVersion(PhpVersion::PHP_82)
->withPhpSets(php82: true)
->withPreparedSets(
deadCode: true,
codeQuality: true,
codingStyle: true,
)
->withImportNames(importShortClasses: false, removeUnusedImports: true)
->withRules([
BootloaderConstantsFixesRule::class,
AddVoidReturnTypeWhereNoReturnRector::class,
@@ -38,9 +44,6 @@
RemoveUnusedVariableInCatchRector::class,
ClosureToArrowFunctionRector::class,
])
->withPhpVersion(PhpVersion::PHP_82)
// here we can define, what prepared sets of rules will be applied
->withPreparedSets(
deadCode: true,
codeQuality: true,
);
->withSkip([
CatchExceptionNameMatchingTypeRector::class,
]);