Skip to content

Commit f76dc61

Browse files
author
Kirill Nesmeyanov
committed
Fix rector errors
1 parent 2d7f9c2 commit f76dc61

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

rector.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
77
use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector;
88
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
9+
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
910
use Rector\Config\RectorConfig;
1011
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
1112
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
1213
use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector;
1314
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
1415
use Rector\Set\ValueObject\LevelSetList;
1516
use Rector\Set\ValueObject\SetList;
17+
use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector;
1618

1719
return static function (RectorConfig $config): void {
1820
$config->paths([__DIR__ . '/src']);
@@ -26,26 +28,15 @@
2628
]);
2729

2830
$config->skip([
29-
//
30-
// Do not replace classic properties to promoted eq. These are
31-
// completely different statements.
32-
//
3331
ClassPropertyAssignToConstructorPromotionRector::class,
34-
35-
//
36-
// This rector can break the Doctrine that replaces implementations
37-
// with proxies, like:
38-
// - private Collection $relation; // OK This can be replaced with a proxy
39-
// + private readonly Collection $relation; // FAIL
40-
//
4132
ReadOnlyPropertyRector::class,
42-
43-
// Totally pointless "improvements"
4433
CatchExceptionNameMatchingTypeRector::class,
4534
SplitDoubleAssignRector::class,
4635
FinalizePublicClassConstantRector::class,
4736
FlipTypeControlToUseExclusiveTypeRector::class,
4837
ReturnBinaryOrToEarlyReturnRector::class,
4938
LocallyCalledStaticMethodToNonStaticRector::class,
39+
EncapsedStringsToSprintfRector::class,
40+
AddReturnTypeDeclarationFromYieldsRector::class,
5041
]);
5142
};

src/DocBlock/DescriptionFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function create(string $contents): Description
5050
*/
5151
private function createTagDescriptionChunk(int $tagId): string
5252
{
53-
return "%$tagId\$s";
53+
return "%{$tagId}\$s";
5454
}
5555

5656
/**

src/DocBlock/StandardTagFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public function create(string $tag): TagInterface
8080
{
8181
[$name, $body] = $this->parts->extract($tag);
8282

83-
if ($factory = $this->getFactory($name)) {
83+
$factory = $this->getFactory($name);
84+
if ($factory !== null) {
8485
$body ??= '';
8586

8687
try {

src/DocBlockFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ private function splitByDocBlockTags(string $docblock): array
168168
}
169169

170170
if (\str_starts_with($tag, ' ')) {
171-
$description .= "\n@$tag";
171+
$description .= "\n@{$tag}";
172172
continue;
173173
}
174174

175-
$tags[] = $this->tags->create("@$tag");
175+
$tags[] = $this->tags->create("@{$tag}");
176176
}
177177

178178
return [$this->descriptions->create($description), $tags];

0 commit comments

Comments
 (0)