mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-15 07:32:23 +00:00
Change file system approach of MultipleClassFileToPsr4ClassesRector to file without namespace node (#4522)
* Change file system approach of MultipleClassFileToPsr4ClassesRector to file without namespace node * update DecoupleClassMethodToOwnClassRector * [ci] add rebase jobp * disable fail fast for unit tests * misc
This commit is contained in:
parent
3bf107594e
commit
0513315056
5
.github/workflows/automated_rebase.yaml
vendored
5
.github/workflows/automated_rebase.yaml
vendored
|
@ -1,10 +1,9 @@
|
|||
name: Automatic Rebase
|
||||
|
||||
on:
|
||||
pull_request: null
|
||||
schedule:
|
||||
# every 10 minutes, https://crontab.guru/#0/10_*_*_*_*
|
||||
- cron: 0/10 * * * *
|
||||
# every 5 minutes, https://crontab.guru/#0/10_*_*_*_*
|
||||
- cron: 0/5 * * * *
|
||||
|
||||
jobs:
|
||||
automated_rebase:
|
||||
|
|
6
.github/workflows/ci_review.yaml
vendored
6
.github/workflows/ci_review.yaml
vendored
|
@ -35,6 +35,7 @@ jobs:
|
|||
|
||||
|
||||
name: ${{ matrix.actions.name }}
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
@ -53,7 +54,8 @@ jobs:
|
|||
uses: actions/checkout@v2
|
||||
|
||||
# see https://github.com/shivammathur/setup-php
|
||||
- uses: shivammathur/setup-php@v1
|
||||
-
|
||||
uses: shivammathur/setup-php@v1
|
||||
with:
|
||||
php-version: 7.4
|
||||
coverage: none
|
||||
|
@ -72,6 +74,8 @@ jobs:
|
|||
message: '[ci-review] ${{ matrix.actions.commit_message }}'
|
||||
author_name: rector-bot
|
||||
author_email: tomas@getrector.org
|
||||
# solves https://github.com/rectorphp/rector/runs/1335693491#step:7:394
|
||||
pull_strategy: '--rebase'
|
||||
env:
|
||||
# to get push access
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
|
|
7
.github/workflows/code_analysis.yaml
vendored
7
.github/workflows/code_analysis.yaml
vendored
|
@ -2,9 +2,6 @@ name: Code Analysis
|
|||
|
||||
on:
|
||||
pull_request: null
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
|
@ -50,8 +47,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# see https://github.com/shivammathur/setup-php
|
||||
- uses: shivammathur/setup-php@v1
|
||||
-
|
||||
uses: shivammathur/setup-php@v1
|
||||
with:
|
||||
php-version: 7.4
|
||||
coverage: none
|
||||
|
|
5
.github/workflows/code_analysis_no_dev.yaml
vendored
5
.github/workflows/code_analysis_no_dev.yaml
vendored
|
@ -2,9 +2,6 @@ name: Code Analysis [no dev]
|
|||
|
||||
on:
|
||||
pull_request: null
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
|
@ -28,7 +25,7 @@ jobs:
|
|||
with:
|
||||
php-version: 7.4
|
||||
coverage: none
|
||||
tools: composer:v1
|
||||
tools: composer:v2
|
||||
|
||||
- run: composer install --no-progress --ansi
|
||||
|
||||
|
|
12
.github/workflows/code_coverage.yaml
vendored
12
.github/workflows/code_coverage.yaml
vendored
|
@ -10,16 +10,20 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: shivammathur/setup-php@v1
|
||||
|
||||
-
|
||||
uses: shivammathur/setup-php@v1
|
||||
with:
|
||||
php-version: 7.3
|
||||
coverage: pcov
|
||||
tools: composer:v1
|
||||
tools: composer:v2
|
||||
|
||||
- run: composer install --no-progress --ansi
|
||||
-
|
||||
run: composer install --no-progress --ansi
|
||||
|
||||
# https://kizu514.com/blog/pcov-is-better-than-phpdbg-and-xdebug-for-code-coverage/
|
||||
- run: |
|
||||
-
|
||||
run: |
|
||||
vendor/bin/phpunit --coverage-clover build/logs/clover.xml
|
||||
# Coveralls.io
|
||||
composer require --dev php-coveralls/php-coveralls:^2.4
|
||||
|
|
6
.github/workflows/rector.yaml
vendored
6
.github/workflows/rector.yaml
vendored
|
@ -2,9 +2,6 @@ name: Rector Run
|
|||
|
||||
on:
|
||||
pull_request: null
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
|
@ -30,7 +27,8 @@ jobs:
|
|||
with:
|
||||
php-version: 7.4
|
||||
coverage: none
|
||||
tools: composer:v1
|
||||
tools: composer:v2
|
||||
|
||||
- run: ${{ matrix.actions.install }}
|
||||
|
||||
- run: ${{ matrix.actions.run }}
|
||||
|
|
4
.github/workflows/standalone_run.yaml
vendored
4
.github/workflows/standalone_run.yaml
vendored
|
@ -1,9 +1,7 @@
|
|||
name: Standalone Run
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request: null
|
||||
|
||||
jobs:
|
||||
standalone_run:
|
||||
|
|
4
.github/workflows/tests.yaml
vendored
4
.github/workflows/tests.yaml
vendored
|
@ -2,14 +2,12 @@ name: Tests
|
|||
|
||||
on:
|
||||
pull_request: null
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ['7.3', '7.4']
|
||||
dependencies: ['locked']
|
||||
|
|
|
@ -50,6 +50,7 @@ expectedArguments(
|
|||
\Rector\NodeTypeResolver\Node\AttributeKey::ARGUMENT_POSITION,
|
||||
\Rector\NodeTypeResolver\Node\AttributeKey::IS_FIRST_LEVEL_STATEMENT,
|
||||
\Rector\NodeTypeResolver\Node\AttributeKey::IS_FRESH_NODE,
|
||||
\Rector\NodeTypeResolver\Node\AttributeKey::FILE_INFO,
|
||||
);
|
||||
|
||||
expectedArguments(
|
||||
|
@ -85,6 +86,7 @@ expectedArguments(
|
|||
\Rector\NodeTypeResolver\Node\AttributeKey::ARGUMENT_POSITION,
|
||||
\Rector\NodeTypeResolver\Node\AttributeKey::IS_FIRST_LEVEL_STATEMENT,
|
||||
\Rector\NodeTypeResolver\Node\AttributeKey::IS_FRESH_NODE,
|
||||
\Rector\NodeTypeResolver\Node\AttributeKey::FILE_INFO,
|
||||
);
|
||||
|
||||
expectedArguments(
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
"rules/restoration/tests/Rector/Use_/RestoreFullyQualifiedNameRector/Source/ShortClassOnly.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Rector\\Testing\\": "packages/testing/src",
|
||||
"Rector\\Architecture\\": "rules/architecture/src",
|
||||
"Rector\\AttributeAwarePhpDoc\\": "packages/attribute-aware-php-doc/src",
|
||||
"Rector\\Autodiscovery\\": "rules/autodiscovery/src",
|
||||
|
@ -166,6 +167,7 @@
|
|||
"Rector\\SOLID\\": "rules/solid/src",
|
||||
"Rector\\Sensio\\": "rules/sensio/src",
|
||||
"Rector\\Set\\": "packages/set/src",
|
||||
"Rector\\NewFilePrinter\\": "packages/new-file-printer/src",
|
||||
"Rector\\SimplePhpDocParser\\": "packages/simple-php-doc-parser/src",
|
||||
"Rector\\StaticTypeMapper\\": "packages/static-type-mapper/src",
|
||||
"Rector\\StrictCodeQuality\\": "rules/strict-code-quality/src",
|
||||
|
@ -188,7 +190,7 @@
|
|||
"rules/autodiscovery/tests/Rector/FileSystem/MoveServicesBySuffixToDirectoryRector/Expected",
|
||||
"rules/cakephp/tests/Rector/FileWithoutNamespace/ImplicitShortClassNameUseStatementRector/Source",
|
||||
"rules/cakephp/tests/Rector/Namespace_/AppUsesStaticCallToUseStatementRector/Source",
|
||||
"rules/psr4/tests/Rector/MultipleClassFileToPsr4ClassesRector/Source",
|
||||
"rules/psr4/tests/Rector/Namespace_/MultipleClassFileToPsr4ClassesRector/Source",
|
||||
"rules/renaming/tests/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector/Source",
|
||||
"rules/symfony/tests/Rector/MethodCall/ContainerGetToConstructorInjectionRector/Source",
|
||||
"tests/Source"
|
||||
|
|
|
@ -44,7 +44,6 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->load('Rector\Core\\', __DIR__ . '/../src')
|
||||
->exclude([
|
||||
__DIR__ . '/../src/Rector',
|
||||
__DIR__ . '/../src/Testing/PHPUnit',
|
||||
__DIR__ . '/../src/RectorDefinition',
|
||||
__DIR__ . '/../src/Exception',
|
||||
__DIR__ . '/../src/DependencyInjection/CompilerPass',
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\DowngradePhp73\Rector\String_\DowngradeFlexibleHeredocSyntaxRector;
|
||||
use Rector\DowngradePhp73\Rector\List_\DowngradeListReferenceAssignmentRector;
|
||||
use Rector\DowngradePhp73\Rector\String_\DowngradeFlexibleHeredocSyntaxRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector;
|
||||
use Rector\PSR4\Rector\MultipleClassFileToPsr4ClassesRector;
|
||||
use Rector\PSR4\Rector\Namespace_\MultipleClassFileToPsr4ClassesRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# All 599 Rectors Overview
|
||||
# All 600 Rectors Overview
|
||||
|
||||
- [Projects](#projects)
|
||||
---
|
||||
|
@ -17,7 +17,7 @@
|
|||
- [DoctrineGedmoToKnplabs](#doctrinegedmotoknplabs) (7)
|
||||
- [DowngradePhp71](#downgradephp71) (3)
|
||||
- [DowngradePhp72](#downgradephp72) (2)
|
||||
- [DowngradePhp73](#downgradephp73) (1)
|
||||
- [DowngradePhp73](#downgradephp73) (2)
|
||||
- [DowngradePhp74](#downgradephp74) (7)
|
||||
- [DowngradePhp80](#downgradephp80) (6)
|
||||
- [FileSystemRector](#filesystemrector) (1)
|
||||
|
@ -5031,6 +5031,26 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
## DowngradePhp73
|
||||
|
||||
### `DowngradeFlexibleHeredocSyntaxRector`
|
||||
|
||||
- class: [`Rector\DowngradePhp73\Rector\String_\DowngradeFlexibleHeredocSyntaxRector`](/rules/downgrade-php73/src/Rector/String_/DowngradeFlexibleHeredocSyntaxRector.php)
|
||||
|
||||
Changes heredoc/nowdoc that contains closing word to safe wrapper name
|
||||
|
||||
```diff
|
||||
$query = <<<SQL
|
||||
- SELECT *
|
||||
- FROM `table`
|
||||
- WHERE `column` = true;
|
||||
- SQL;
|
||||
+SELECT *
|
||||
+FROM `table`
|
||||
+WHERE `column` = true;
|
||||
+SQL;
|
||||
```
|
||||
|
||||
<br><br>
|
||||
|
||||
### `DowngradeListReferenceAssignmentRector`
|
||||
|
||||
- class: [`Rector\DowngradePhp73\Rector\List_\DowngradeListReferenceAssignmentRector`](/rules/downgrade-php73/src/Rector/List_/DowngradeListReferenceAssignmentRector.php)
|
||||
|
@ -10432,9 +10452,10 @@ Add response content to response code assert, so it is easier to debug
|
|||
|
||||
### `MultipleClassFileToPsr4ClassesRector`
|
||||
|
||||
- class: [`Rector\PSR4\Rector\MultipleClassFileToPsr4ClassesRector`](/rules/psr4/src/Rector/MultipleClassFileToPsr4ClassesRector.php)
|
||||
- class: [`Rector\PSR4\Rector\Namespace_\MultipleClassFileToPsr4ClassesRector`](/rules/psr4/src/Rector/Namespace_/MultipleClassFileToPsr4ClassesRector.php)
|
||||
- [test fixtures](/rules/psr4/tests/Rector/Namespace_/MultipleClassFileToPsr4ClassesRector/Fixture)
|
||||
|
||||
Turns namespaced classes in one file to standalone PSR-4 classes.
|
||||
Change multiple classes in one file to standalone PSR-4 classes.
|
||||
|
||||
```diff
|
||||
+// new file: "app/Exceptions/FirstException.php"
|
||||
|
@ -10444,7 +10465,6 @@ Turns namespaced classes in one file to standalone PSR-4 classes.
|
|||
|
||||
final class FirstException extends Exception
|
||||
{
|
||||
|
||||
}
|
||||
+
|
||||
+// new file: "app/Exceptions/SecondException.php"
|
||||
|
@ -10454,7 +10474,6 @@ Turns namespaced classes in one file to standalone PSR-4 classes.
|
|||
|
||||
final class SecondException extends Exception
|
||||
{
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -10465,7 +10484,7 @@ Turns namespaced classes in one file to standalone PSR-4 classes.
|
|||
- class: [`Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector`](/rules/psr4/src/Rector/FileWithoutNamespace/NormalizeNamespaceByPSR4ComposerAutoloadRector.php)
|
||||
- [test fixtures](/rules/psr4/tests/Rector/FileWithoutNamespace/NormalizeNamespaceByPSR4ComposerAutoloadRector/Fixture)
|
||||
|
||||
Adds namespace to namespace-less files or correct namespace to match PSR-4 in `composer.json` autoload section. Run with combination with `Rector\PSR4\Rector\MultipleClassFileToPsr4ClassesRector`
|
||||
Adds namespace to namespace-less files or correct namespace to match PSR-4 in `composer.json` autoload section. Run with combination with `Rector\PSR4\Rector\Namespace_\MultipleClassFileToPsr4ClassesRector`
|
||||
|
||||
```diff
|
||||
// src/SomeClass.php
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\Caching\Tests\Detector;
|
|||
|
||||
use Iterator;
|
||||
use Rector\Caching\Detector\ChangedFilesDetector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ChangedFilesDetectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -80,6 +80,16 @@ final class ErrorAndDiffCollector
|
|||
return $this->removedAndAddedFilesCollector->getAffectedFilesCount();
|
||||
}
|
||||
|
||||
public function getAddFilesCount(): int
|
||||
{
|
||||
return $this->removedAndAddedFilesCollector->getAddedFileCount();
|
||||
}
|
||||
|
||||
public function getRemovedFilesCount(): int
|
||||
{
|
||||
return $this->removedAndAddedFilesCollector->getRemovedFilesCount();
|
||||
}
|
||||
|
||||
public function getRemovedNodeCount(): int
|
||||
{
|
||||
return $this->nodesToRemoveCollector->getCount();
|
||||
|
|
|
@ -156,8 +156,13 @@ final class ConsoleOutputFormatter implements OutputFormatterInterface
|
|||
|
||||
private function reportRemovedFilesAndNodes(ErrorAndDiffCollector $errorAndDiffCollector): void
|
||||
{
|
||||
if ($errorAndDiffCollector->getRemovedAndAddedFilesCount() !== 0) {
|
||||
$message = sprintf('%d files were added/removed', $errorAndDiffCollector->getRemovedAndAddedFilesCount());
|
||||
if ($errorAndDiffCollector->getAddFilesCount() !== 0) {
|
||||
$message = sprintf('%d files were added', $errorAndDiffCollector->getAddFilesCount());
|
||||
$this->symfonyStyle->note($message);
|
||||
}
|
||||
|
||||
if ($errorAndDiffCollector->getRemovedFilesCount() !== 0) {
|
||||
$message = sprintf('%d files were removed', $errorAndDiffCollector->getRemovedFilesCount());
|
||||
$this->symfonyStyle->note($message);
|
||||
}
|
||||
|
||||
|
@ -175,6 +180,7 @@ final class ConsoleOutputFormatter implements OutputFormatterInterface
|
|||
if ($errorAndDiffCollector->getRemovedNodeCount() === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$message = sprintf('%d nodes were removed', $errorAndDiffCollector->getRemovedNodeCount());
|
||||
|
||||
$this->symfonyStyle->warning($message);
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace Rector\DocumentationGenerator\Command;
|
|||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\Console\Command\AbstractCommand;
|
||||
use Rector\Core\Contract\Rector\RectorInterface;
|
||||
use Rector\Core\Testing\Finder\RectorsFinder;
|
||||
use Rector\DocumentationGenerator\Printer\RectorsDocumentationPrinter;
|
||||
use Rector\Testing\Finder\RectorsFinder;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
|
|
@ -7,6 +7,9 @@ namespace Rector\FileSystemRector\Contract;
|
|||
use Rector\Core\Contract\Rector\RectorInterface;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
interface FileSystemRectorInterface extends RectorInterface
|
||||
{
|
||||
public function refactor(SmartFileInfo $smartFileInfo): void;
|
||||
|
|
|
@ -6,10 +6,10 @@ namespace Rector\FileSystemRector;
|
|||
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Logging\CurrentRectorProvider;
|
||||
use Rector\Core\Testing\Application\EnabledRectorsProvider;
|
||||
use Rector\Core\Testing\PHPUnit\StaticPHPUnitEnvironment;
|
||||
use Rector\FileSystemRector\Contract\FileSystemRectorInterface;
|
||||
use Rector\NodeTypeResolver\FileSystem\CurrentFileInfoProvider;
|
||||
use Rector\Testing\Application\EnabledRectorsProvider;
|
||||
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class FileSystemFileProcessor
|
||||
|
|
|
@ -16,7 +16,7 @@ final class RemoveProjectFileRector extends AbstractFileSystemRector implements
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const FILE_PATHS_TO_REMOVE = '$filePathsToRemove';
|
||||
public const FILE_PATHS_TO_REMOVE = 'file_paths_to_remove';
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
|
|
16
packages/new-file-printer/config/config.php
Normal file
16
packages/new-file-printer/config/config.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->defaults()
|
||||
->public()
|
||||
->autowire()
|
||||
->autoconfigure();
|
||||
|
||||
$services->load('Rector\NewFilePrinter\\', __DIR__ . '/../src');
|
||||
};
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\NewFilePrinter\Printer;
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use PhpParser\Lexer;
|
||||
use PhpParser\Node;
|
||||
use Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector;
|
||||
use Rector\Core\PhpParser\Printer\BetterStandardPrinter;
|
||||
use Rector\PostRector\Application\PostFileProcessor;
|
||||
|
||||
final class NodesToDestinationPrinter
|
||||
{
|
||||
/**
|
||||
* @var Lexer
|
||||
*/
|
||||
private $lexer;
|
||||
|
||||
/**
|
||||
* @var PostFileProcessor
|
||||
*/
|
||||
private $postFileProcessor;
|
||||
|
||||
/**
|
||||
* @var BetterStandardPrinter
|
||||
*/
|
||||
private $betterStandardPrinter;
|
||||
|
||||
/**
|
||||
* @var RemovedAndAddedFilesCollector
|
||||
*/
|
||||
private $removedAndAddedFilesCollector;
|
||||
|
||||
public function __construct(
|
||||
PostFileProcessor $postFileProcessor,
|
||||
BetterStandardPrinter $betterStandardPrinter,
|
||||
Lexer $lexer,
|
||||
RemovedAndAddedFilesCollector $removedAndAddedFilesCollector
|
||||
) {
|
||||
$this->postFileProcessor = $postFileProcessor;
|
||||
$this->betterStandardPrinter = $betterStandardPrinter;
|
||||
$this->lexer = $lexer;
|
||||
$this->removedAndAddedFilesCollector = $removedAndAddedFilesCollector;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node[]|Node $nodes
|
||||
*/
|
||||
public function printNewNodesToFilePath($nodes, string $fileDestination): void
|
||||
{
|
||||
if (! is_array($nodes)) {
|
||||
$nodes = [$nodes];
|
||||
}
|
||||
|
||||
$nodes = $this->postFileProcessor->traverse($nodes);
|
||||
|
||||
$fileContent = $this->betterStandardPrinter->prettyPrintFile($nodes);
|
||||
$fileContent = $this->resolveLastEmptyLine($fileContent);
|
||||
|
||||
$this->removedAndAddedFilesCollector->addFileWithContent($fileDestination, $fileContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add empty line in the end, if it is in the original tokens
|
||||
*/
|
||||
private function resolveLastEmptyLine(string $prettyPrintContent): string
|
||||
{
|
||||
$tokens = $this->lexer->getTokens();
|
||||
$lastToken = array_pop($tokens);
|
||||
if ($lastToken && Strings::contains($lastToken[1], "\n")) {
|
||||
$prettyPrintContent = trim($prettyPrintContent) . PHP_EOL;
|
||||
}
|
||||
|
||||
return $prettyPrintContent;
|
||||
}
|
||||
}
|
|
@ -15,6 +15,11 @@ use Symplify\SmartFileSystem\SmartFileInfo;
|
|||
|
||||
final class AttributeKey
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const DECLARES = 'declares';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -156,6 +161,14 @@ final class AttributeKey
|
|||
*/
|
||||
public const NAMESPACED_NAME = 'namespacedName';
|
||||
|
||||
/**
|
||||
* Internal php-parser name.
|
||||
* Do not change this even if you want!
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const DOC_INDENTATION = 'docIndentation';
|
||||
|
||||
/**
|
||||
* Internal php-parser name.
|
||||
* Do not change this even if you want!
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\NodeTypeResolver\NodeVisitor;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\Declare_;
|
||||
use PhpParser\Node\Stmt\Namespace_;
|
||||
use PhpParser\Node\Stmt\Use_;
|
||||
use PhpParser\NodeVisitorAbstract;
|
||||
|
@ -13,6 +14,11 @@ use Rector\NodeTypeResolver\Node\AttributeKey;
|
|||
|
||||
final class NamespaceNodeVisitor extends NodeVisitorAbstract
|
||||
{
|
||||
/**
|
||||
* @var Declare_[]
|
||||
*/
|
||||
private $declares = [];
|
||||
|
||||
/**
|
||||
* @var Use_[]
|
||||
*/
|
||||
|
@ -52,6 +58,10 @@ final class NamespaceNodeVisitor extends NodeVisitorAbstract
|
|||
$uses = $this->betterNodeFinder->findInstanceOf($nodes, Use_::class);
|
||||
$this->useNodes = $uses;
|
||||
|
||||
/** @var Declare_[] $declares */
|
||||
$declares = $this->betterNodeFinder->findInstanceOf($nodes, Declare_::class);
|
||||
$this->declares = $declares;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -69,6 +79,7 @@ final class NamespaceNodeVisitor extends NodeVisitorAbstract
|
|||
$node->setAttribute(AttributeKey::NAMESPACE_NAME, $this->namespaceName);
|
||||
$node->setAttribute(AttributeKey::NAMESPACE_NODE, $this->namespace);
|
||||
$node->setAttribute(AttributeKey::USE_NODES, $this->useNodes);
|
||||
$node->setAttribute(AttributeKey::DECLARES, $this->declares);
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ use PhpParser\Node\Stmt\Class_;
|
|||
use PhpParser\NodeTraverser;
|
||||
use PhpParser\NodeVisitor\NameResolver;
|
||||
use Rector\Core\HttpKernel\RectorKernel;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractNodeVisitorTestCase;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\NodeTypeResolver\NodeVisitor\FunctionMethodAndClassNodeVisitor;
|
||||
use Rector\Testing\PHPUnit\AbstractNodeVisitorTestCase;
|
||||
|
||||
final class FunctionMethodAndClassNodeVisitorTest extends AbstractNodeVisitorTestCase
|
||||
{
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace Rector\NodeTypeResolver\Tests\PerNodeTypeResolver;
|
|||
use PhpParser\Node;
|
||||
use Rector\Core\HttpKernel\RectorKernel;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Core\Testing\TestingParser\TestingParser;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
use Rector\Testing\TestingParser\TestingParser;
|
||||
use Symplify\PackageBuilder\Tests\AbstractKernelTestCase;
|
||||
|
||||
abstract class AbstractNodeTypeResolverTest extends AbstractKernelTestCase
|
||||
|
|
|
@ -5,9 +5,9 @@ declare(strict_types=1);
|
|||
namespace Rector\RectorGenerator\FileSystem;
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use Rector\Core\Testing\PHPUnit\StaticPHPUnitEnvironment;
|
||||
use Rector\RectorGenerator\Finder\TemplateFinder;
|
||||
use Rector\RectorGenerator\ValueObject\RectorRecipe;
|
||||
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class TemplateFileSystem
|
||||
|
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Rector\__Package__\Tests\Rector\__Category__\__Name__;
|
||||
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
|
||||
final class __Name__Test extends AbstractRectorTestCase
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Rector\__Package__\Tests\Rector\__Category__\__Name__;
|
||||
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
|
||||
final class __Name__Test extends AbstractRectorTestCase
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Rector\__Package__\Tests\Rector\__Category__\__Name__;
|
||||
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
|
||||
final class __Name__Test extends AbstractRectorTestCase
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Rector\__Package__\Tests\Rector\__Category__\__Name__;
|
||||
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
|
||||
final class __Name__Test extends AbstractRectorTestCase
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Rector\ModeratePackage\Tests\Rector\MethodCall\WhateverRector;
|
||||
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
|
||||
final class WhateverRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Utils\Rector\Tests\Rector\MethodCall\WhateverRector;
|
||||
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
|
||||
final class WhateverRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
|
|
21
packages/testing/config/config.php
Normal file
21
packages/testing/config/config.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->defaults()
|
||||
->public()
|
||||
->autowire()
|
||||
->autoconfigure();
|
||||
|
||||
$services->load('Rector\Testing\\', __DIR__ . '/../src')
|
||||
->exclude([
|
||||
__DIR__ . '/../src/PHPUnit/Runnable/NodeVisitor',
|
||||
__DIR__ . '/../src/ValueObject',
|
||||
__DIR__ . '/../src/PHPUnit',
|
||||
]);
|
||||
};
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\Application;
|
||||
namespace Rector\Testing\Application;
|
||||
|
||||
use Rector\Core\Configuration\ChangeConfiguration;
|
||||
use Rector\Core\Contract\Rector\RectorInterface;
|
||||
use Rector\Core\Testing\PHPUnit\StaticPHPUnitEnvironment;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
|
||||
|
||||
final class EnabledRectorsProvider
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\Contract;
|
||||
namespace Rector\Testing\Contract;
|
||||
|
||||
use PhpParser\Node;
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\Contract;
|
||||
namespace Rector\Testing\Contract;
|
||||
|
||||
interface RectorInterfaceAwareInterface
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\Contract;
|
||||
namespace Rector\Testing\Contract;
|
||||
|
||||
interface RunnableInterface
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\Finder;
|
||||
namespace Rector\Testing\Finder;
|
||||
|
||||
use Nette\Loaders\RobotLoader;
|
||||
use Nette\Utils\Strings;
|
||||
|
@ -19,9 +19,9 @@ final class RectorsFinder
|
|||
* @var string[]
|
||||
*/
|
||||
private const RECTOR_PATHS = [
|
||||
__DIR__ . '/../../../rules',
|
||||
__DIR__ . '/../../../packages',
|
||||
__DIR__ . '/../../../src',
|
||||
__DIR__ . '/../../../../rules',
|
||||
__DIR__ . '/../../../../packages',
|
||||
__DIR__ . '/../../../../src',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -101,7 +101,7 @@ final class RectorsFinder
|
|||
$robotLoader->setTempDirectory(sys_get_temp_dir() . '/_rector_finder');
|
||||
|
||||
$robotLoader->acceptFiles = [$name];
|
||||
$robotLoader->excludeDirectory(__DIR__ . '/../../../packages/rector-generator/tests');
|
||||
$robotLoader->excludeDirectory(__DIR__ . '/../../../../packages/rector-generator/tests');
|
||||
|
||||
$robotLoader->rebuild();
|
||||
|
||||
|
@ -130,6 +130,10 @@ final class RectorsFinder
|
|||
return true;
|
||||
}
|
||||
|
||||
if ($class === 'Utils\Rector\Rector\MethodCall\WhateverRector') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! class_exists($class)) {
|
||||
throw new ShouldNotHappenException($class);
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\Guard;
|
||||
namespace Rector\Testing\Guard;
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use Rector\Core\Exception\Testing\SuperfluousAfterContentFixtureException;
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\Node;
|
||||
namespace Rector\Testing\Node;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\NodeTraverser;
|
||||
use Rector\Core\Testing\NodeVisitor\AttributeCollectingNodeVisitor;
|
||||
use Rector\Testing\NodeVisitor\AttributeCollectingNodeVisitor;
|
||||
|
||||
final class NodeAttributeExtractor
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\NodeVisitor;
|
||||
namespace Rector\Testing\NodeVisitor;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\Expression;
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PHPUnit;
|
||||
namespace Rector\Testing\PHPUnit;
|
||||
|
||||
use Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\ValueObject\InputFilePathWithExpectedFile;
|
||||
use Rector\Core\Application\FileSystem\RemovedAndAddedFilesProcessor;
|
||||
|
@ -16,7 +16,7 @@ use Symplify\SmartFileSystem\SmartFileInfo;
|
|||
|
||||
/**
|
||||
* @deprecated Move to
|
||||
* @see \Rector\Core\Testing\PHPUnit\AbstractRectorTestCase with use of
|
||||
* @see \Rector\Testing\PHPUnit\AbstractRectorTestCase with use of
|
||||
* @see \Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace node class
|
||||
*/
|
||||
abstract class AbstractFileSystemRectorTestCase extends AbstractGenericRectorTestCase
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PHPUnit;
|
||||
namespace Rector\Testing\PHPUnit;
|
||||
|
||||
use Iterator;
|
||||
use PHPStan\Analyser\NodeScopeResolver;
|
||||
|
@ -14,13 +14,13 @@ use Rector\Core\Exception\ShouldNotHappenException;
|
|||
use Rector\Core\HttpKernel\RectorKernel;
|
||||
use Rector\Core\NonPhpFile\NonPhpFileProcessor;
|
||||
use Rector\Core\Stubs\StubLoader;
|
||||
use Rector\Core\Testing\Application\EnabledRectorsProvider;
|
||||
use Rector\Core\Testing\Contract\RectorInterfaceAwareInterface;
|
||||
use Rector\Core\Testing\Finder\RectorsFinder;
|
||||
use Rector\Core\Testing\Guard\FixtureGuard;
|
||||
use Rector\Core\Testing\PhpConfigPrinter\PhpConfigPrinterFactory;
|
||||
use Rector\Naming\Tests\Rector\Class_\RenamePropertyToMatchTypeRector\Source\ContainerInterface;
|
||||
use Rector\Set\RectorSetProvider;
|
||||
use Rector\Testing\Application\EnabledRectorsProvider;
|
||||
use Rector\Testing\Contract\RectorInterfaceAwareInterface;
|
||||
use Rector\Testing\Finder\RectorsFinder;
|
||||
use Rector\Testing\Guard\FixtureGuard;
|
||||
use Rector\Testing\PhpConfigPrinter\PhpConfigPrinterFactory;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PHPUnit;
|
||||
namespace Rector\Testing\PHPUnit;
|
||||
|
||||
use PhpParser\Node;
|
||||
use Rector\Core\HttpKernel\RectorKernel;
|
||||
use Rector\Core\PhpParser\Parser\Parser;
|
||||
use Rector\Core\Testing\Contract\NodeTraversableInterface;
|
||||
use Rector\Core\Testing\Node\NodeAttributeExtractor;
|
||||
use Rector\Testing\Contract\NodeTraversableInterface;
|
||||
use Rector\Testing\Node\NodeAttributeExtractor;
|
||||
use Symplify\PackageBuilder\Tests\AbstractKernelTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
|
@ -2,19 +2,22 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PHPUnit;
|
||||
namespace Rector\Testing\PHPUnit;
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
use Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector;
|
||||
use Rector\Core\Application\FileSystem\RemovedAndAddedFilesProcessor;
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\Contract\Rector\PhpRectorInterface;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\Testing\Contract\RunnableInterface;
|
||||
use Rector\Core\ValueObject\FilePathWithContent;
|
||||
use Rector\Core\ValueObject\StaticNonPhpFileSuffixes;
|
||||
use Rector\Testing\Contract\RunnableInterface;
|
||||
use Symplify\EasyTesting\DataProvider\StaticFixtureUpdater;
|
||||
use Symplify\EasyTesting\StaticFixtureSplitter;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
abstract class AbstractRectorTestCase extends AbstractGenericRectorTestCase
|
||||
{
|
||||
|
@ -56,13 +59,16 @@ abstract class AbstractRectorTestCase extends AbstractGenericRectorTestCase
|
|||
$this->doTestFileMatchesExpectedContent($inputFileInfo, $expectedFileInfo, $fixtureFileInfo);
|
||||
|
||||
$this->originalTempFileInfo = $inputFileInfo;
|
||||
|
||||
// runnable?
|
||||
if (! file_exists($inputFileInfo->getPathname())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! Strings::contains($inputFileInfo->getContents(), RunnableInterface::class)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->assertOriginalAndFixedFileResultEquals($inputFileInfo, $expectedFileInfo);
|
||||
}
|
||||
|
||||
|
@ -101,11 +107,39 @@ abstract class AbstractRectorTestCase extends AbstractGenericRectorTestCase
|
|||
protected function doTestFileIsDeleted(SmartFileInfo $smartFileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($smartFileInfo);
|
||||
|
||||
//$temporaryFilePath = $this->getFixtureTempDirectory() . '/SomeFactoryInterface.php';
|
||||
$this->assertFileMissing($this->originalTempFileInfo->getPathname());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FilePathWithContent[] $expectedFilePathsWithContents
|
||||
*/
|
||||
protected function assertFilesWereAdded(array $expectedFilePathsWithContents): void
|
||||
{
|
||||
Assert::allIsAOf($expectedFilePathsWithContents, FilePathWithContent::class);
|
||||
|
||||
/** @var RemovedAndAddedFilesCollector $removedAndAddedFilesCollector */
|
||||
$removedAndAddedFilesCollector = self::$container->get(RemovedAndAddedFilesCollector::class);
|
||||
|
||||
$addedFilePathsWithContents = $removedAndAddedFilesCollector->getAddedFilePathsWithContents();
|
||||
|
||||
sort($addedFilePathsWithContents);
|
||||
sort($expectedFilePathsWithContents);
|
||||
|
||||
foreach ($addedFilePathsWithContents as $key => $addedFilePathWithContent) {
|
||||
$expectedFilePathWithContent = $expectedFilePathsWithContents[$key];
|
||||
|
||||
$this->assertSame(
|
||||
$expectedFilePathWithContent->getFilePath(),
|
||||
$addedFilePathWithContent->getFilePath()
|
||||
);
|
||||
|
||||
$this->assertSame(
|
||||
$expectedFilePathWithContent->getFileContent(),
|
||||
$addedFilePathWithContent->getFileContent()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function doTestFileMatchesExpectedContent(
|
||||
SmartFileInfo $originalFileInfo,
|
||||
SmartFileInfo $expectedFileInfo,
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PHPUnit\Runnable;
|
||||
namespace Rector\Testing\PHPUnit\Runnable;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\NodeTraverser;
|
||||
use PhpParser\Parser;
|
||||
use PhpParser\ParserFactory;
|
||||
use PhpParser\PrettyPrinter\Standard;
|
||||
use Rector\Core\Testing\PHPUnit\Runnable\NodeVisitor\ClassLikeNameCollectingNodeVisitor;
|
||||
use Rector\Core\Testing\PHPUnit\Runnable\NodeVisitor\PrefixingClassLikeNamesNodeVisitor;
|
||||
use Rector\Testing\PHPUnit\Runnable\NodeVisitor\ClassLikeNameCollectingNodeVisitor;
|
||||
use Rector\Testing\PHPUnit\Runnable\NodeVisitor\PrefixingClassLikeNamesNodeVisitor;
|
||||
|
||||
final class ClassLikeNamesSuffixer
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PHPUnit\Runnable\NodeVisitor;
|
||||
namespace Rector\Testing\PHPUnit\Runnable\NodeVisitor;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PHPUnit\Runnable\NodeVisitor;
|
||||
namespace Rector\Testing\PHPUnit\Runnable\NodeVisitor;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\New_;
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PHPUnit\Runnable;
|
||||
namespace Rector\Testing\PHPUnit\Runnable;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
|
@ -12,7 +12,7 @@ use PhpParser\NodeVisitor\NameResolver;
|
|||
use PhpParser\Parser;
|
||||
use PhpParser\ParserFactory;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\Testing\Contract\RunnableInterface;
|
||||
use Rector\Testing\Contract\RunnableInterface;
|
||||
|
||||
final class RunnableClassFinder
|
||||
{
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PHPUnit;
|
||||
namespace Rector\Testing\PHPUnit;
|
||||
|
||||
use Nette\Utils\Random;
|
||||
use Nette\Utils\Strings;
|
||||
use Rector\Core\Testing\Contract\RunnableInterface;
|
||||
use Rector\Core\Testing\PHPUnit\Runnable\ClassLikeNamesSuffixer;
|
||||
use Rector\Core\Testing\PHPUnit\Runnable\RunnableClassFinder;
|
||||
use Rector\Testing\Contract\RunnableInterface;
|
||||
use Rector\Testing\PHPUnit\Runnable\ClassLikeNamesSuffixer;
|
||||
use Rector\Testing\PHPUnit\Runnable\RunnableClassFinder;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
use Symplify\SmartFileSystem\SmartFileSystem;
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PHPUnit;
|
||||
namespace Rector\Testing\PHPUnit;
|
||||
|
||||
final class StaticPHPUnitEnvironment
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PhpConfigPrinter;
|
||||
namespace Rector\Testing\PhpConfigPrinter;
|
||||
|
||||
use Migrify\PhpConfigPrinter\HttpKernel\PhpConfigPrinterKernel;
|
||||
use Migrify\PhpConfigPrinter\Printer\SmartPhpConfigPrinter;
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PhpConfigPrinter;
|
||||
namespace Rector\Testing\PhpConfigPrinter;
|
||||
|
||||
use Migrify\PhpConfigPrinter\Contract\SymfonyVersionFeatureGuardInterface;
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\PhpConfigPrinter;
|
||||
namespace Rector\Testing\PhpConfigPrinter;
|
||||
|
||||
use Migrify\PhpConfigPrinter\Contract\YamlFileContentProviderInterface;
|
||||
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
use Migrify\PhpConfigPrinter\Contract\SymfonyVersionFeatureGuardInterface;
|
||||
use Migrify\PhpConfigPrinter\Contract\YamlFileContentProviderInterface;
|
||||
use Rector\Core\Testing\PhpConfigPrinter\SymfonyVersionFeatureGuard;
|
||||
use Rector\Core\Testing\PhpConfigPrinter\YamlFileContentProvider;
|
||||
use Rector\Testing\PhpConfigPrinter\SymfonyVersionFeatureGuard;
|
||||
use Rector\Testing\PhpConfigPrinter\YamlFileContentProvider;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Core\Testing\TestingParser;
|
||||
namespace Rector\Testing\TestingParser;
|
||||
|
||||
use PhpParser\Node;
|
||||
use Rector\Core\Configuration\Option;
|
18
phpstan.neon
18
phpstan.neon
|
@ -129,6 +129,7 @@ parameters:
|
|||
# broken in PHPStan https://github.com/rectorphp/rector/runs/1305002460#step:5:56
|
||||
- packages/better-php-doc-parser/src/ValueObject/PhpDocNode/AbstractTagValueNode.php
|
||||
- packages/file-system-rector/src/Rector/AbstractFileSystemRector.php
|
||||
- packages/testing/src/PHPUnit/*.php
|
||||
|
||||
# phsptan bug
|
||||
- utils/phpstan-extensions/src/Rule/PreventParentMethodVisibilityOverrideRule.php
|
||||
|
@ -511,8 +512,8 @@ parameters:
|
|||
- rules/naming/src/Guard/PropertyConflictingNameGuard/AbstractPropertyConflictingNameGuard.php # 21
|
||||
- rules/naming/src/PropertyRenamer/AbstractPropertyRenamer.php # 36
|
||||
- rules/downgrade-php71/src/Rector/FunctionLike/AbstractMaybeAddDocBlockRector.php # 20
|
||||
- src/Testing/PHPUnit/AbstractGenericRectorTestCase.php # 68
|
||||
- src/Testing/PHPUnit/AbstractRectorTestCase.php # 24
|
||||
- packages/testing/src/PHPUnit/AbstractGenericRectorTestCase.php # 68
|
||||
- packages/testing/src/PHPUnit/AbstractRectorTestCase.php # 24
|
||||
|
||||
- '#Method call in if or elseif is not allowed#'
|
||||
- '#Method or Static call in foreach is not allowed#'
|
||||
|
@ -523,7 +524,7 @@ parameters:
|
|||
# 3rd party code
|
||||
- packages/doctrine-annotation-generated/src/DataCollector/ResolvedConstantStaticCollector.php
|
||||
# on purpose
|
||||
- src/Testing/PHPUnit/AbstractGenericRectorTestCase.php # 251
|
||||
- packages/testing/src/PHPUnit/AbstractGenericRectorTestCase.php # 251
|
||||
|
||||
-
|
||||
message: '#Do not use factory/method call in constructor, put factory in config and get service with dependency injection#'
|
||||
|
@ -592,7 +593,7 @@ parameters:
|
|||
- src/Configuration/Configuration.php # 228
|
||||
- src/Configuration/CurrentNodeProvider.php # 16
|
||||
- src/HttpKernel/RectorKernel.php # 71
|
||||
- src/Testing/NodeVisitor/AttributeCollectingNodeVisitor.php # 24
|
||||
- packages/testing/src/NodeVisitor/AttributeCollectingNodeVisitor.php # 24
|
||||
|
||||
- '#Parameter \#1 \$node of method Rector\\DeadCode\\Rector\\Plus\\RemoveDeadZeroAndOneOperationRector\:\:refactor\(\) expects PhpParser\\Node\\Expr\\AssignOp\\Div\|PhpParser\\Node\\Expr\\AssignOp\\Minus\|PhpParser\\Node\\Expr\\AssignOp\\Mul\|PhpParser\\Node\\Expr\\AssignOp\\Plus\|PhpParser\\Node\\Expr\\BinaryOp\\Div\|PhpParser\\Node\\Expr\\BinaryOp\\Minus\|PhpParser\\Node\\Expr\\BinaryOp\\Mul\|PhpParser\\Node\\Expr\\BinaryOp\\Plus, PhpParser\\Node\\Expr\\AssignOp\|PhpParser\\Node\\Expr\\BinaryOp given#'
|
||||
|
||||
|
@ -661,8 +662,8 @@ parameters:
|
|||
- src/RectorDefinition/ConfiguredCodeSample.php # 41
|
||||
- src/RectorDefinition/ConfiguredCodeSample.php # 43
|
||||
- src/RectorDefinition/RectorDefinition.php # 31
|
||||
- src/Testing/PHPUnit/Runnable/NodeVisitor/PrefixingClassLikeNamesNodeVisitor.php # 35
|
||||
- src/Testing/PHPUnit/Runnable/NodeVisitor/PrefixingClassLikeNamesNodeVisitor.php # 36
|
||||
- packages/testing/src/PHPUnit/Runnable/NodeVisitor/PrefixingClassLikeNamesNodeVisitor.php # 35
|
||||
- packages/testing/src/PHPUnit/Runnable/NodeVisitor/PrefixingClassLikeNamesNodeVisitor.php # 36
|
||||
|
||||
-
|
||||
message: '#Use local named constant instead of inline string for regex to explain meaning by constant name#'
|
||||
|
@ -683,3 +684,8 @@ parameters:
|
|||
- '#Parameter \#1 \$nodes of method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findFirst\(\) expects array<PhpParser\\Node\>\|PhpParser\\Node, array<PhpParser\\Node\\Stmt\>\|null given#'
|
||||
# finder type
|
||||
- '#Method Rector\\SOLID\\Rector\\Assign\\MoveVariableDeclarationNearReferenceRector\:\:findFirstVariableUsageInScope\(\) should return PhpParser\\Node\\Expr\\Variable\|null but returns PhpParser\\Node\|null#'
|
||||
|
||||
- '#Class with base "NodeNameResolver" name is already used in "Symplify\\CodingStandard\\PhpParser\\NodeNameResolver", "Rector\\NodeNameResolver\\NodeNameResolver"\. Use unique name to make classes easy to recognize#'
|
||||
- '#Static property Rector\\Testing\\PHPUnit\\AbstractGenericRectorTestCase\:\:\$allRectorContainer \(Rector\\Naming\\Tests\\Rector\\Class_\\RenamePropertyToMatchTypeRector\\Source\\ContainerInterface\|Symfony\\Component\\DependencyInjection\\Container\|null\) does not accept Psr\\Container\\ContainerInterface#'
|
||||
|
||||
- '#Class with base "Application" name is already used in "(.*?)\\Symfony\\Component\\Console\\Application", "Symfony\\Component\\Console\\Application", "Rector\\Core\\Console\\Application"\. Use unique name to make classes easy to recognize#'
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveEntitiesToEntityDirec
|
|||
|
||||
use Iterator;
|
||||
use Rector\Autodiscovery\Rector\FileSystem\MoveEntitiesToEntityDirectoryRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractFileSystemRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractFileSystemRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class MoveEntitiesToEntityDirectoryRectorTest extends AbstractFileSystemRectorTestCase
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractN
|
|||
use Iterator;
|
||||
use Rector\Autodiscovery\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector;
|
||||
use Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\ValueObject\InputFilePathWithExpectedFile;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractFileSystemRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractFileSystemRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class MoveInterfacesToContractNamespaceDirectoryRectorTest extends AbstractFileSystemRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveServicesBySuffixToDir
|
|||
|
||||
use Iterator;
|
||||
use Rector\Autodiscovery\Rector\FileSystem\MoveServicesBySuffixToDirectoryRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractFileSystemRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractFileSystemRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class MoveServicesBySuffixToDirectoryRectorTest extends AbstractFileSystemRectorTestCase
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveServicesBySuffixToDir
|
|||
use Iterator;
|
||||
use Rector\Autodiscovery\Rector\FileSystem\MoveServicesBySuffixToDirectoryRector;
|
||||
use Rector\Autodiscovery\Tests\Rector\FileSystem\MoveInterfacesToContractNamespaceDirectoryRector\ValueObject\InputFilePathWithExpectedFile;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractFileSystemRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractFileSystemRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class MutualRenameTest extends AbstractFileSystemRectorTestCase
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Rector\Autodiscovery\Tests\Rector\FileSystem\MoveValueObjectsToValueOb
|
|||
use Iterator;
|
||||
use Rector\Autodiscovery\Rector\FileSystem\MoveValueObjectsToValueObjectDirectoryRector;
|
||||
use Rector\Autodiscovery\Tests\Rector\FileSystem\MoveValueObjectsToValueObjectDirectoryRector\Source\ObviousValueObjectInterface;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractFileSystemRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractFileSystemRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class MoveValueObjectsToValueObjectDirectoryRectorTest extends AbstractFileSystemRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CakePHP\Tests\Rector\FileWithoutNamespace\ImplicitShortClassNam
|
|||
|
||||
use Iterator;
|
||||
use Rector\CakePHP\Rector\FileWithoutNamespace\ImplicitShortClassNameUseStatementRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ImplicitShortClassNameUseStatementRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -10,7 +10,7 @@ use Rector\CakePHP\Tests\Rector\MethodCall\ArrayToFluentCallRector\Source\Config
|
|||
use Rector\CakePHP\Tests\Rector\MethodCall\ArrayToFluentCallRector\Source\FactoryClass;
|
||||
use Rector\CakePHP\ValueObject\ArrayToFluentCall;
|
||||
use Rector\CakePHP\ValueObject\FactoryMethod;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ArrayToFluentCallRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -8,7 +8,7 @@ use Iterator;
|
|||
use Rector\CakePHP\Rector\MethodCall\ModalToGetSetRector;
|
||||
use Rector\CakePHP\Tests\Rector\MethodCall\ModalToGetSetRector\Source\SomeModelType;
|
||||
use Rector\CakePHP\ValueObject\ModalToGetSet;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ModalToGetSetRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -8,7 +8,7 @@ use Iterator;
|
|||
use Rector\CakePHP\Rector\MethodCall\RenameMethodCallBasedOnParameterRector;
|
||||
use Rector\CakePHP\Tests\Rector\MethodCall\RenameMethodCallBasedOnParameterRector\Source\SomeModelType;
|
||||
use Rector\CakePHP\ValueObject\RenameMethodCallBasedOnParameter;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class RenameMethodCallBasedOnParameterRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CakePHP\Tests\Rector\Namespace_\AppUsesStaticCallToUseStatement
|
|||
|
||||
use Iterator;
|
||||
use Rector\CakePHP\Rector\Namespace_\AppUsesStaticCallToUseStatementRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class AppUsesStaticCallToUseStatementRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CakePHP\Tests\Rector\Property\ChangeSnakedFixtureNameToPascal;
|
|||
|
||||
use Iterator;
|
||||
use Rector\CakePHP\Rector\Property\ChangeSnakedFixtureNameToPascalRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ChangeSnakedFixtureNameToPascalTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Array_\ArrayThisCallToThisMethodCallRe
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Array_\ArrayThisCallToThisMethodCallRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ArrayThisCallToThisMethodCallRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Array_\CallableThisArrayToAnonymousFun
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class CallableThisArrayToAnonymousFunctionRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Assign\CombinedAssignRector;
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Assign\CombinedAssignRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Assign\SplitListAssignToSeparateLineRe
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Assign\SplitListAssignToSeparateLineRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class SplitListAssignToSeparateLineRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\BooleanAnd\SimplifyEmptyArrayCheckRect
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class SimplifyEmptyArrayCheckRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\BooleanNot\SimplifyDeMorganBinaryRecto
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\BooleanNot\SimplifyDeMorganBinaryRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class SimplifyDeMorganBinaryRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Catch_\ThrowWithPreviousExceptionRecto
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Catch_\ThrowWithPreviousExceptionRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ThrowWithPreviousExceptionRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,8 +6,8 @@ namespace Rector\CodeQuality\Tests\Rector\Class_\CompleteDynamicPropertiesRector
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class CompleteDynamicPropertiesRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,8 +6,8 @@ namespace Rector\CodeQuality\Tests\Rector\Class_\CompleteDynamicPropertiesRector
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class TypedPropertyCompleteDynamicPropertiesRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Class_\CompleteDynamicPropertiesRector
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class UnionTypeCompleteDynamicPropertiesRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Concat\JoinStringConcatRector;
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Concat\JoinStringConcatRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class JoinStringConcatRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Equal\UseIdenticalOverEqualWithSameTyp
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Equal\UseIdenticalOverEqualWithSameTypeRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class UseIdenticalOverEqualWithSameTypeRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Expression\InlineIfToExplicitIfRector;
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class InlineIfToExplicitIfRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\For_\ForRepeatedCountToOwnVariableRect
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ForRepeatedCountToOwnVariableRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\For_\ForToForeachRector;
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\For_\ForToForeachRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ForToForeachRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Foreach_\ForeachItemsAssignToEmptyArra
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ForeachItemsAssignToEmptyArrayToAssignRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Foreach_\ForeachToInArrayRector;
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Foreach_\ForeachToInArrayRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ForeachToInArrayRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Foreach_\SimplifyForeachToArrayFilterR
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToArrayFilterRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class SimplifyForeachToArrayFilterRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Foreach_\SimplifyForeachToCoalescingRe
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToCoalescingRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class SimplifyForeachToCoalescingRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\Foreach_\UnusedForeachValueToArrayKeys
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class UnusedForeachValueToArrayKeysRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\FuncCall\AddPregQuoteDelimiterRector;
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\FuncCall\AddPregQuoteDelimiterRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class AddPregQuoteDelimiterRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\FuncCall\ArrayKeysAndInArrayToArrayKey
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\FuncCall\ArrayKeysAndInArrayToArrayKeyExistsRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ArrayKeysAndInArrayToArrayKeyExistsRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Rector\CodeQuality\Tests\Rector\FuncCall\ArrayKeysAndInArrayToArrayKeyExistsRector\Fixture;
|
||||
|
||||
use Rector\Core\Testing\Contract\RunnableInterface;
|
||||
use Rector\Testing\Contract\RunnableInterface;
|
||||
|
||||
class SomeClass implements RunnableInterface
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ class SomeClass implements RunnableInterface
|
|||
|
||||
namespace Rector\CodeQuality\Tests\Rector\FuncCall\ArrayKeysAndInArrayToArrayKeyExistsRector\Fixture;
|
||||
|
||||
use Rector\Core\Testing\Contract\RunnableInterface;
|
||||
use Rector\Testing\Contract\RunnableInterface;
|
||||
|
||||
class SomeClass implements RunnableInterface
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\FuncCall\ArrayMergeOfNonArraysToSimple
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\FuncCall\ArrayMergeOfNonArraysToSimpleArrayRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ArrayMergeOfNonArraysToSimpleArrayRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\FuncCall\ChangeArrayPushToArrayAssignR
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ChangeArrayPushToArrayAssignRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\FuncCall\CompactToVariablesRector;
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class CompactToVariablesRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\FuncCall\InArrayAndArrayKeysToArrayKey
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\FuncCall\InArrayAndArrayKeysToArrayKeyExistsRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class InArrayAndArrayKeysToArrayKeyExistsRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\FuncCall\IntvalToTypeCastRector;
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class IntvalToTypeCastRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\FuncCall\IsAWithStringWithThirdArgumen
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\FuncCall\IsAWithStringWithThirdArgumentRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class IsAWithStringWithThirdArgumentRectorTest extends AbstractRectorTestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Tests\Rector\FuncCall\RemoveSoleValueSprintfRector;
|
|||
|
||||
use Iterator;
|
||||
use Rector\CodeQuality\Rector\FuncCall\RemoveSoleValueSprintfRector;
|
||||
use Rector\Core\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class RemoveSoleValueSprintfRectorTest extends AbstractRectorTestCase
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user