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

Adding rector tool to codebase #205

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PHP_CS_FIXER = tools/php-cs-fixer/vendor/bin/php-cs-fixer
PHPUNIT = tools/phpunit/vendor/bin/phpunit
PSALM = tools/psalm/vendor/bin/psalm
CHURN = tools/churn/vendor/bin/churn
RECTOR = tools/rector/vendor/bin/rector
PSALM_BASELINE_FILE = psalm-baseline.xml
BARD = src/SonsOfPHP/Bard/bin/bard

Expand Down Expand Up @@ -213,9 +214,18 @@ churn-install:
churn-upgrade:
$(COMPOSER) upgrade --working-dir=tools/churn --no-interaction --prefer-dist --optimize-autoloader --with-all-dependencies

tools-install: psalm-install php-cs-fixer-install phpunit-install churn-install
rector:
$(RECTOR) --dry-run

tools-upgrade: psalm-upgrade php-cs-fixer-upgrade phpunit-upgrade churn-upgrade
rector-install:
$(COMPOSER) install --working-dir=tools/rector --no-interaction --prefer-dist --optimize-autoloader

rector-upgrade:
$(COMPOSER) upgrade --working-dir=tools/rector --no-interaction --prefer-dist --optimize-autoloader --with-all-dependencies

tools-install: psalm-install php-cs-fixer-install phpunit-install churn-install rector-install

tools-upgrade: psalm-upgrade php-cs-fixer-upgrade phpunit-upgrade churn-upgrade rector-upgrade

## Documentation
docs-install: ## Install deps for building docs
Expand Down
22 changes: 22 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
])
->withSkip([
__DIR__ . '/src/SonsOfPHP/*/vendor/*',
__DIR__ . '/src/SonsOfPHP/*/*/vendor/*',
__DIR__ . '/src/SonsOfPHP/*/*/*/vendor/*',
__DIR__ . '/src/SonsOfPHP/*/*/*/*/vendor/*',
])
// This should be the same version that is found in composer.json file
->withPhpSets(php81: true)
->withRules([
AddVoidReturnTypeWhereNoReturnRector::class,
]);
5 changes: 5 additions & 0 deletions tools/rector/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"rector/rector": "^1.0"
}
}
Loading