Skip to content

Commit

Permalink
[TASK] Update rector to version 0.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
brotkrueml committed Dec 5, 2022
1 parent 13d725d commit ebea63d
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 26 deletions.
1 change: 0 additions & 1 deletion Classes/Collection/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function isEmpty(): bool

/**
* @return Traversable<T>
* @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector
*/
public function getIterator(): Traversable
{
Expand Down
1 change: 0 additions & 1 deletion Classes/Collection/XmlNamespaceCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public function add(string $qualifiedName, string $namespace): void

/**
* @return \Traversable<string, string>
* @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector
*/
public function getIterator(): \Traversable
{
Expand Down
25 changes: 14 additions & 11 deletions Classes/Configuration/FeedConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,27 @@ final class FeedConfiguration
{
/**
* @param string[] $siteIdentifiers
* @param int<0, max>|null $cacheInSeconds
* @noRector ChangeAndIfToEarlyReturnRector
*/
public function __construct(
public readonly FeedInterface $instance,
public readonly string $path,
public readonly FeedFormat $format,
public readonly array $siteIdentifiers,
public readonly ?int $cacheInSeconds,
public readonly ?int $cacheInSeconds
) {
if (\is_int($this->cacheInSeconds) && ($this->cacheInSeconds < 0)) { // @phpstan-ignore-line
throw new \DomainException(
\sprintf(
'The configured cache seconds (%d) is a negative int',
$this->cacheInSeconds
),
1655707760
);
if (! \is_int($cacheInSeconds)) {
return;
}
if ($cacheInSeconds >= 0) {
return;
}

throw new \DomainException(
\sprintf(
'The configured cache seconds (%d) is a negative int',
$cacheInSeconds
),
1655707760
);
}
}
2 changes: 0 additions & 2 deletions Classes/ConfigurationModule/FeedProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public function getLabel(): string
}

/**
* @noRector AddArrayReturnDocTypeRector
* @return string[]|array{class-string, array<mixed>}
*/
public function getConfiguration(): array
Expand All @@ -74,7 +73,6 @@ public function getConfiguration(): array
}

foreach ($feeds as $class => $feedsPerClass) {
/** @noRector CountOnNullRector */
if (\count($feedsPerClass) === 1) {
$feeds[$class] = $feedsPerClass[0];
}
Expand Down
1 change: 0 additions & 1 deletion Classes/Renderer/JsonRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ private function buildAttachmentsArray(Collection $attachments): array
$attachmentArray = [
'url' => $attachment->getUrl(),
];
/** @noRector \Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector */
if ($attachment->getType() !== '') {
$attachmentArray['type'] = $attachment->getType();
}
Expand Down
1 change: 0 additions & 1 deletion Tests/Unit/Configuration/ExtensionRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public function getExtensionForElementReturnsRendererTheFirstAvailableRenderer()
}

/**
* @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector
* @param FeedFormat[] $formats
*/
private function buildExtensionClass(bool $canHandle = false, array $formats = []): JsonExtensionInterface&XmlExtensionInterface
Expand Down
4 changes: 0 additions & 4 deletions Tests/Unit/ConfigurationModule/ExtensionProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public function getLabelReturnsCorrectLabel(): void
/**
* @test
* @dataProvider providerForGetConfigurations
* @noRector AddArrayParamDocTypeRector
*/
public function getConfigurationsReturnsArrayWithConfigurationsCorrectly(
array $configurations,
Expand Down Expand Up @@ -185,9 +184,6 @@ public function getAllExtensions(): iterable
return $subject;
}

/**
* @noRector \Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector
*/
private function buildExtensionForXmlAndJson(string $qualifiedName, string $namespace, string $about): JsonExtensionInterface&XmlExtensionInterface
{
return new class($qualifiedName, $namespace, $about) implements JsonExtensionInterface, XmlExtensionInterface {
Expand Down
1 change: 0 additions & 1 deletion Tests/Unit/ConfigurationModule/FeedProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public function getLabelReturnsCorrectLabel(): void
/**
* @test
* @dataProvider providerForGetConfigurations
* @noRector AddArrayParamDocTypeRector
*/
public function getConfigurationsReturnsArrayWithConfigurationsCorrectly(
array $configurations,
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "1.9.2",
"phpunit/phpunit": "^9.5.23",
"rector/rector": "0.14.8",
"rector/rector": "0.15.0",
"symfony/yaml": "^5.4 || ^6.1",
"symplify/phpstan-rules": "^11.1",
"typo3/cms-lowlevel": "^11.5 || ^12.0"
Expand Down
10 changes: 7 additions & 3 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector;
use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayParamDocTypeRector;
use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_81);
Expand Down Expand Up @@ -36,8 +37,11 @@
]);
$rectorConfig->skip([
AddLiteralSeparatorToNumberRector::class,
AddArrayParamDocTypeRector::class => [
AddReturnTypeDeclarationFromYieldsRector::class => [
__DIR__ . '/Tests',
]
],
RemoveAlwaysTrueIfConditionRector::class => [
__DIR__ . '/Classes/Renderer/JsonRenderer.php',
],
]);
};

0 comments on commit ebea63d

Please sign in to comment.