Skip to content

Commit

Permalink
Apply Rector suggestions + Improve Rector CI (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik authored Nov 11, 2024
1 parent 565a0d7 commit d46d4a8
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
on:
pull_request:
pull_request_target:
paths-ignore:
- 'docs/**'
- 'README.md'
Expand All @@ -17,6 +17,7 @@ jobs:
secrets:
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: >-
['ubuntu-latest']
php: >-
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
"maglnet/composer-require-checker": "^4.2",
"nyholm/psr7": "^1.3",
"phpunit/phpunit": "^10.5",
"rector/rector": "^1.0.0",
"rector/rector": "^1.2",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^5.25",
"vimeo/psalm": "^5.26",
"yiisoft/error-handler": "^3.0",
"yiisoft/event-dispatcher": "^1.0",
"yiisoft/log": "^2.0",
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
LevelSetList::UP_TO_PHP_81,
]);

$rectorConfig->skip([
Expand Down
2 changes: 1 addition & 1 deletion src/Dumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class Dumper
private array $objects = [];

private static ?ClosureExporter $closureExporter = null;
private array $excludedClasses;
private readonly array $excludedClasses;

private function __construct(
private readonly mixed $variable,
Expand Down
11 changes: 11 additions & 0 deletions src/FlattenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,17 @@ public function getTrace(): array

/**
* @param array $trace the Exception stack trace as an array.
*
* @psalm-param list<
* array{
* args?: array,
* class?: class-string,
* file?: string,
* function?: string,
* line?: int,
* type?: string
* }
* > $trace
*/
private function setTrace(array $trace): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Support/Stub/BrokenProxyImplementation.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class BrokenProxyImplementation implements Interface1
{
public function __construct(private Interface1 $decorated)
public function __construct(private readonly Interface1 $decorated)
{
throw new Exception('Broken proxy');
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/FlattenExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function testClass(): void
$this->assertEquals('Exception', (new FlattenException(new Exception()))->getClass());
}

public function testArguments(): void
public function testArguments(): never
{
$this->markTestSkipped('Should be fixed');

Expand Down Expand Up @@ -151,7 +151,7 @@ public function testClosureSerialize(): void
$this->assertStringContainsString(Closure::class, serialize($flattened));
}

public function testRecursionInArguments(): void
public function testRecursionInArguments(): never
{
$this->markTestSkipped('Should be fixed');

Expand All @@ -164,7 +164,7 @@ public function testRecursionInArguments(): void
$this->assertStringContainsString('*DEEP NESTED ARRAY*', serialize($trace));
}

public function testTooBigArray(): void
public function testTooBigArray(): never
{
$this->markTestSkipped('Should be fixed');

Expand Down

0 comments on commit d46d4a8

Please sign in to comment.