Skip to content

Commit

Permalink
Adding rector tool to codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaEstes committed Feb 14, 2024
1 parent 5ad14f5 commit 7f3ea07
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
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"
}
}

0 comments on commit 7f3ea07

Please sign in to comment.