Updated Rector to commit 6d8074534f3b568a0cecd373e584ea6c8d06580b

6d8074534f Rectify (#5226)
This commit is contained in:
Tomas Votruba 2023-11-06 15:46:58 +00:00
parent 1a3632d316
commit 2cdabcba36
4 changed files with 20 additions and 10 deletions

View File

@ -1808,12 +1808,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
"reference": "7c9ae3437ecd631ca6f86fed45cc3ad561cc3c40"
"reference": "5b701c1aaa284e8276694876dc998f7194f7477c"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/7c9ae3437ecd631ca6f86fed45cc3ad561cc3c40",
"reference": "7c9ae3437ecd631ca6f86fed45cc3ad561cc3c40",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/5b701c1aaa284e8276694876dc998f7194f7477c",
"reference": "5b701c1aaa284e8276694876dc998f7194f7477c",
"shasum": ""
},
"require": {
@ -1843,7 +1843,7 @@
"tomasvotruba\/unused-public": "^0.3",
"tracy\/tracy": "^2.10"
},
"time": "2023-11-06T10:11:07+00:00",
"time": "2023-11-06T15:42:49+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
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 9de7d58'), '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 4056166'), '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 7c9ae34'), '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 38014d4'));
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 9de7d58'), '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 4056166'), '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 5b701c1'), '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 38014d4'));
private function __construct()
{
}

View File

@ -121,7 +121,8 @@ CODE_SAMPLE
}
private function refactorClassMethod(Class_ $class, ClassMethod $classMethod) : void
{
$arrayItems = [];
$arrayItemsSingleLine = [];
$arrayMultiLine = null;
$hasChanged = \false;
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($classMethod);
if (!$phpDocInfo instanceof PhpDocInfo) {
@ -135,8 +136,13 @@ CODE_SAMPLE
if (!$testWithPhpDocTagNode->value instanceof GenericTagValueNode) {
continue;
}
[$values] = $this->extractTestWithData($testWithPhpDocTagNode->value);
$arrayItems[] = new ArrayItem($this->createArrayItem($values));
$values = $this->extractTestWithData($testWithPhpDocTagNode->value);
if (\count($values) > 1) {
$arrayMultiLine = $this->createArrayItem($values);
}
if (\count($values) === 1) {
$arrayItemsSingleLine[] = new ArrayItem($this->createArrayItem($values[0]));
}
//cleanup
$hasChanged = $this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $testWithPhpDocTagNode);
}
@ -147,9 +153,13 @@ CODE_SAMPLE
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($classMethod);
$phpDocInfo->addPhpDocTagNode(new PhpDocTagNode('@dataProvider', new GenericTagValueNode($dataProviderName)));
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($classMethod);
$returnValue = $arrayMultiLine;
if ($arrayItemsSingleLine !== []) {
$returnValue = new Array_($arrayItemsSingleLine);
}
$providerMethod = new ClassMethod($dataProviderName);
$providerMethod->flags = Class_::MODIFIER_PUBLIC;
$providerMethod->stmts[] = new Return_(new Array_($arrayItems));
$providerMethod->stmts[] = new Return_($returnValue);
$this->classInsertManipulator->addAsFirstMethod($class, $providerMethod);
}
/**