From 0791670379e759658133691360b51564510745ff Mon Sep 17 00:00:00 2001 From: Sebastian Schreiber Date: Mon, 7 Nov 2022 08:46:06 +0100 Subject: [PATCH] TASK: Update rector --- composer.json | 2 +- .../ImplementSiteLanguageAwareInterfaceRector.php | 10 +--------- .../Fixture/fixture.php.inc | 2 ++ .../Fixture/remove_trait_only.php.inc | 2 -- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index 71b97c6c6..d771f9b7a 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "nette/utils": "^3.0", "nikic/php-parser": "^4.14", "phpstan/phpstan": "^1.7.12", - "rector/rector": "^0.14", + "rector/rector": "0.14.7", "symfony/console": "^4.0 || ^5.0 || ^6.0", "symfony/polyfill-php80": "^1.26", "symfony/polyfill-php81": "^1.26", diff --git a/src/Rector/v12/v0/typo3/ImplementSiteLanguageAwareInterfaceRector.php b/src/Rector/v12/v0/typo3/ImplementSiteLanguageAwareInterfaceRector.php index 47eec42d0..91bc3c68b 100644 --- a/src/Rector/v12/v0/typo3/ImplementSiteLanguageAwareInterfaceRector.php +++ b/src/Rector/v12/v0/typo3/ImplementSiteLanguageAwareInterfaceRector.php @@ -13,7 +13,6 @@ use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; use Rector\Core\Rector\AbstractScopeAwareRector; -use Rector\NodeTypeResolver\Node\AttributeKey; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -118,14 +117,7 @@ public function refactorWithScope(Node $node, Scope $scope): ?Node $classHasChanged = true; } - if ($classHasChanged) { - // invoke re-print - $node->setAttribute(AttributeKey::ORIGINAL_NODE, null); - - return $node; - } - - return null; + return $classHasChanged ? $node : null; } /** diff --git a/tests/Rector/Extensions/solr/v9/ApacheSolrDocumentToSolariumDocumentRector/Fixture/fixture.php.inc b/tests/Rector/Extensions/solr/v9/ApacheSolrDocumentToSolariumDocumentRector/Fixture/fixture.php.inc index 5eb87a1e2..7c60910bc 100644 --- a/tests/Rector/Extensions/solr/v9/ApacheSolrDocumentToSolariumDocumentRector/Fixture/fixture.php.inc +++ b/tests/Rector/Extensions/solr/v9/ApacheSolrDocumentToSolariumDocumentRector/Fixture/fixture.php.inc @@ -21,6 +21,7 @@ class MySolrIndexer */ public function multiple(array $documents) { + /** @var Apache_Solr_Document $document */ foreach ($documents as $document) { $document->setMultiValue('key', 'foo', true); } @@ -52,6 +53,7 @@ class MySolrIndexer */ public function multiple(array $documents) { + /** @var Apache_Solr_Document $document */ foreach ($documents as $document) { $document->addField('key', 'foo', true); } diff --git a/tests/Rector/v12/v0/typo3/ImplementSiteLanguageAwareInterfaceRector/Fixture/remove_trait_only.php.inc b/tests/Rector/v12/v0/typo3/ImplementSiteLanguageAwareInterfaceRector/Fixture/remove_trait_only.php.inc index 5d6c189cb..f2456be22 100644 --- a/tests/Rector/v12/v0/typo3/ImplementSiteLanguageAwareInterfaceRector/Fixture/remove_trait_only.php.inc +++ b/tests/Rector/v12/v0/typo3/ImplementSiteLanguageAwareInterfaceRector/Fixture/remove_trait_only.php.inc @@ -9,9 +9,7 @@ use TYPO3\CMS\Core\Site\SiteLanguageAwareTrait; class MyClass implements SiteLanguageAwareInterface { use SiteLanguageAwareTrait; - protected SiteLanguage $siteLanguage; - public function setSiteLanguage(SiteLanguage $siteLanguage) { $this->siteLanguage = $siteLanguage;