Skip to content

Commit 531bb26

Browse files
authored
Merge pull request #249 from yiisoft/add-rector
Add rector [batch]
2 parents 1188d68 + db68655 commit 531bb26

4 files changed

Lines changed: 46 additions & 6 deletions

File tree

.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
@@ -63,6 +63,7 @@
6363
"codeception/module-cli": "^2.0",
6464
"codeception/module-phpbrowser": "^3.0",
6565
"phpunit/phpunit": "^9.5",
66+
"rector/rector": "^0.14.3",
6667
"roave/infection-static-analysis-plugin": "^1.16",
6768
"roave/security-advisories": "dev-master",
6869
"spatie/phpunit-watcher": "^1.23",

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/ViewInjection/CommonViewInjection.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@
99

1010
final class CommonViewInjection implements CommonParametersInjectionInterface
1111
{
12-
private ApplicationParameters $applicationParameters;
13-
14-
public function __construct(
15-
ApplicationParameters $applicationParameters
16-
) {
17-
$this->applicationParameters = $applicationParameters;
12+
public function __construct(private ApplicationParameters $applicationParameters)
13+
{
1814
}
1915

2016
public function getCommonParameters(): array

0 commit comments

Comments
 (0)