mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-29 07:20:52 +00:00
Updated Rector to commit ce62c634015fefa1f91429ecda659fe71371b85a
ce62c63401
Remove rule DataProviderArrayItemsNewlinedRector.php (#5227)
This commit is contained in:
parent
8e33333b8d
commit
c221b7e43d
|
@ -1,4 +1,4 @@
|
||||||
# 356 Rules Overview
|
# 355 Rules Overview
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
- [CodeQuality](#codequality) (72)
|
- [CodeQuality](#codequality) (72)
|
||||||
|
|
||||||
- [CodingStyle](#codingstyle) (29)
|
- [CodingStyle](#codingstyle) (28)
|
||||||
|
|
||||||
- [DeadCode](#deadcode) (42)
|
- [DeadCode](#deadcode) (42)
|
||||||
|
|
||||||
|
@ -1720,38 +1720,6 @@ Change count array comparison to empty array comparison to improve performance
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
### DataProviderArrayItemsNewlinedRector
|
|
||||||
|
|
||||||
Change data provider in PHPUnit test case to newline per item
|
|
||||||
|
|
||||||
- class: [`Rector\CodingStyle\Rector\ClassMethod\DataProviderArrayItemsNewlinedRector`](../rules/CodingStyle/Rector/ClassMethod/DataProviderArrayItemsNewlinedRector.php)
|
|
||||||
|
|
||||||
```diff
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
final class ImageBinaryTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @dataProvider provideData()
|
|
||||||
*/
|
|
||||||
public function testGetBytesSize(string $content, int $number): void
|
|
||||||
{
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function provideData(): array
|
|
||||||
{
|
|
||||||
- return [['content', 8], ['content123', 11]];
|
|
||||||
+ return [
|
|
||||||
+ ['content', 8],
|
|
||||||
+ ['content123', 11]
|
|
||||||
+ ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
### EncapsedStringsToSprintfRector
|
### EncapsedStringsToSprintfRector
|
||||||
|
|
||||||
Convert enscaped {$string} to more readable sprintf or concat, if no mask is used
|
Convert enscaped {$string} to more readable sprintf or concat, if no mask is used
|
||||||
|
|
|
@ -1,126 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace Rector\CodingStyle\Rector\ClassMethod;
|
|
||||||
|
|
||||||
use PhpParser\Node;
|
|
||||||
use PhpParser\Node\Expr\Array_;
|
|
||||||
use PhpParser\Node\Stmt\ClassMethod;
|
|
||||||
use PhpParser\Node\Stmt\Return_;
|
|
||||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
|
||||||
use Rector\Core\Rector\AbstractRector;
|
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
|
||||||
use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|
||||||
/**
|
|
||||||
* @see \Rector\Tests\CodingStyle\Rector\ClassMethod\DataProviderArrayItemsNewlinedRector\DataProviderArrayItemsNewlinedRectorTest
|
|
||||||
*/
|
|
||||||
final class DataProviderArrayItemsNewlinedRector extends AbstractRector
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @readonly
|
|
||||||
* @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer
|
|
||||||
*/
|
|
||||||
private $testsNodeAnalyzer;
|
|
||||||
/**
|
|
||||||
* @readonly
|
|
||||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
|
||||||
*/
|
|
||||||
private $betterNodeFinder;
|
|
||||||
public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, BetterNodeFinder $betterNodeFinder)
|
|
||||||
{
|
|
||||||
$this->testsNodeAnalyzer = $testsNodeAnalyzer;
|
|
||||||
$this->betterNodeFinder = $betterNodeFinder;
|
|
||||||
}
|
|
||||||
public function getRuleDefinition() : RuleDefinition
|
|
||||||
{
|
|
||||||
return new RuleDefinition('Change data provider in PHPUnit test case to newline per item', [new CodeSample(<<<'CODE_SAMPLE'
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
final class ImageBinaryTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @dataProvider provideData()
|
|
||||||
*/
|
|
||||||
public function testGetBytesSize(string $content, int $number): void
|
|
||||||
{
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function provideData(): array
|
|
||||||
{
|
|
||||||
return [['content', 8], ['content123', 11]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CODE_SAMPLE
|
|
||||||
, <<<'CODE_SAMPLE'
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
final class ImageBinaryTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @dataProvider provideData()
|
|
||||||
*/
|
|
||||||
public function testGetBytesSize(string $content, int $number): void
|
|
||||||
{
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function provideData(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
['content', 8],
|
|
||||||
['content123', 11]
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CODE_SAMPLE
|
|
||||||
)]);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return array<class-string<Node>>
|
|
||||||
*/
|
|
||||||
public function getNodeTypes() : array
|
|
||||||
{
|
|
||||||
return [ClassMethod::class];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param ClassMethod $node
|
|
||||||
*/
|
|
||||||
public function refactor(Node $node) : ?Node
|
|
||||||
{
|
|
||||||
if (!$node->isPublic()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!$this->testsNodeAnalyzer->isInTestClass($node)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// skip test methods
|
|
||||||
if (\strncmp($node->name->toString(), 'test', \strlen('test')) === 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// find array in data provider - must contain a return node
|
|
||||||
/** @var Return_[] $returns */
|
|
||||||
$returns = $this->betterNodeFinder->findInstanceOf((array) $node->stmts, Return_::class);
|
|
||||||
$hasChanged = \false;
|
|
||||||
foreach ($returns as $return) {
|
|
||||||
if (!$return->expr instanceof Array_) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$array = $return->expr;
|
|
||||||
if ($array->items === []) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// ensure newlined printed
|
|
||||||
$array->setAttribute(AttributeKey::NEWLINED_ARRAY_PRINT, \true);
|
|
||||||
// invoke reprint
|
|
||||||
$array->setAttribute(AttributeKey::ORIGINAL_NODE, null);
|
|
||||||
$hasChanged = \true;
|
|
||||||
}
|
|
||||||
if ($hasChanged) {
|
|
||||||
return $node;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '6d8074534f3b568a0cecd373e584ea6c8d06580b';
|
public const PACKAGE_VERSION = 'ce62c634015fefa1f91429ecda659fe71371b85a';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2023-11-06 16:15:19';
|
public const RELEASE_DATE = '2023-11-07 12:58:20';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
|
@ -1117,7 +1117,6 @@ return array(
|
||||||
'Rector\\CodingStyle\\Rector\\Catch_\\CatchExceptionNameMatchingTypeRector' => $baseDir . '/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php',
|
'Rector\\CodingStyle\\Rector\\Catch_\\CatchExceptionNameMatchingTypeRector' => $baseDir . '/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\ClassConst\\RemoveFinalFromConstRector' => $baseDir . '/rules/CodingStyle/Rector/ClassConst/RemoveFinalFromConstRector.php',
|
'Rector\\CodingStyle\\Rector\\ClassConst\\RemoveFinalFromConstRector' => $baseDir . '/rules/CodingStyle/Rector/ClassConst/RemoveFinalFromConstRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\ClassConst\\SplitGroupedClassConstantsRector' => $baseDir . '/rules/CodingStyle/Rector/ClassConst/SplitGroupedClassConstantsRector.php',
|
'Rector\\CodingStyle\\Rector\\ClassConst\\SplitGroupedClassConstantsRector' => $baseDir . '/rules/CodingStyle/Rector/ClassConst/SplitGroupedClassConstantsRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\ClassMethod\\DataProviderArrayItemsNewlinedRector' => $baseDir . '/rules/CodingStyle/Rector/ClassMethod/DataProviderArrayItemsNewlinedRector.php',
|
|
||||||
'Rector\\CodingStyle\\Rector\\ClassMethod\\FuncGetArgsToVariadicParamRector' => $baseDir . '/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php',
|
'Rector\\CodingStyle\\Rector\\ClassMethod\\FuncGetArgsToVariadicParamRector' => $baseDir . '/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\ClassMethod\\MakeInheritedMethodVisibilitySameAsParentRector' => $baseDir . '/rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php',
|
'Rector\\CodingStyle\\Rector\\ClassMethod\\MakeInheritedMethodVisibilitySameAsParentRector' => $baseDir . '/rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\ClassMethod\\NewlineBeforeNewAssignSetRector' => $baseDir . '/rules/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php',
|
'Rector\\CodingStyle\\Rector\\ClassMethod\\NewlineBeforeNewAssignSetRector' => $baseDir . '/rules/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php',
|
||||||
|
|
1
vendor/composer/autoload_static.php
vendored
1
vendor/composer/autoload_static.php
vendored
|
@ -1335,7 +1335,6 @@ class ComposerStaticInit18ad0e678efbbb500e116f7c54cccdd4
|
||||||
'Rector\\CodingStyle\\Rector\\Catch_\\CatchExceptionNameMatchingTypeRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php',
|
'Rector\\CodingStyle\\Rector\\Catch_\\CatchExceptionNameMatchingTypeRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\ClassConst\\RemoveFinalFromConstRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassConst/RemoveFinalFromConstRector.php',
|
'Rector\\CodingStyle\\Rector\\ClassConst\\RemoveFinalFromConstRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassConst/RemoveFinalFromConstRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\ClassConst\\SplitGroupedClassConstantsRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassConst/SplitGroupedClassConstantsRector.php',
|
'Rector\\CodingStyle\\Rector\\ClassConst\\SplitGroupedClassConstantsRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassConst/SplitGroupedClassConstantsRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\ClassMethod\\DataProviderArrayItemsNewlinedRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassMethod/DataProviderArrayItemsNewlinedRector.php',
|
|
||||||
'Rector\\CodingStyle\\Rector\\ClassMethod\\FuncGetArgsToVariadicParamRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php',
|
'Rector\\CodingStyle\\Rector\\ClassMethod\\FuncGetArgsToVariadicParamRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\ClassMethod\\MakeInheritedMethodVisibilitySameAsParentRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php',
|
'Rector\\CodingStyle\\Rector\\ClassMethod\\MakeInheritedMethodVisibilitySameAsParentRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\ClassMethod\\NewlineBeforeNewAssignSetRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php',
|
'Rector\\CodingStyle\\Rector\\ClassMethod\\NewlineBeforeNewAssignSetRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php',
|
||||||
|
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
|
@ -1808,12 +1808,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
|
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
|
||||||
"reference": "79785959255d68ad21b5d6e2a010d4435f0f8165"
|
"reference": "a98e6d335d52ec37c18388a8706677aeb372cd80"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/79785959255d68ad21b5d6e2a010d4435f0f8165",
|
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/a98e6d335d52ec37c18388a8706677aeb372cd80",
|
||||||
"reference": "79785959255d68ad21b5d6e2a010d4435f0f8165",
|
"reference": "a98e6d335d52ec37c18388a8706677aeb372cd80",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1843,7 +1843,7 @@
|
||||||
"tomasvotruba\/unused-public": "^0.3",
|
"tomasvotruba\/unused-public": "^0.3",
|
||||||
"tracy\/tracy": "^2.10"
|
"tracy\/tracy": "^2.10"
|
||||||
},
|
},
|
||||||
"time": "2023-11-07T11:02:59+00:00",
|
"time": "2023-11-07T11:58:05+00:00",
|
||||||
"default-branch": true,
|
"default-branch": true,
|
||||||
"type": "rector-extension",
|
"type": "rector-extension",
|
||||||
"extra": {
|
"extra": {
|
||||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -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 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 7978595'), '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 a98e6d3'), '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()
|
private function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user