Skip to content

Commit

Permalink
Add rector [batch] (#3)
Browse files Browse the repository at this point in the history
* Add rector files yiisoft/yii-dev-tool#232

* Add rector/rector dependecy

* [rector] Apply fixes

* Use predefined rector action

* Update src/FunctionalTester.php

Co-authored-by: rector-bot <[email protected]>
Co-authored-by: Alexey Rogachev <[email protected]>
  • Loading branch information
3 people authored Sep 28, 2022
1 parent 725cbf1 commit 4fea5ab
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/rector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

name: rector

jobs:
rector:
uses: yiisoft/actions/.github/workflows/rector.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.0']
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"yiisoft/yii-runner-http": "^1.1"
},
"require-dev": {
"rector/rector": "^0.14.3",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.18"
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\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

// register a single rule
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
]);
};
2 changes: 0 additions & 2 deletions src/FunctionalTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public function doRequest(string $method, string $url): ResponseInterface
}

/**
* @psalm-return ContainerInterface
* @return ContainerInterface
* @psalm-suppress NullableReturnStatement
*/
public function getContainer(): ContainerInterface
Expand Down
4 changes: 1 addition & 3 deletions src/TestApplicationRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ final class TestApplicationRunner extends ApplicationRunner
* @var ServiceProviderInterface[]
*/
private array $providers = [];
protected string $definitionEnvironment;

/**
* @param string $rootPath The absolute path to the project root.
Expand All @@ -38,12 +37,11 @@ public function __construct(
string $rootPath,
bool $debug,
?string $environment,
string $definitionEnvironment = 'web',
protected string $definitionEnvironment = 'web',
) {
parent::__construct($rootPath, $debug, $environment);
$this->bootstrapGroup = 'bootstrap-web';
$this->eventsGroup = 'events-web';
$this->definitionEnvironment = $definitionEnvironment;
}

/**
Expand Down

0 comments on commit 4fea5ab

Please sign in to comment.