Skip to content

Commit 4fea5ab

Browse files
xepozzrector-botarogachev
authored
Add rector [batch] (#3)
* 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 <rector@yiiframework.com> Co-authored-by: Alexey Rogachev <arogachev90@gmail.com>
1 parent 725cbf1 commit 4fea5ab

File tree

5 files changed

+45
-5
lines changed

5 files changed

+45
-5
lines changed

.github/workflows/rector.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
on:
2+
pull_request:
3+
paths-ignore:
4+
- 'docs/**'
5+
- 'README.md'
6+
- 'CHANGELOG.md'
7+
- '.gitignore'
8+
- '.gitattributes'
9+
- 'infection.json.dist'
10+
- 'psalm.xml'
11+
12+
name: rector
13+
14+
jobs:
15+
rector:
16+
uses: yiisoft/actions/.github/workflows/rector.yml@master
17+
with:
18+
os: >-
19+
['ubuntu-latest']
20+
php: >-
21+
['8.0']

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"yiisoft/yii-runner-http": "^1.1"
4141
},
4242
"require-dev": {
43+
"rector/rector": "^0.14.3",
4344
"roave/infection-static-analysis-plugin": "^1.16",
4445
"spatie/phpunit-watcher": "^1.23",
4546
"vimeo/psalm": "^4.18"

rector.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
6+
use Rector\Config\RectorConfig;
7+
use Rector\Set\ValueObject\LevelSetList;
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->paths([
11+
__DIR__ . '/src',
12+
__DIR__ . '/tests',
13+
]);
14+
15+
// register a single rule
16+
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
17+
18+
// define sets of rules
19+
$rectorConfig->sets([
20+
LevelSetList::UP_TO_PHP_80,
21+
]);
22+
};

src/FunctionalTester.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ public function doRequest(string $method, string $url): ResponseInterface
5252
}
5353

5454
/**
55-
* @psalm-return ContainerInterface
56-
* @return ContainerInterface
5755
* @psalm-suppress NullableReturnStatement
5856
*/
5957
public function getContainer(): ContainerInterface

src/TestApplicationRunner.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ final class TestApplicationRunner extends ApplicationRunner
2626
* @var ServiceProviderInterface[]
2727
*/
2828
private array $providers = [];
29-
protected string $definitionEnvironment;
3029

3130
/**
3231
* @param string $rootPath The absolute path to the project root.
@@ -38,12 +37,11 @@ public function __construct(
3837
string $rootPath,
3938
bool $debug,
4039
?string $environment,
41-
string $definitionEnvironment = 'web',
40+
protected string $definitionEnvironment = 'web',
4241
) {
4342
parent::__construct($rootPath, $debug, $environment);
4443
$this->bootstrapGroup = 'bootstrap-web';
4544
$this->eventsGroup = 'events-web';
46-
$this->definitionEnvironment = $definitionEnvironment;
4745
}
4846

4947
/**

0 commit comments

Comments
 (0)