Updated Rector to commit 0348124a5535b99712da4debc136d2e73647b97a

0348124a55 [CodeQuality] Skip Switch_ always returned on ExplicitReturnNullRector (#5800)
This commit is contained in:
Tomas Votruba 2024-04-03 14:37:39 +00:00
parent b352c8473a
commit d36c8ad1a5
5 changed files with 18 additions and 15 deletions

View File

@ -1802,12 +1802,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git", "url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
"reference": "6845db43ccd69ef990d399ff845a53ad66fa8085" "reference": "84b87bc5183d97dfb3582a9dd43c3607b0b51856"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/6845db43ccd69ef990d399ff845a53ad66fa8085", "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/84b87bc5183d97dfb3582a9dd43c3607b0b51856",
"reference": "6845db43ccd69ef990d399ff845a53ad66fa8085", "reference": "84b87bc5183d97dfb3582a9dd43c3607b0b51856",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1830,7 +1830,7 @@
"tomasvotruba\/class-leak": "^0.2", "tomasvotruba\/class-leak": "^0.2",
"tracy\/tracy": "^2.10" "tracy\/tracy": "^2.10"
}, },
"time": "2024-03-08T15:37:45+00:00", "time": "2024-04-03T14:33:28+00:00",
"default-branch": true, "default-branch": true,
"type": "rector-extension", "type": "rector-extension",
"extra": { "extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/ */
final class GeneratedConfig final class GeneratedConfig
{ {
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main b3da143'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 05e44cf'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 6845db4'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main c8b6413')); public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main b3da143'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 05e44cf'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 84b87bc'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main c8b6413'));
private function __construct() private function __construct()
{ {
} }

View File

@ -31,13 +31,7 @@ final class DataProviderArrayItemsNewLinedRector extends AbstractRector
private $betterNodeFinder; private $betterNodeFinder;
public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, BetterNodeFinder $betterNodeFinder) public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, BetterNodeFinder $betterNodeFinder)
{ {
/**
* @readonly
*/
$this->testsNodeAnalyzer = $testsNodeAnalyzer; $this->testsNodeAnalyzer = $testsNodeAnalyzer;
/**
* @readonly
*/
$this->betterNodeFinder = $betterNodeFinder; $this->betterNodeFinder = $betterNodeFinder;
} }
public function getRuleDefinition() : RuleDefinition public function getRuleDefinition() : RuleDefinition

View File

@ -56,6 +56,10 @@ final class TestWithToDataProviderRector extends AbstractRector
* @var \Rector\NodeManipulator\ClassInsertManipulator * @var \Rector\NodeManipulator\ClassInsertManipulator
*/ */
private $classInsertManipulator; private $classInsertManipulator;
/**
* @var bool
*/
private $hasChanged = \false;
public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, PhpDocInfoFactory $phpDocInfoFactory, PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, ClassInsertManipulator $classInsertManipulator) public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, PhpDocInfoFactory $phpDocInfoFactory, PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, ClassInsertManipulator $classInsertManipulator)
{ {
$this->testsNodeAnalyzer = $testsNodeAnalyzer; $this->testsNodeAnalyzer = $testsNodeAnalyzer;
@ -111,19 +115,22 @@ CODE_SAMPLE
if (!$this->testsNodeAnalyzer->isInTestClass($node)) { if (!$this->testsNodeAnalyzer->isInTestClass($node)) {
return null; return null;
} }
$this->hasChanged = \false;
foreach ($node->stmts as $classMethod) { foreach ($node->stmts as $classMethod) {
if (!$classMethod instanceof ClassMethod) { if (!$classMethod instanceof ClassMethod) {
continue; continue;
} }
$this->refactorClassMethod($node, $classMethod); $this->refactorClassMethod($node, $classMethod);
} }
if (!$this->hasChanged) {
return null;
}
return $node; return $node;
} }
private function refactorClassMethod(Class_ $class, ClassMethod $classMethod) : void private function refactorClassMethod(Class_ $class, ClassMethod $classMethod) : void
{ {
$arrayItemsSingleLine = []; $arrayItemsSingleLine = [];
$arrayMultiLine = null; $arrayMultiLine = null;
$hasChanged = \false;
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($classMethod); $phpDocInfo = $this->phpDocInfoFactory->createFromNode($classMethod);
if (!$phpDocInfo instanceof PhpDocInfo) { if (!$phpDocInfo instanceof PhpDocInfo) {
return; return;
@ -144,9 +151,11 @@ CODE_SAMPLE
$arrayItemsSingleLine[] = new ArrayItem($this->createArrayItem($values[0])); $arrayItemsSingleLine[] = new ArrayItem($this->createArrayItem($values[0]));
} }
//cleanup //cleanup
$hasChanged = $this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $testWithPhpDocTagNode); if ($this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $testWithPhpDocTagNode)) {
$this->hasChanged = \true;
}
} }
if (!$hasChanged) { if (!$this->hasChanged) {
return; return;
} }
$dataProviderName = $this->generateDataProviderName($classMethod); $dataProviderName = $this->generateDataProviderName($classMethod);