mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 05:18:18 +01:00
[Symfony] Decouple to own package (#5900)
This commit is contained in:
parent
ef8bee1d17
commit
8304d70f67
4
.github/workflows/build_scoped_rector.yaml
vendored
4
.github/workflows/build_scoped_rector.yaml
vendored
@ -8,6 +8,10 @@ on:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
|
||||
COMPOSER_ROOT_VERSION: "dev-main"
|
||||
|
||||
jobs:
|
||||
build_scoped_rector:
|
||||
runs-on: ubuntu-latest
|
||||
|
6
.github/workflows/code_analysis.yaml
vendored
6
.github/workflows/code_analysis.yaml
vendored
@ -3,6 +3,10 @@ name: Code Analysis
|
||||
on:
|
||||
pull_request: null
|
||||
|
||||
env:
|
||||
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
|
||||
COMPOSER_ROOT_VERSION: "dev-main"
|
||||
|
||||
jobs:
|
||||
code_analysis:
|
||||
strategy:
|
||||
@ -11,7 +15,7 @@ jobs:
|
||||
actions:
|
||||
-
|
||||
name: 'Composer Validate'
|
||||
run: composer validate --strict
|
||||
run: composer validate --strict --ansi
|
||||
|
||||
# make sure skipped files have "skip_" prefix
|
||||
-
|
||||
|
4
.github/workflows/code_analysis_no_dev.yaml
vendored
4
.github/workflows/code_analysis_no_dev.yaml
vendored
@ -3,6 +3,10 @@ name: Code Analysis [no dev]
|
||||
on:
|
||||
pull_request: null
|
||||
|
||||
env:
|
||||
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
|
||||
COMPOSER_ROOT_VERSION: "dev-main"
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
strategy:
|
||||
|
4
.github/workflows/php_linter.yaml
vendored
4
.github/workflows/php_linter.yaml
vendored
@ -3,6 +3,10 @@ name: PHP Linter
|
||||
on:
|
||||
pull_request: null
|
||||
|
||||
env:
|
||||
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
|
||||
COMPOSER_ROOT_VERSION: "dev-main"
|
||||
|
||||
jobs:
|
||||
php_linter:
|
||||
runs-on: ubuntu-latest
|
||||
|
4
.github/workflows/publish_docker_images.yaml
vendored
4
.github/workflows/publish_docker_images.yaml
vendored
@ -9,6 +9,10 @@ on:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
|
||||
COMPOSER_ROOT_VERSION: "dev-main"
|
||||
|
||||
jobs:
|
||||
publish_images:
|
||||
runs-on: ubuntu-20.04
|
||||
|
6
.github/workflows/rector.yaml
vendored
6
.github/workflows/rector.yaml
vendored
@ -15,6 +15,10 @@ name: Rector
|
||||
on:
|
||||
pull_request: null
|
||||
|
||||
env:
|
||||
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
|
||||
COMPOSER_ROOT_VERSION: "dev-main"
|
||||
|
||||
jobs:
|
||||
rector:
|
||||
strategy:
|
||||
@ -31,7 +35,7 @@ jobs:
|
||||
- rules/DependencyInjection rules/Doctrine rules/DoctrineCodeQuality rules/DoctrineGedmoToKnplabs rules/DowngradePhp70 rules/DowngradePhp71 rules/DowngradePhp72 rules/DowngradePhp73 rules/DowngradePhp74 rules/DowngradePhp80
|
||||
- rules/EarlyReturn rules/Generics rules/Laravel rules/MockeryToProphecy rules/MysqlToMysqli rules/Naming rules/Nette rules/NetteCodeQuality rules/NetteKdyby rules/NetteTesterToPHPUnit rules/NetteToSymfony rules/Order
|
||||
- rules/Php52 rules/Php53 rules/Php54 rules/Php55 rules/Php56 rules/Php70 rules/Php71 rules/Php72 rules/Php73 rules/Php74 rules/Php80 rules/PHPOffice rules/PhpSpecToPHPUnit rules/PHPUnit
|
||||
- rules/Privatization rules/PSR4 rules/Removing rules/RemovingStatic rules/Renaming rules/Restoration rules/Symfony rules/Symfony2 rules/Symfony3 rules/Symfony4 rules/Symfony5 rules/Transform rules/TypeDeclaration rules/Visibility
|
||||
- rules/Privatization rules/PSR4 rules/Removing rules/RemovingStatic rules/Renaming rules/Restoration rules/Transform rules/TypeDeclaration rules/Visibility
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
4
.github/workflows/tests.yaml
vendored
4
.github/workflows/tests.yaml
vendored
@ -3,6 +3,10 @@ name: Tests
|
||||
on:
|
||||
pull_request: null
|
||||
|
||||
env:
|
||||
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
|
||||
COMPOSER_ROOT_VERSION: "dev-main"
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
|
4
.github/workflows/weekly_pull_requests.yaml
vendored
4
.github/workflows/weekly_pull_requests.yaml
vendored
@ -5,6 +5,10 @@ on:
|
||||
# https://crontab.guru/once-a-week
|
||||
- cron: "0 0 * * 0"
|
||||
|
||||
env:
|
||||
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
|
||||
COMPOSER_ROOT_VERSION: "dev-main"
|
||||
|
||||
jobs:
|
||||
weekly_pull_requests:
|
||||
strategy:
|
||||
|
@ -38,9 +38,10 @@
|
||||
"nette/robot-loader": "^3.4",
|
||||
"nette/utils": "^3.2",
|
||||
"nikic/php-parser": "^4.10.4",
|
||||
"phpstan/phpdoc-parser": "^0.4.12",
|
||||
"phpstan/phpdoc-parser": "0.4.12",
|
||||
"phpstan/phpstan": "^0.12.81",
|
||||
"phpstan/phpstan-phpunit": "^0.12.18",
|
||||
"rector/rector-symfony": "dev-main",
|
||||
"sebastian/diff": "^4.0.4",
|
||||
"symfony/console": "^4.4.8|^5.1",
|
||||
"symfony/dependency-injection": "^5.1",
|
||||
@ -69,8 +70,6 @@
|
||||
"phpstan/phpstan-nette": "^0.12.16",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"rector/rector-generator": "^0.1.1",
|
||||
"symfony/security-core": "^5.2",
|
||||
"symfony/security-http": "^5.2",
|
||||
"symplify/coding-standard": "^9.2.11",
|
||||
"symplify/easy-ci": "^9.2.11",
|
||||
"symplify/easy-coding-standard": "^9.2.11",
|
||||
@ -80,7 +79,8 @@
|
||||
"tracy/tracy": "^2.8"
|
||||
},
|
||||
"replace": {
|
||||
"rector/rector-prefixed": "self.version"
|
||||
"rector/rector-prefixed": "self.version",
|
||||
"rector/rector": "self.version"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@ -106,11 +106,9 @@
|
||||
"rules-tests/CakePHP/Rector/Namespace_/AppUsesStaticCallToUseStatementRector/Source",
|
||||
"rules-tests/CodingStyle/Rector/Namespace_/ImportFullyQualifiedNamesRector/Source",
|
||||
"rules-tests/Renaming/Rector/Name/RenameClassRector/Source",
|
||||
"rules-tests/Renaming/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector/Source",
|
||||
"rules-tests/Symfony4/Rector/MethodCall/ContainerGetToConstructorInjectionRector/Source"
|
||||
"rules-tests/Renaming/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector/Source"
|
||||
],
|
||||
"files": [
|
||||
"stubs/Symfony/Component/Form/FormTypeInterface.php",
|
||||
"stubs/Doctrine/Persistence/ObjectManager.php",
|
||||
"stubs/Doctrine/Common/Persistence/ObjectManager.php",
|
||||
"vendor/nette/forms/src/Forms/Controls/SubmitButton.php",
|
||||
|
@ -10,6 +10,8 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->import(__DIR__ . '/services-packages.php');
|
||||
$containerConfigurator->import(__DIR__ . '/parameters.php');
|
||||
|
||||
$containerConfigurator->import(__DIR__ . '/../vendor/rector/rector-symfony/config/config.php');
|
||||
|
||||
// require only in dev
|
||||
$containerConfigurator->import(__DIR__ . '/../utils/compiler/config/config.php', null, 'not_found');
|
||||
};
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Symfony\Rector\Attribute\ExtractAttributeRouteNameConstantsRector;
|
||||
use Rector\Symfony\Rector\BinaryOp\ResponseStatusCodeRector;
|
||||
use Rector\Symfony\Rector\Class_\EventListenerToEventSubscriberRector;
|
||||
use Rector\Symfony\Rector\Class_\MakeCommandLazyRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(ResponseStatusCodeRector::class);
|
||||
$services->set(MakeCommandLazyRector::class);
|
||||
$services->set(EventListenerToEventSubscriberRector::class);
|
||||
$services->set(ExtractAttributeRouteNameConstantsRector::class);
|
||||
};
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Symfony\Rector\MethodCall\GetParameterToConstructorInjectionRector;
|
||||
use Rector\Symfony\Rector\MethodCall\GetToConstructorInjectionRector;
|
||||
use Rector\Symfony4\Rector\MethodCall\ContainerGetToConstructorInjectionRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ContainerGetToConstructorInjectionRector::class);
|
||||
|
||||
$services->set(GetParameterToConstructorInjectionRector::class);
|
||||
|
||||
$services->set(GetToConstructorInjectionRector::class);
|
||||
};
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Symfony2\Rector\MethodCall\AddFlashRector;
|
||||
use Rector\Symfony2\Rector\MethodCall\RedirectToRouteRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(RedirectToRouteRector::class);
|
||||
|
||||
$services->set(AddFlashRector::class);
|
||||
};
|
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Arguments\Rector\ClassMethod\ArgumentDefaultValueReplacerRector;
|
||||
use Rector\Arguments\ValueObject\ArgumentDefaultValueReplacer;
|
||||
use Rector\Symfony2\Rector\StaticCall\ParseFileRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ParseFileRector::class);
|
||||
|
||||
$services->set(ArgumentDefaultValueReplacerRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentDefaultValueReplacerRector::REPLACED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
// https://github.com/symfony/symfony/commit/912fc4de8fd6de1e5397be4a94d39091423e5188
|
||||
new ArgumentDefaultValueReplacer(
|
||||
'Symfony\Component\Routing\Generator\UrlGeneratorInterface',
|
||||
'generate',
|
||||
2,
|
||||
true,
|
||||
'Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL'
|
||||
),
|
||||
new ArgumentDefaultValueReplacer(
|
||||
'Symfony\Component\Routing\Generator\UrlGeneratorInterface',
|
||||
'generate',
|
||||
2,
|
||||
false,
|
||||
'Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_PATH'
|
||||
),
|
||||
new ArgumentDefaultValueReplacer(
|
||||
'Symfony\Component\Routing\Generator\UrlGeneratorInterface',
|
||||
'generate',
|
||||
2,
|
||||
'relative',
|
||||
'Symfony\Component\Routing\Generator\UrlGeneratorInterface::RELATIVE_PATH'
|
||||
),
|
||||
new ArgumentDefaultValueReplacer(
|
||||
'Symfony\Component\Routing\Generator\UrlGeneratorInterface',
|
||||
'generate',
|
||||
2,
|
||||
'network',
|
||||
'Symfony\Component\Routing\Generator\UrlGeneratorInterface::NETWORK_PATH'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
};
|
@ -1,236 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Renaming\ValueObject\RenameClassConstFetch;
|
||||
use Rector\Symfony3\Rector\ClassMethod\FormTypeGetParentRector;
|
||||
use Rector\Symfony3\Rector\ClassMethod\GetRequestRector;
|
||||
use Rector\Symfony3\Rector\ClassMethod\RemoveDefaultGetBlockPrefixRector;
|
||||
use Rector\Symfony3\Rector\MethodCall\CascadeValidationFormBuilderRector;
|
||||
use Rector\Symfony3\Rector\MethodCall\ChangeCollectionTypeOptionNameFromTypeToEntryTypeRector;
|
||||
use Rector\Symfony3\Rector\MethodCall\ChangeStringCollectionOptionToConstantRector;
|
||||
use Rector\Symfony3\Rector\MethodCall\FormTypeInstanceToClassConstRector;
|
||||
use Rector\Symfony3\Rector\MethodCall\OptionNameRector;
|
||||
use Rector\Symfony3\Rector\MethodCall\ReadOnlyOptionToAttributeRector;
|
||||
use Rector\Symfony3\Rector\MethodCall\StringFormTypeToClassRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
# resources:
|
||||
# - https://github.com/symfony/symfony/blob/3.4/UPGRADE-3.0.md
|
||||
# php
|
||||
$services->set(GetRequestRector::class);
|
||||
$services->set(FormTypeGetParentRector::class);
|
||||
$services->set(OptionNameRector::class);
|
||||
$services->set(ReadOnlyOptionToAttributeRector::class);
|
||||
|
||||
# forms
|
||||
$services->set(FormTypeInstanceToClassConstRector::class);
|
||||
$services->set(StringFormTypeToClassRector::class);
|
||||
$services->set(CascadeValidationFormBuilderRector::class);
|
||||
$services->set(RemoveDefaultGetBlockPrefixRector::class);
|
||||
|
||||
# forms - collection
|
||||
$services->set(ChangeStringCollectionOptionToConstantRector::class);
|
||||
$services->set(ChangeCollectionTypeOptionNameFromTypeToEntryTypeRector::class);
|
||||
|
||||
$services->set(RenameClassConstFetchRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassConstFetchRector::CLASS_CONSTANT_RENAME => ValueObjectInliner::inline([
|
||||
new RenameClassConstFetch('Symfony\Component\Form\FormEvents', 'PRE_BIND', 'PRE_SUBMIT'),
|
||||
new RenameClassConstFetch('Symfony\Component\Form\FormEvents', 'BIND', 'SUBMIT'),
|
||||
new RenameClassConstFetch('Symfony\Component\Form\FormEvents', 'POST_BIND', 'POST_SUBMIT'),
|
||||
new RenameClassConstFetch(
|
||||
'Symfony\Component\Form\Extension\Core\DataTransformer',
|
||||
'ROUND_HALFEVEN',
|
||||
'ROUND_HALF_EVEN'
|
||||
),
|
||||
new RenameClassConstFetch(
|
||||
'Symfony\Component\Form\Extension\Core\DataTransformer',
|
||||
'ROUND_HALFUP',
|
||||
'ROUND_HALF_UP'
|
||||
),
|
||||
new RenameClassConstFetch(
|
||||
'Symfony\Component\Form\Extension\Core\DataTransformer',
|
||||
'ROUND_HALFDOWN',
|
||||
'ROUND_HALF_DOWN'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\ClassLoader\UniversalClassLoader\UniversalClassLoader',
|
||||
'registerNamespaces',
|
||||
'addPrefixes'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\ClassLoader\UniversalClassLoader\UniversalClassLoader',
|
||||
'registerPrefixes',
|
||||
'addPrefixes'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\ClassLoader\UniversalClassLoader\UniversalClassLoader',
|
||||
'registerNamespace',
|
||||
'addPrefix'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\ClassLoader\UniversalClassLoader\UniversalClassLoader',
|
||||
'registerPrefix',
|
||||
'addPrefix'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\ClassLoader\UniversalClassLoader\UniversalClassLoader',
|
||||
'getNamespaces',
|
||||
'getPrefixes'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\ClassLoader\UniversalClassLoader\UniversalClassLoader',
|
||||
'getNamespaceFallbacks',
|
||||
'getFallbackDirs'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\ClassLoader\UniversalClassLoader\UniversalClassLoader',
|
||||
'getPrefixFallbacks',
|
||||
'getFallbackDirs'
|
||||
),
|
||||
// form
|
||||
new MethodCallRename('Symfony\Component\Form\AbstractType', 'getName', 'getBlockPrefix'),
|
||||
new MethodCallRename('Symfony\Component\Form\AbstractType', 'setDefaultOptions', 'configureOptions'),
|
||||
new MethodCallRename('Symfony\Component\Form\FormTypeInterface', 'getName', 'getBlockPrefix'),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Form\FormTypeInterface',
|
||||
'setDefaultOptions',
|
||||
'configureOptions'
|
||||
),
|
||||
new MethodCallRename('Symfony\Component\Form\ResolvedFormTypeInterface', 'getName', 'getBlockPrefix'),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Form\AbstractTypeExtension',
|
||||
'setDefaultOptions',
|
||||
'configureOptions'
|
||||
),
|
||||
new MethodCallRename('Symfony\Component\Form\Form', 'bind', 'submit'),
|
||||
new MethodCallRename('Symfony\Component\Form\Form', 'isBound', 'isSubmitted'),
|
||||
// process
|
||||
new MethodCallRename('Symfony\Component\Process\Process', 'setStdin', 'setInput'),
|
||||
new MethodCallRename('Symfony\Component\Process\Process', 'getStdin', 'getInput'),
|
||||
// monolog
|
||||
new MethodCallRename('Symfony\Bridge\Monolog\Logger', 'emerg', 'emergency'),
|
||||
new MethodCallRename('Symfony\Bridge\Monolog\Logger', 'crit', 'critical'),
|
||||
new MethodCallRename('Symfony\Bridge\Monolog\Logger', 'err', 'error'),
|
||||
new MethodCallRename('Symfony\Bridge\Monolog\Logger', 'warn', 'warning'),
|
||||
# http kernel
|
||||
new MethodCallRename('Symfony\Component\HttpKernel\Log\LoggerInterface', 'emerg', 'emergency'),
|
||||
new MethodCallRename('Symfony\Component\HttpKernel\Log\LoggerInterface', 'crit', 'critical'),
|
||||
new MethodCallRename('Symfony\Component\HttpKernel\Log\LoggerInterface', 'err', 'error'),
|
||||
new MethodCallRename('Symfony\Component\HttpKernel\Log\LoggerInterface', 'warn', 'warning'),
|
||||
new MethodCallRename('Symfony\Component\HttpKernel\Log\NullLogger', 'emerg', 'emergency'),
|
||||
new MethodCallRename('Symfony\Component\HttpKernel\Log\NullLogger', 'crit', 'critical'),
|
||||
new MethodCallRename('Symfony\Component\HttpKernel\Log\NullLogger', 'err', 'error'),
|
||||
new MethodCallRename('Symfony\Component\HttpKernel\Log\NullLogger', 'warn', 'warning'),
|
||||
// property access
|
||||
new MethodCallRename(
|
||||
'getPropertyAccessor',
|
||||
'Symfony\Component\PropertyAccess\PropertyAccess',
|
||||
'createPropertyAccessor'
|
||||
),
|
||||
// translator
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Translation\Dumper\FileDumper',
|
||||
'format',
|
||||
'formatCatalogue'
|
||||
),
|
||||
new MethodCallRename('Symfony\Component\Translation\Translator', 'getMessages', 'getCatalogue'),
|
||||
// validator
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Validator\ConstraintViolationInterface',
|
||||
'getMessageParameters',
|
||||
'getParameters'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Validator\ConstraintViolationInterface',
|
||||
'getMessagePluralization',
|
||||
'getPlural'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Validator\ConstraintViolation',
|
||||
'getMessageParameters',
|
||||
'getParameters'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Validator\ConstraintViolation',
|
||||
'getMessagePluralization',
|
||||
'getPlural'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
# class loader
|
||||
# partial with method rename
|
||||
'Symfony\Component\ClassLoader\UniversalClassLoader\UniversalClassLoader' => 'Symfony\Component\ClassLoader\ClassLoader',
|
||||
# console
|
||||
'Symfony\Component\Console\Helper\ProgressHelper' => 'Symfony\Component\Console\Helper\ProgressBar',
|
||||
# form
|
||||
'Symfony\Component\Form\Util\VirtualFormAwareIterator' => 'Symfony\Component\Form\Util\InheritDataAwareIterator',
|
||||
'Symfony\Component\Form\Tests\Extension\Core\Type\TypeTestCase' => 'Symfony\Component\Form\Test\TypeTestCase',
|
||||
'Symfony\Component\Form\Tests\FormIntegrationTestCase' => 'Symfony\Component\Form\Test\FormIntegrationTestCase',
|
||||
'Symfony\Component\Form\Tests\FormPerformanceTestCase' => 'Symfony\Component\Form\Test\FormPerformanceTestCase',
|
||||
'Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface' => 'Symfony\Component\Form\ChoiceList\ChoiceListInterface',
|
||||
'Symfony\Component\Form\Extension\Core\View\ChoiceView' => 'Symfony\Component\Form\ChoiceList\View\ChoiceView',
|
||||
'Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface' => 'Symfony\Component\Security\Csrf\CsrfTokenManagerInterface',
|
||||
'Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList' => 'Symfony\Component\Form\ChoiceList\ArrayChoiceList',
|
||||
'Symfony\Component\Form\Extension\Core\ChoiceList\LazyChoiceList' => 'Symfony\Component\Form\ChoiceList\LazyChoiceList',
|
||||
'Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList' => 'Symfony\Component\Form\ChoiceList\ArrayChoiceList',
|
||||
'Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList' => 'Symfony\Component\Form\ChoiceList\ArrayChoiceList',
|
||||
'Symfony\Component\Form\ChoiceList\ArrayKeyChoiceList' => 'Symfony\Component\Form\ChoiceList\ArrayChoiceList',
|
||||
# http kernel
|
||||
'Symfony\Component\HttpKernel\Debug\ErrorHandler' => 'Symfony\Component\Debug\ErrorHandler',
|
||||
'Symfony\Component\HttpKernel\Debug\ExceptionHandler' => 'Symfony\Component\Debug\ExceptionHandler',
|
||||
'Symfony\Component\HttpKernel\Exception\FatalErrorException' => 'Symfony\Component\Debug\Exception\FatalErrorException',
|
||||
'Symfony\Component\HttpKernel\Exception\FlattenException' => 'Symfony\Component\Debug\Exception\FlattenException',
|
||||
# partial with method rename
|
||||
'Symfony\Component\HttpKernel\Log\LoggerInterface' => 'Psr\Log\LoggerInterface',
|
||||
# event disptacher
|
||||
'Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass' => 'Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass',
|
||||
# partial with methor rename
|
||||
'Symfony\Component\HttpKernel\Log\NullLogger' => 'Psr\Log\LoggerInterface',
|
||||
# monolog
|
||||
# partial with method rename
|
||||
'Symfony\Bridge\Monolog\Logger' => 'Psr\Log\LoggerInterface',
|
||||
# security
|
||||
'Symfony\Component\Security\Core\Authorization\Voter\AbstractVoter' => 'Symfony\Component\Security\Core\Authorization\Voter\Voter',
|
||||
# translator
|
||||
# partial with class rename
|
||||
'Symfony\Component\Translation\Translator' => 'Symfony\Component\Translation\TranslatorBagInterface',
|
||||
# twig
|
||||
'Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy' => 'Twig_FileExtensionEscapingStrategy',
|
||||
# validator
|
||||
'Symfony\Component\Validator\Constraints\Collection\Optional' => 'Symfony\Component\Validator\Constraints\Optional',
|
||||
'Symfony\Component\Validator\Constraints\Collection\Required' => 'Symfony\Component\Validator\Constraints\Required',
|
||||
'Symfony\Component\Validator\MetadataInterface' => 'Symfony\Component\Validator\Mapping\MetadataInterface',
|
||||
'Symfony\Component\Validator\PropertyMetadataInterface' => 'Symfony\Component\Validator\Mapping\PropertyMetadataInterface',
|
||||
'Symfony\Component\Validator\PropertyMetadataContainerInterface' => 'Symfony\Component\Validator\Mapping\ClassMetadataInterface',
|
||||
'Symfony\Component\Validator\ClassBasedInterface' => 'Symfony\Component\Validator\Mapping\ClassMetadataInterface',
|
||||
'Symfony\Component\Validator\Mapping\ElementMetadata' => 'Symfony\Component\Validator\Mapping\GenericMetadata',
|
||||
'Symfony\Component\Validator\ExecutionContextInterface' => 'Symfony\Component\Validator\Context\ExecutionContextInterface',
|
||||
'Symfony\Component\Validator\Mapping\ClassMetadataFactory' => 'Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory',
|
||||
'Symfony\Component\Validator\Mapping\MetadataFactoryInterface' => 'Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface',
|
||||
# swift mailer
|
||||
'Symfony\Bridge\Swiftmailer\DataCollector\MessageDataCollector' => 'Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector',
|
||||
],
|
||||
]]);
|
||||
};
|
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Arguments\Rector\ClassMethod\ArgumentDefaultValueReplacerRector;
|
||||
use Rector\Arguments\ValueObject\ArgumentDefaultValueReplacer;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ArgumentDefaultValueReplacerRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentDefaultValueReplacerRector::REPLACED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new ArgumentDefaultValueReplacer('Symfony\Component\Yaml\Yaml', 'parse', 1, [
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
], 'Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP'),
|
||||
new ArgumentDefaultValueReplacer('Symfony\Component\Yaml\Yaml', 'parse', 1, [
|
||||
false,
|
||||
true,
|
||||
], 'Symfony\Component\Yaml\Yaml::PARSE_OBJECT'),
|
||||
new ArgumentDefaultValueReplacer(
|
||||
'Symfony\Component\Yaml\Yaml',
|
||||
'parse',
|
||||
1,
|
||||
true,
|
||||
'Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE'
|
||||
),
|
||||
new ArgumentDefaultValueReplacer('Symfony\Component\Yaml\Yaml', 'parse', 1, false, 0),
|
||||
new ArgumentDefaultValueReplacer(
|
||||
'Symfony\Component\Yaml\Yaml',
|
||||
'dump',
|
||||
3,
|
||||
[false, true],
|
||||
'Symfony\Component\Yaml\Yaml::DUMP_OBJECT'
|
||||
),
|
||||
new ArgumentDefaultValueReplacer(
|
||||
'Symfony\Component\Yaml\Yaml',
|
||||
'dump',
|
||||
3,
|
||||
true,
|
||||
'Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
};
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;
|
||||
use Rector\Arguments\ValueObject\ArgumentAdder;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ArgumentAdderRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentAdderRector::ADDED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new ArgumentAdder(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
'addCompilerPass',
|
||||
2,
|
||||
'priority',
|
||||
'0'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
};
|
@ -1,72 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;
|
||||
use Rector\Arguments\ValueObject\ArgumentAdder;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Symfony3\Rector\ClassConstFetch\ConsoleExceptionToErrorEventConstantRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ArgumentAdderRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentAdderRector::ADDED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new ArgumentAdder(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
'compile',
|
||||
2,
|
||||
'__unknown__',
|
||||
0
|
||||
),
|
||||
new ArgumentAdder(
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder',
|
||||
'addCompilerPass',
|
||||
2,
|
||||
'priority',
|
||||
0
|
||||
),
|
||||
new ArgumentAdder(
|
||||
'Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraph',
|
||||
'connect',
|
||||
6,
|
||||
'weak',
|
||||
false
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(ConsoleExceptionToErrorEventConstantRector::class);
|
||||
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
# console
|
||||
'Symfony\Component\Console\Event\ConsoleExceptionEvent' => 'Symfony\Component\Console\Event\ConsoleErrorEvent',
|
||||
# debug
|
||||
'Symfony\Component\Debug\Exception\ContextErrorException' => 'ErrorException',
|
||||
# dependency-injection
|
||||
'Symfony\Component\DependencyInjection\DefinitionDecorator' => 'Symfony\Component\DependencyInjection\ChildDefinition',
|
||||
# framework bundle
|
||||
'Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass' => 'Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass',
|
||||
'Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass' => 'Symfony\Component\Serializer\DependencyInjection\SerializerPass',
|
||||
'Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass' => 'Symfony\Component\Form\DependencyInjection\FormPass',
|
||||
'Symfony\Bundle\FrameworkBundle\EventListener\SessionListener' => 'Symfony\Component\HttpKernel\EventListener\SessionListener',
|
||||
'Symfony\Bundle\FrameworkBundle\EventListener\TestSessionListenr' => 'Symfony\Component\HttpKernel\EventListener\TestSessionListener',
|
||||
'Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ConfigCachePass' => 'Symfony\Component\Config\DependencyInjection\ConfigCachePass',
|
||||
'Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\PropertyInfoPass' => 'Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass',
|
||||
],
|
||||
]]);
|
||||
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename('Symfony\Component\DependencyInjection\Container', 'isFrozen', 'isCompiled'),
|
||||
]),
|
||||
]]);
|
||||
};
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Removing\Rector\ClassMethod\ArgumentRemoverRector;
|
||||
use Rector\Removing\ValueObject\ArgumentRemover;
|
||||
use Rector\Symfony3\Rector\ClassMethod\MergeMethodAnnotationToRouteAnnotationRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ArgumentRemoverRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentRemoverRector::REMOVED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new ArgumentRemover(
|
||||
'Symfony\Component\Yaml\Yaml',
|
||||
'parse',
|
||||
2,
|
||||
['Symfony\Component\Yaml\Yaml::PARSE_KEYS_AS_STRINGS']
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(MergeMethodAnnotationToRouteAnnotationRector::class);
|
||||
};
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Symfony4\Rector\ConstFetch\ConstraintUrlOptionRector;
|
||||
use Rector\Symfony4\Rector\MethodCall\ContainerBuilderCompileEnvArgumentRector;
|
||||
use Rector\Symfony4\Rector\MethodCall\FormIsValidRector;
|
||||
use Rector\Symfony4\Rector\MethodCall\ProcessBuilderGetProcessRector;
|
||||
use Rector\Symfony4\Rector\MethodCall\VarDumperTestTraitMethodArgsRector;
|
||||
use Rector\Symfony4\Rector\StaticCall\ProcessBuilderInstanceRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ConstraintUrlOptionRector::class);
|
||||
|
||||
$services->set(FormIsValidRector::class);
|
||||
|
||||
$services->set(VarDumperTestTraitMethodArgsRector::class);
|
||||
|
||||
$services->set(ContainerBuilderCompileEnvArgumentRector::class);
|
||||
|
||||
$services->set(ProcessBuilderInstanceRector::class);
|
||||
|
||||
$services->set(ProcessBuilderGetProcessRector::class);
|
||||
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
'Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest' => 'Symfony\Component\Validator\Test\ConstraintValidatorTestCase',
|
||||
'Symfony\Component\Process\ProcessBuilder' => 'Symfony\Component\Process\Process',
|
||||
],
|
||||
]]);
|
||||
};
|
@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Renaming\ValueObject\MethodCallRenameWithArrayKey;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
# https://github.com/symfony/symfony/blob/master/UPGRADE-4.1.md
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
# https://github.com/symfony/symfony/commit/463f986c28a497571967e37c1314e9911f1ef6ba
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Console\Helper\TableStyle',
|
||||
'setHorizontalBorderChar',
|
||||
'setHorizontalBorderChars'
|
||||
),
|
||||
# https://github.com/symfony/symfony/commit/463f986c28a497571967e37c1314e9911f1ef6ba
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Console\Helper\TableStyle',
|
||||
'setVerticalBorderChar',
|
||||
'setVerticalBorderChars'
|
||||
),
|
||||
# https://github.com/symfony/symfony/commit/463f986c28a497571967e37c1314e9911f1ef6ba
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Console\Helper\TableStyle',
|
||||
'setCrossingChar',
|
||||
'setDefaultCrossingChar'
|
||||
),
|
||||
new MethodCallRename('Symfony\Component\HttpFoundation\File\UploadedFile', 'getClientSize', 'getSize'),
|
||||
new MethodCallRename('Symfony\Component\Workflow\DefinitionBuilder', 'reset', 'clear'),
|
||||
new MethodCallRename('Symfony\Component\Workflow\DefinitionBuilder', 'add', 'addWorkflow'),
|
||||
# https://github.com/symfony/symfony/commit/463f986c28a497571967e37c1314e9911f1ef6ba
|
||||
new MethodCallRenameWithArrayKey(
|
||||
'Symfony\Component\Console\Helper\TableStyle',
|
||||
'getVerticalBorderChar',
|
||||
# special case to "getVerticalBorderChar" → "getBorderChars()[3]"
|
||||
'getBorderChars',
|
||||
3
|
||||
),
|
||||
# https://github.com/symfony/symfony/commit/463f986c28a497571967e37c1314e9911f1ef6ba
|
||||
new MethodCallRenameWithArrayKey(
|
||||
'Symfony\Component\Console\Helper\TableStyle',
|
||||
'getHorizontalBorderChar',
|
||||
'getBorderChars',
|
||||
2
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
# https://github.com/symfony/symfony/commit/07dd09db59e2f2a86a291d00d978169d9059e307
|
||||
'Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector' => 'Symfony\Component\HttpKernel\DataCollector\RequestDataCollector',
|
||||
'Symfony\Component\Workflow\SupportStrategy\SupportStrategyInterface' => 'Symfony\Component\Workflow\SupportStrategy\WorkflowSupportStrategyInterface',
|
||||
'Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy' => 'Symfony\Component\Workflow\SupportStrategy\InstanceOfSupportStrategy',
|
||||
],
|
||||
]]);
|
||||
};
|
@ -1,239 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use PHPStan\Type\IterableType;
|
||||
use PHPStan\Type\MixedType;
|
||||
|
||||
use Rector\Arguments\NodeAnalyzer\ArgumentAddingScope;
|
||||
use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;
|
||||
use Rector\Arguments\Rector\ClassMethod\ArgumentDefaultValueReplacerRector;
|
||||
use Rector\Arguments\ValueObject\ArgumentAdder;
|
||||
use Rector\Arguments\ValueObject\ArgumentDefaultValueReplacer;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Core\ValueObject\Visibility;
|
||||
use Rector\Removing\Rector\ClassMethod\ArgumentRemoverRector;
|
||||
use Rector\Removing\ValueObject\ArgumentRemover;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Symfony4\Rector\MethodCall\ContainerGetToConstructorInjectionRector;
|
||||
use Rector\Symfony4\Rector\New_\RootNodeTreeBuilderRector;
|
||||
use Rector\Symfony4\Rector\New_\StringToArrayArgumentProcessRector;
|
||||
use Rector\Transform\Rector\ClassMethod\WrapReturnRector;
|
||||
use Rector\Transform\Rector\New_\NewToStaticCallRector;
|
||||
use Rector\Transform\ValueObject\NewToStaticCall;
|
||||
use Rector\Transform\ValueObject\WrapReturn;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration;
|
||||
use Rector\Visibility\Rector\ClassMethod\ChangeMethodVisibilityRector;
|
||||
use Rector\Visibility\ValueObject\ChangeMethodVisibility;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
# https://github.com/symfony/symfony/pull/28447
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(NewToStaticCallRector::class)
|
||||
->call('configure', [[
|
||||
NewToStaticCallRector::TYPE_TO_STATIC_CALLS => ValueObjectInliner::inline([
|
||||
new NewToStaticCall(
|
||||
'Symfony\Component\HttpFoundation\Cookie',
|
||||
'Symfony\Component\HttpFoundation\Cookie',
|
||||
'create'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
# https://github.com/symfony/symfony/commit/a7e319d9e1316e2e18843f8ce15b67a8693e5bf9
|
||||
'Symfony\Bundle\FrameworkBundle\Controller\Controller' => 'Symfony\Bundle\FrameworkBundle\Controller\AbstractController',
|
||||
# https://github.com/symfony/symfony/commit/744bf0e7ac3ecf240d0bf055cc58f881bb0b3ec0
|
||||
'Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand' => 'Symfony\Component\Console\Command\Command',
|
||||
'Symfony\Component\Translation\TranslatorInterface' => 'Symfony\Contracts\Translation\TranslatorInterface',
|
||||
],
|
||||
]]);
|
||||
|
||||
# related to "Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand" deprecation, see https://github.com/rectorphp/rector/issues/1629
|
||||
$services->set(ContainerGetToConstructorInjectionRector::class);
|
||||
|
||||
# https://symfony.com/blog/new-in-symfony-4-2-important-deprecations
|
||||
$services->set(StringToArrayArgumentProcessRector::class);
|
||||
|
||||
$services->set(RootNodeTreeBuilderRector::class);
|
||||
|
||||
$services->set(ArgumentAdderRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentAdderRector::ADDED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
// https://github.com/symfony/symfony/commit/fa2063efe43109aea093d6fbfc12d675dba82146
|
||||
// https://github.com/symfony/symfony/commit/e3aa90f852f69040be19da3d8729cdf02d238ec7
|
||||
new ArgumentAdder(
|
||||
'Symfony\Component\BrowserKit\Client',
|
||||
'submit',
|
||||
2,
|
||||
'serverParameters',
|
||||
[],
|
||||
null,
|
||||
ArgumentAddingScope::SCOPE_METHOD_CALL
|
||||
),
|
||||
new ArgumentAdder(
|
||||
'Symfony\Component\DomCrawler\Crawler',
|
||||
'children',
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
ArgumentAddingScope::SCOPE_METHOD_CALL
|
||||
),
|
||||
new ArgumentAdder(
|
||||
'Symfony\Component\Finder\Finder',
|
||||
'sortByName',
|
||||
0,
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
ArgumentAddingScope::SCOPE_METHOD_CALL
|
||||
),
|
||||
new ArgumentAdder(
|
||||
'Symfony\Bridge\Monolog\Processor\DebugProcessor',
|
||||
'getLogs',
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
ArgumentAddingScope::SCOPE_METHOD_CALL
|
||||
),
|
||||
new ArgumentAdder(
|
||||
'Symfony\Bridge\Monolog\Processor\DebugProcessor',
|
||||
'countErrors',
|
||||
0,
|
||||
'default_value',
|
||||
null,
|
||||
null,
|
||||
ArgumentAddingScope::SCOPE_METHOD_CALL
|
||||
),
|
||||
new ArgumentAdder(
|
||||
'Symfony\Bridge\Monolog\Logger',
|
||||
'getLogs',
|
||||
0,
|
||||
'default_value',
|
||||
null,
|
||||
null,
|
||||
ArgumentAddingScope::SCOPE_METHOD_CALL
|
||||
),
|
||||
new ArgumentAdder(
|
||||
'Symfony\Bridge\Monolog\Logger',
|
||||
'countErrors',
|
||||
0,
|
||||
'default_value',
|
||||
null,
|
||||
null,
|
||||
ArgumentAddingScope::SCOPE_METHOD_CALL
|
||||
),
|
||||
new ArgumentAdder(
|
||||
'Symfony\Component\Serializer\Normalizer',
|
||||
'handleCircularReference',
|
||||
1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
ArgumentAddingScope::SCOPE_METHOD_CALL
|
||||
),
|
||||
new ArgumentAdder(
|
||||
'Symfony\Component\Serializer\Normalizer',
|
||||
'handleCircularReference',
|
||||
2,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
ArgumentAddingScope::SCOPE_METHOD_CALL
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename('Symfony\Component\Cache\CacheItem', 'getPreviousTags', 'getMetadata'),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Form\AbstractTypeExtension',
|
||||
'getExtendedType',
|
||||
'getExtendedTypes'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$iterableType = new IterableType(new MixedType(), new MixedType());
|
||||
|
||||
$services->set(AddReturnTypeDeclarationRector::class)
|
||||
->call('configure', [[
|
||||
AddReturnTypeDeclarationRector::METHOD_RETURN_TYPES => ValueObjectInliner::inline([
|
||||
new AddReturnTypeDeclaration(
|
||||
'Symfony\Component\Form\AbstractTypeExtension',
|
||||
'getExtendedTypes',
|
||||
$iterableType
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(ChangeMethodVisibilityRector::class)
|
||||
->call('configure', [[
|
||||
ChangeMethodVisibilityRector::METHOD_VISIBILITIES => ValueObjectInliner::inline([
|
||||
new ChangeMethodVisibility(
|
||||
'Symfony\Component\Form\AbstractTypeExtension',
|
||||
'getExtendedTypes',
|
||||
Visibility::STATIC
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(WrapReturnRector::class)
|
||||
->call('configure', [[
|
||||
WrapReturnRector::TYPE_METHOD_WRAPS => ValueObjectInliner::inline([
|
||||
new WrapReturn('Symfony\Component\Form\AbstractTypeExtension', 'getExtendedTypes', true),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(ArgumentDefaultValueReplacerRector::class)
|
||||
->call('configure', [[
|
||||
// https://github.com/symfony/symfony/commit/9493cfd5f2366dab19bbdde0d0291d0575454567
|
||||
ArgumentDefaultValueReplacerRector::REPLACED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new ArgumentDefaultValueReplacer(
|
||||
'Symfony\Component\HttpFoundation\Cookie',
|
||||
MethodName::CONSTRUCT,
|
||||
5,
|
||||
false,
|
||||
null
|
||||
),
|
||||
new ArgumentDefaultValueReplacer(
|
||||
'Symfony\Component\HttpFoundation\Cookie',
|
||||
MethodName::CONSTRUCT,
|
||||
8,
|
||||
null,
|
||||
'lax'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(ArgumentRemoverRector::class)
|
||||
->call('configure', [[
|
||||
# https://github.com/symfony/symfony/commit/f5c355e1ba399a1b3512367647d902148bdaf09f
|
||||
ArgumentRemoverRector::REMOVED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new ArgumentRemover(
|
||||
'Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector',
|
||||
MethodName::CONSTRUCT,
|
||||
0,
|
||||
null
|
||||
),
|
||||
new ArgumentRemover(
|
||||
'Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector',
|
||||
MethodName::CONSTRUCT,
|
||||
1,
|
||||
null
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
};
|
@ -1,103 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;
|
||||
use Rector\Arguments\ValueObject\ArgumentAdder;
|
||||
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\DependencyInjection\Rector\ClassMethod\AddMethodParentCallRector;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Symfony4\Rector\MethodCall\MakeDispatchFirstArgumentEventRector;
|
||||
use Rector\Symfony4\Rector\MethodCall\SimplifyWebTestCaseAssertionsRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
# https://github.com/symfony/symfony/blob/4.4/UPGRADE-4.3.md
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
# https://symfony.com/blog/new-in-symfony-4-3-better-test-assertions
|
||||
$services->set(SimplifyWebTestCaseAssertionsRector::class);
|
||||
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename('Symfony\Component\BrowserKit\Response', 'getStatus', 'getStatusCode'),
|
||||
new MethodCallRename('Symfony\Component\Security\Http\Firewall', 'handleRequest', 'callListeners'),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(MakeDispatchFirstArgumentEventRector::class);
|
||||
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
# https://symfony.com/blog/new-in-symfony-4-3-simpler-event-dispatching
|
||||
# Browser Kit
|
||||
'Symfony\Component\BrowserKit\Client' => 'Symfony\Component\BrowserKit\AbstractBrowser',
|
||||
# Cache
|
||||
# https://github.com/symfony/symfony/pull/29236
|
||||
'Symfony\Component\Cache\Traits\ApcuTrait\ApcuCache' => 'Symfony\Component\Cache\Traits\ApcuTrait\ApcuAdapter',
|
||||
'Symfony\Component\Cache\Adapter\SimpleCacheAdapter' => 'Symfony\Component\Cache\Adapter\Psr16Adapter',
|
||||
'Symfony\Component\Cache\Simple\ArrayCache' => 'Symfony\Component\Cache\Adapter\ArrayAdapter',
|
||||
'Symfony\Component\Cache\Simple\ChainCache' => 'Symfony\Component\Cache\Adapter\ChainAdapter',
|
||||
'Symfony\Component\Cache\Simple\DoctrineCache' => 'Symfony\Component\Cache\Adapter\DoctrineAdapter',
|
||||
'Symfony\Component\Cache\Simple\FilesystemCache' => 'Symfony\Component\Cache\Adapter\FilesystemAdapter',
|
||||
'Symfony\Component\Cache\Simple\MemcachedCache' => 'Symfony\Component\Cache\Adapter\MemcachedAdapter',
|
||||
'Symfony\Component\Cache\Simple\NullCache' => 'Symfony\Component\Cache\Adapter\NullAdapter',
|
||||
'Symfony\Component\Cache\Simple\PdoCache' => 'Symfony\Component\Cache\Adapter\PdoAdapter',
|
||||
'Symfony\Component\Cache\Simple\PhpArrayCache' => 'Symfony\Component\Cache\Adapter\PhpArrayAdapter',
|
||||
'Symfony\Component\Cache\Simple\PhpFilesCache' => 'Symfony\Component\Cache\Adapter\PhpFilesAdapter',
|
||||
'Symfony\Component\Cache\Simple\RedisCache' => 'Symfony\Component\Cache\Adapter\RedisAdapter',
|
||||
'Symfony\Component\Cache\Simple\TraceableCache' => 'Symfony\Component\Cache\Adapter\TraceableAdapterCache',
|
||||
'Symfony\Component\Cache\Simple\Psr6Cache' => 'Symfony\Component\Cache\Psr16Cache',
|
||||
'Psr\SimpleCache\CacheInterface' => 'Symfony\Contracts\Cache\CacheInterface',
|
||||
# EventDispatcher
|
||||
'Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent' => 'Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent',
|
||||
'Symfony\Component\HttpKernel\Event\FilterControllerEvent' => 'Symfony\Component\HttpKernel\Event\ControllerEvent',
|
||||
'Symfony\Component\HttpKernel\Event\FilterResponseEvent' => 'Symfony\Component\HttpKernel\Event\ResponseEvent',
|
||||
'Symfony\Component\HttpKernel\Event\GetResponseEvent' => 'Symfony\Component\HttpKernel\Event\RequestEvent',
|
||||
'Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent' => 'Symfony\Component\HttpKernel\Event\ViewEvent',
|
||||
'Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent' => 'Symfony\Component\HttpKernel\Event\ExceptionEvent',
|
||||
'Symfony\Component\HttpKernel\Event\PostResponseEvent' => 'Symfony\Component\HttpKernel\Event\TerminateEvent',
|
||||
# has lowest priority, have to be last
|
||||
'Symfony\Component\EventDispatcher\Event' => 'Symfony\Contracts\EventDispatcher\Event',
|
||||
# MimeType
|
||||
'Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface' => 'Symfony\Component\Mime\MimeTypesInterface',
|
||||
'Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesserInterface' => 'Symfony\Component\Mime\MimeTypesInterface',
|
||||
'Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesser' => 'Symfony\Component\Mime\MimeTypes',
|
||||
'Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser' => 'Symfony\Component\Mime\FileBinaryMimeTypeGuesser',
|
||||
'Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser' => 'Symfony\Component\Mime\FileinfoMimeTypeGuesser',
|
||||
# HttpKernel
|
||||
# @todo unpack after YAML to PHP migration, Symfony\Component\HttpKernel\Client: Symfony\Component\HttpKernel\HttpKernelBrowser
|
||||
'Symfony\Component\HttpKernel\EventListener\TranslatorListener' => 'Symfony\Component\HttpKernel\EventListener\LocaleAwareListener',
|
||||
# Security
|
||||
'Symfony\Component\Security\Core\Encoder\Argon2iPasswordEncoder' => 'Symfony\Component\Security\Core\Encoder\SodiumPasswordEncoder',
|
||||
'Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder' => 'Symfony\Component\Security\Core\Encoder\NativePasswordEncoder',
|
||||
],
|
||||
]]);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/4.4/UPGRADE-4.3.md#workflow
|
||||
$services->set(ArgumentAdderRector::class)
|
||||
->call('configure', [[
|
||||
ArgumentAdderRector::ADDED_ARGUMENTS => ValueObjectInliner::inline([
|
||||
new ArgumentAdder(
|
||||
'Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface',
|
||||
'setMarking',
|
||||
2,
|
||||
'context',
|
||||
[]
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(AddMethodParentCallRector::class)
|
||||
->call('configure', [[
|
||||
AddMethodParentCallRector::METHODS_BY_PARENT_TYPES => [
|
||||
'Symfony\Component\EventDispatcher\EventDispatcher' => MethodName::CONSTRUCT,
|
||||
],
|
||||
]]);
|
||||
};
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Symfony4\Rector\ClassMethod\ConsoleExecuteReturnIntRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
# https://github.com/symfony/symfony/blob/4.4/UPGRADE-4.4.md
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
# https://github.com/symfony/symfony/pull/33775
|
||||
$services->set(ConsoleExecuteReturnIntRector::class);
|
||||
};
|
@ -1,445 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use PHPStan\Type\ArrayType;
|
||||
use PHPStan\Type\BooleanType;
|
||||
use PHPStan\Type\FloatType;
|
||||
use PHPStan\Type\IntegerType;
|
||||
use PHPStan\Type\IterableType;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\NullType;
|
||||
use PHPStan\Type\ObjectWithoutClassType;
|
||||
use PHPStan\Type\StringType;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\ValueObject\AddParamTypeDeclaration;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
# see https://symfony.com/blog/symfony-type-declarations-return-types-and-phpunit-compatibility
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$arrayType = new ArrayType(new MixedType(), new MixedType());
|
||||
$iterableType = new IterableType(new MixedType(), new MixedType());
|
||||
|
||||
$services->set(AddParamTypeDeclarationRector::class)
|
||||
->call('configure', [[
|
||||
AddParamTypeDeclarationRector::PARAMETER_TYPEHINTS => ValueObjectInliner::inline([
|
||||
// see https://github.com/symfony/symfony/issues/32179
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\EventDispatcher\EventDispatcherInterface',
|
||||
'addListener',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\EventDispatcher\EventDispatcherInterface',
|
||||
'addListener',
|
||||
2,
|
||||
new IntegerType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\EventDispatcher\EventDispatcherInterface',
|
||||
'removeListener',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\EventDispatcher\EventDispatcherInterface',
|
||||
'getListeners',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\EventDispatcher\EventDispatcherInterface',
|
||||
'getListenerPriority',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\EventDispatcher\EventDispatcherInterface',
|
||||
'hasListeners',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Application',
|
||||
'setCatchExceptions',
|
||||
0,
|
||||
new BooleanType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Application',
|
||||
'setAutoExit',
|
||||
0,
|
||||
new BooleanType()
|
||||
),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Console\Application', 'setName', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Console\Application', 'setVersion', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Console\Application', 'register', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Console\Application', 'get', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Console\Application', 'has', 0, new StringType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Application',
|
||||
'findNamespace',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Console\Application', 'find', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Console\Application', 'all', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Console\Application', 'getAbbreviations', 0, $arrayType),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Application',
|
||||
'extractNamespace',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Application',
|
||||
'extractNamespace',
|
||||
1,
|
||||
new IntegerType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Application',
|
||||
'setDefaultCommand',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Application',
|
||||
'setDefaultCommand',
|
||||
1,
|
||||
new BooleanType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'mergeApplicationDefinition',
|
||||
0,
|
||||
new BooleanType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'addArgument',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'addArgument',
|
||||
1,
|
||||
new IntegerType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'addArgument',
|
||||
2,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'addOption',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'addOption',
|
||||
2,
|
||||
new IntegerType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'addOption',
|
||||
3,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'setName',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'setProcessTitle',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'setHidden',
|
||||
0,
|
||||
new BooleanType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'setDescription',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'setHelp',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'setAliases',
|
||||
0,
|
||||
$iterableType
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'getSynopsis',
|
||||
0,
|
||||
new BooleanType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'addUsage',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Command\Command',
|
||||
'getHelper',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\CommandLoader\CommandLoaderInterface',
|
||||
'get',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\CommandLoader\CommandLoaderInterface',
|
||||
'has',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Input\InputInterface',
|
||||
'getArgument',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Input\InputInterface',
|
||||
'setArgument',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Input\InputInterface',
|
||||
'getOption',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Input\InputInterface',
|
||||
'setOption',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Input\InputInterface',
|
||||
'hasOption',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Input\InputInterface',
|
||||
'setInteractive',
|
||||
0,
|
||||
new BooleanType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Output\OutputInterface',
|
||||
'write',
|
||||
1,
|
||||
new BooleanType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Output\OutputInterface',
|
||||
'write',
|
||||
2,
|
||||
new IntegerType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Output\OutputInterface',
|
||||
'writeln',
|
||||
1,
|
||||
new IntegerType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Output\OutputInterface',
|
||||
'setVerbosity',
|
||||
0,
|
||||
new IntegerType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Console\Output\OutputInterface',
|
||||
'setDecorated',
|
||||
0,
|
||||
new BooleanType()
|
||||
),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Process\Process', 'signal', 0, new IntegerType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Process\Process', 'stop', 0, new FloatType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Process\Process', 'stop', 1, new IntegerType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Process\Process', 'setTty', 0, new BooleanType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Process\Process', 'setPty', 0, new BooleanType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Process\Process',
|
||||
'setWorkingDirectory',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Process\Process',
|
||||
'inheritEnvironmentVariables',
|
||||
0,
|
||||
new BooleanType()
|
||||
),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Process\Process', 'updateStatus', 0, new BooleanType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\EventDispatcher\EventDispatcher',
|
||||
'dispatch',
|
||||
0,
|
||||
new ObjectWithoutClassType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Contracts\Translation\TranslatorInterface',
|
||||
'setLocale',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Contracts\Translation\TranslatorInterface',
|
||||
'trans',
|
||||
0,
|
||||
new UnionType([new StringType(), new NullType()])
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Contracts\Translation\TranslatorInterface',
|
||||
'trans',
|
||||
2,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Contracts\Translation\TranslatorInterface',
|
||||
'trans',
|
||||
3,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\AbstractExtension', 'getType', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\AbstractExtension', 'hasType', 0, new StringType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\AbstractExtension',
|
||||
'getTypeExtensions',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\AbstractExtension',
|
||||
'hasTypeExtensions',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\DataMapperInterface',
|
||||
'mapFormsToData',
|
||||
0,
|
||||
$iterableType
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\DataMapperInterface',
|
||||
'mapDataToForms',
|
||||
1,
|
||||
$iterableType
|
||||
),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\Form', 'add', 1, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\Form', 'remove', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\Form', 'has', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\Form', 'get', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\FormBuilderInterface', 'add', 1, new StringType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\FormBuilderInterface',
|
||||
'create',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\FormBuilderInterface',
|
||||
'create',
|
||||
1,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\FormBuilderInterface', 'get', 0, new StringType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\FormBuilderInterface',
|
||||
'remove',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\FormBuilderInterface', 'has', 0, new StringType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\FormExtensionInterface',
|
||||
'getTypeExtensions',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\FormExtensionInterface',
|
||||
'hasTypeExtensions',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\FormFactory', 'create', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\FormFactory', 'createNamed', 0, new StringType()),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\FormFactory', 'createNamed', 1, new StringType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\FormFactory',
|
||||
'createForProperty',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\FormFactory',
|
||||
'createForProperty',
|
||||
1,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration('Symfony\Component\Form\FormFactory', 'createBuilder', 0, new StringType()),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\FormFactory',
|
||||
'createNamedBuilder',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\FormFactory',
|
||||
'createNamedBuilder',
|
||||
1,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\FormFactory',
|
||||
'createBuilderForProperty',
|
||||
0,
|
||||
new StringType()
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Form\FormFactory',
|
||||
'createBuilderForProperty',
|
||||
1,
|
||||
new StringType()
|
||||
), ]
|
||||
),
|
||||
]]);
|
||||
};
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.0/UPGRADE-5.0.md
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->import(__DIR__ . '/symfony50-types.php');
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
'Symfony\Component\Debug\Debug' => 'Symfony\Component\ErrorHandler\Debug',
|
||||
],
|
||||
]]);
|
||||
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename('Symfony\Component\Console\Application', 'renderException', 'renderThrowable'),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Console\Application',
|
||||
'doRenderException',
|
||||
'doRenderThrowable'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
};
|
@ -1,150 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.1.md
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector;
|
||||
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
||||
use Rector\Renaming\Rector\String_\RenameStringRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Renaming\ValueObject\RenameClassAndConstFetch;
|
||||
use Rector\Symfony5\Rector\Class_\LogoutHandlerToLogoutEventSubscriberRector;
|
||||
use Rector\Symfony5\Rector\Class_\LogoutSuccessHandlerToLogoutEventSubscriberRector;
|
||||
use Rector\Symfony5\Rector\ClassMethod\RouteCollectionBuilderToRoutingConfiguratorRector;
|
||||
use Rector\Transform\Rector\New_\NewArgToMethodCallRector;
|
||||
use Rector\Transform\Rector\StaticCall\StaticCallToNewRector;
|
||||
use Rector\Transform\ValueObject\NewArgToMethodCall;
|
||||
use Rector\Transform\ValueObject\StaticCallToNew;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\ValueObject\AddParamTypeDeclaration;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
// see https://github.com/symfony/symfony/pull/36243
|
||||
$services->set(LogoutHandlerToLogoutEventSubscriberRector::class);
|
||||
$services->set(LogoutSuccessHandlerToLogoutEventSubscriberRector::class);
|
||||
$services->set(RenameClassRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
'Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy' => 'Symfony\Component\EventDispatcher\EventDispatcherInterface',
|
||||
'Symfony\Component\Form\Extension\Validator\Util\ServerParams' => 'Symfony\Component\Form\Util\ServerParams',
|
||||
// see https://github.com/symfony/symfony/pull/35092
|
||||
'Symfony\Component\Inflector' => 'Symfony\Component\String\Inflector\InflectorInterface',
|
||||
],
|
||||
]]);
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Config\Definition\BaseNode',
|
||||
'getDeprecationMessage',
|
||||
'getDeprecation'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\DependencyInjection\Definition',
|
||||
'getDeprecationMessage',
|
||||
'getDeprecation'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\DependencyInjection\Alias',
|
||||
'getDeprecationMessage',
|
||||
'getDeprecation'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
$services->set(RenameFunctionRector::class)
|
||||
->call('configure', [[
|
||||
RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [
|
||||
'Symfony\Component\DependencyInjection\Loader\Configuraton\inline' => 'Symfony\Component\DependencyInjection\Loader\Configuraton\inline_service',
|
||||
'Symfony\Component\DependencyInjection\Loader\Configuraton\ref' => 'Symfony\Component\DependencyInjection\Loader\Configuraton\service',
|
||||
],
|
||||
]]);
|
||||
// https://github.com/symfony/symfony/pull/35308
|
||||
$services->set(NewArgToMethodCallRector::class)
|
||||
->call('configure', [[
|
||||
NewArgToMethodCallRector::NEW_ARGS_TO_METHOD_CALLS => ValueObjectInliner::inline([
|
||||
new NewArgToMethodCall('Symfony\Component\Dotenv\Dotenv', true, 'usePutenv'),
|
||||
]),
|
||||
]]);
|
||||
$services->set(RenameClassConstFetchRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassConstFetchRector::CLASS_CONSTANT_RENAME => ValueObjectInliner::inline([
|
||||
new RenameClassAndConstFetch(
|
||||
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
|
||||
'ROUND_FLOOR',
|
||||
'NumberFormatter',
|
||||
'ROUND_FLOOR'
|
||||
),
|
||||
new RenameClassAndConstFetch(
|
||||
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
|
||||
'ROUND_DOWN',
|
||||
'NumberFormatter',
|
||||
'ROUND_DOWN'
|
||||
),
|
||||
new RenameClassAndConstFetch(
|
||||
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
|
||||
'ROUND_HALF_DOWN',
|
||||
'NumberFormatter',
|
||||
'ROUND_HALFDOWN'
|
||||
),
|
||||
new RenameClassAndConstFetch(
|
||||
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
|
||||
'ROUND_HALF_EVEN',
|
||||
'NumberFormatter',
|
||||
'ROUND_HALFEVEN'
|
||||
),
|
||||
new RenameClassAndConstFetch(
|
||||
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
|
||||
'ROUND_HALFUP',
|
||||
'NumberFormatter',
|
||||
'ROUND_HALFUP'
|
||||
),
|
||||
new RenameClassAndConstFetch(
|
||||
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
|
||||
'ROUND_UP',
|
||||
'NumberFormatter',
|
||||
'ROUND_UP'
|
||||
),
|
||||
new RenameClassAndConstFetch(
|
||||
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
|
||||
'ROUND_CEILING',
|
||||
'NumberFormatter',
|
||||
'ROUND_CEILING'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
$services->set(AddParamTypeDeclarationRector::class)
|
||||
->call('configure', [[
|
||||
// see https://github.com/symfony/symfony/pull/36943
|
||||
AddParamTypeDeclarationRector::PARAMETER_TYPEHINTS => ValueObjectInliner::inline([
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait',
|
||||
'configureRoutes',
|
||||
0,
|
||||
new ObjectType('Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator')
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
$services->set(StaticCallToNewRector::class)
|
||||
->call('configure', [[
|
||||
StaticCallToNewRector::STATIC_CALLS_TO_NEWS => ValueObjectInliner::inline([
|
||||
new StaticCallToNew('Symfony\Component\HttpFoundation\Response', 'create'),
|
||||
new StaticCallToNew('Symfony\Component\HttpFoundation\JsonResponse', 'create'),
|
||||
new StaticCallToNew('Symfony\Component\HttpFoundation\RedirectResponse', 'create'),
|
||||
new StaticCallToNew('Symfony\Component\HttpFoundation\StreamedResponse', 'create'),
|
||||
]),
|
||||
]]);
|
||||
$services->set(RenameStringRector::class)
|
||||
->call('configure', [[
|
||||
// @see https://github.com/symfony/symfony/pull/35858
|
||||
RenameStringRector::STRING_CHANGES => [
|
||||
'ROLE_PREVIOUS_ADMIN' => 'IS_IMPERSONATOR',
|
||||
],
|
||||
]]);
|
||||
$services->set(RouteCollectionBuilderToRoutingConfiguratorRector::class);
|
||||
};
|
@ -1,196 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector;
|
||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
||||
use Rector\Renaming\Rector\PropertyFetch\RenamePropertyRector;
|
||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
||||
use Rector\Renaming\ValueObject\RenameClassAndConstFetch;
|
||||
use Rector\Renaming\ValueObject\RenameProperty;
|
||||
use Rector\Symfony5\Rector\MethodCall\DefinitionAliasSetPrivateToSetPublicRector;
|
||||
use Rector\Symfony5\Rector\MethodCall\FormBuilderSetDataMapperRector;
|
||||
use Rector\Symfony5\Rector\MethodCall\ReflectionExtractorEnableMagicCallExtractorRector;
|
||||
use Rector\Symfony5\Rector\MethodCall\ValidatorBuilderEnableAnnotationMappingRector;
|
||||
use Rector\Symfony5\Rector\New_\PropertyAccessorCreationBooleanToFlagsRector;
|
||||
use Rector\Symfony5\Rector\New_\PropertyPathMapperToDataMapperRector;
|
||||
use Rector\Symfony5\Rector\StaticCall\BinaryFileResponseCreateToNewInstanceRector;
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
|
||||
use Rector\TypeDeclaration\ValueObject\AddParamTypeDeclaration;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->import(__DIR__ . '/symfony50-types.php');
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#form
|
||||
$services->set(PropertyPathMapperToDataMapperRector::class);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#httpfoundation
|
||||
$services->set(BinaryFileResponseCreateToNewInstanceRector::class);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#mime
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename('Symfony\Component\Mime\Address', 'fromString', 'create'),
|
||||
]),
|
||||
]]);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#propertyaccess
|
||||
$services->set(PropertyAccessorCreationBooleanToFlagsRector::class);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#propertyinfo
|
||||
$services->set(ReflectionExtractorEnableMagicCallExtractorRector::class);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#security
|
||||
$services->set(RenameClassConstFetchRector::class)
|
||||
->call('configure', [[
|
||||
RenameClassConstFetchRector::CLASS_CONSTANT_RENAME => ValueObjectInliner::inline([
|
||||
new RenameClassAndConstFetch(
|
||||
'Symfony\Component\Security\Http\Firewall\AccessListener',
|
||||
'PUBLIC_ACCESS',
|
||||
'Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter',
|
||||
'PUBLIC_ACCESS'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
$services->set(RenameMethodRector::class)
|
||||
->call('configure', [[
|
||||
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken',
|
||||
'setProviderKey',
|
||||
'setFirewallName'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken',
|
||||
'getProviderKey',
|
||||
'getFirewallName'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Security\Core\Authentication\Token\RememberMeToken',
|
||||
'setProviderKey',
|
||||
'setFirewallName'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Security\Core\Authentication\Token\RememberMeToken',
|
||||
'getProviderKey',
|
||||
'getFirewallName'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken',
|
||||
'setProviderKey',
|
||||
'setFirewallName'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken',
|
||||
'getProviderKey',
|
||||
'getFirewallName'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken',
|
||||
'setProviderKey',
|
||||
'setFirewallName'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken',
|
||||
'getProviderKey',
|
||||
'getFirewallName'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler',
|
||||
'setProviderKey',
|
||||
'setFirewallName'
|
||||
),
|
||||
new MethodCallRename(
|
||||
'Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler',
|
||||
'getProviderKey',
|
||||
'getFirewallName'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#dependencyinjection
|
||||
$services->set(DefinitionAliasSetPrivateToSetPublicRector::class);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#form
|
||||
$services->set(FormBuilderSetDataMapperRector::class);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#validator
|
||||
$services->set(ValidatorBuilderEnableAnnotationMappingRector::class);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#notifier
|
||||
$services->set(AddParamTypeDeclarationRector::class)
|
||||
->call('configure', [[
|
||||
AddParamTypeDeclarationRector::PARAMETER_TYPEHINTS => ValueObjectInliner::inline([
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Notifier\NotifierInterface',
|
||||
'send',
|
||||
1,
|
||||
new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface')
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Notifier\Notifier',
|
||||
'getChannels',
|
||||
1,
|
||||
new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface')
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Notifier\Channel\ChannelInterface',
|
||||
'notify',
|
||||
1,
|
||||
new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface')
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Notifier\Channel\ChannelInterface',
|
||||
'supports',
|
||||
1,
|
||||
new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface')
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#notifier
|
||||
$services->set(AddParamTypeDeclarationRector::class)
|
||||
->call('configure', [[
|
||||
AddParamTypeDeclarationRector::PARAMETER_TYPEHINTS => ValueObjectInliner::inline([
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Notifier\Notification\ChatNotificationInterface',
|
||||
'asChatMessage',
|
||||
0,
|
||||
new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface')
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Notifier\Notification\EmailNotificationInterface',
|
||||
'asEmailMessage',
|
||||
0,
|
||||
new ObjectType('Symfony\Component\Notifier\Recipient\EmailRecipientInterface')
|
||||
),
|
||||
new AddParamTypeDeclaration(
|
||||
'Symfony\Component\Notifier\Notification\SmsNotificationInterface',
|
||||
'asSmsMessage',
|
||||
0,
|
||||
new ObjectType('Symfony\Component\Notifier\Recipient\SmsRecipientInterface')
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
|
||||
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#security
|
||||
$services->set(RenamePropertyRector::class)
|
||||
->call('configure', [[
|
||||
RenamePropertyRector::RENAMED_PROPERTIES => ValueObjectInliner::inline([
|
||||
new RenameProperty(
|
||||
'Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices',
|
||||
'providerKey',
|
||||
'firewallName'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
};
|
@ -27,7 +27,7 @@ final class RectorSetProvider extends AbstractSetProvider
|
||||
/**
|
||||
* @var array<class-string<SetListInterface>>
|
||||
*/
|
||||
private const SET_LIST_CLASSES = [SetList::class, DowngradeSetList::class];
|
||||
private const SET_LIST_CLASSES = [SetList::class, DowngradeSetList::class, SymfonySetList::class];
|
||||
|
||||
/**
|
||||
* @var Set[]
|
||||
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Rector\Set\ValueObject;
|
||||
|
||||
use Rector\Set\Contract\SetListInterface;
|
||||
use Rector\Set\SymfonySetList;
|
||||
|
||||
final class SetList implements SetListInterface
|
||||
{
|
||||
@ -504,89 +505,123 @@ final class SetList implements SetListInterface
|
||||
public const SWIFTMAILER_60 = __DIR__ . '/../../../config/set/swiftmailer60.php';
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_26 = __DIR__ . '/../../../config/set/symfony26.php';
|
||||
public const SYMFONY_26 = SymfonySetList::SYMFONY_26;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_28 = __DIR__ . '/../../../config/set/symfony28.php';
|
||||
public const SYMFONY_28 = SymfonySetList::SYMFONY_28;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_30 = __DIR__ . '/../../../config/set/symfony30.php';
|
||||
public const SYMFONY_30 = SymfonySetList::SYMFONY_30;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_31 = __DIR__ . '/../../../config/set/symfony31.php';
|
||||
public const SYMFONY_31 = SymfonySetList::SYMFONY_31;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_32 = __DIR__ . '/../../../config/set/symfony32.php';
|
||||
public const SYMFONY_32 = SymfonySetList::SYMFONY_32;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_33 = __DIR__ . '/../../../config/set/symfony33.php';
|
||||
public const SYMFONY_33 = SymfonySetList::SYMFONY_33;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_34 = __DIR__ . '/../../../config/set/symfony34.php';
|
||||
public const SYMFONY_34 = SymfonySetList::SYMFONY_34;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_40 = __DIR__ . '/../../../config/set/symfony40.php';
|
||||
public const SYMFONY_40 = SymfonySetList::SYMFONY_40;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_41 = __DIR__ . '/../../../config/set/symfony41.php';
|
||||
public const SYMFONY_41 = SymfonySetList::SYMFONY_41;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_42 = __DIR__ . '/../../../config/set/symfony42.php';
|
||||
public const SYMFONY_42 = SymfonySetList::SYMFONY_42;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_43 = __DIR__ . '/../../../config/set/symfony43.php';
|
||||
public const SYMFONY_43 = SymfonySetList::SYMFONY_43;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_44 = __DIR__ . '/../../../config/set/symfony44.php';
|
||||
public const SYMFONY_44 = SymfonySetList::SYMFONY_44;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_50 = __DIR__ . '/../../../config/set/symfony50.php';
|
||||
public const SYMFONY_50 = SymfonySetList::SYMFONY_50;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_50_TYPES = __DIR__ . '/../../../config/set/symfony50-types.php';
|
||||
public const SYMFONY_50_TYPES = SymfonySetList::SYMFONY_50_TYPES;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_52 = __DIR__ . '/../../../config/set/symfony52.php';
|
||||
public const SYMFONY_52 = SymfonySetList::SYMFONY_52;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_CODE_QUALITY = __DIR__ . '/../../../config/set/symfony-code-quality.php';
|
||||
public const SYMFONY_CODE_QUALITY = SymfonySetList::SYMFONY_CODE_QUALITY;
|
||||
|
||||
/**
|
||||
* For BC layer
|
||||
* @deprecated Use SymfonySetList from rector/rector-symfony instead
|
||||
* @var string
|
||||
*/
|
||||
public const SYMFONY_CONSTRUCTOR_INJECTION = __DIR__ . '/../../../config/set/symfony-constructor-injection.php';
|
||||
public const SYMFONY_CONSTRUCTOR_INJECTION = SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Arguments\Rector\ClassMethod\ArgumentDefaultValueReplacerRector\FixtureSymfony28;
|
||||
|
||||
use Symfony\Component\Routing\Router;
|
||||
|
||||
class UrlMatcherGenerate
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$router = new Router();
|
||||
$router->generate('name', [], false);
|
||||
$router->generate('name', [], true);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Arguments\Rector\ClassMethod\ArgumentDefaultValueReplacerRector\FixtureSymfony28;
|
||||
|
||||
use Symfony\Component\Routing\Router;
|
||||
|
||||
class UrlMatcherGenerate
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$router = new Router();
|
||||
$router->generate('name', [], \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_PATH);
|
||||
$router->generate('name', [], \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Arguments\Rector\ClassMethod\ArgumentDefaultValueReplacerRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
/**
|
||||
* @see https://github.com/symfony/symfony/commit/912fc4de8fd6de1e5397be4a94d39091423e5188
|
||||
*/
|
||||
final class Symfony28Test extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/FixtureSymfony28');
|
||||
}
|
||||
|
||||
protected function provideConfigFilePath(): string
|
||||
{
|
||||
return __DIR__ . '/../../../../../config/set/symfony28.php';
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ use JMS\DiExtraBundle\Annotation as DI;
|
||||
|
||||
class ClassWithInjects35
|
||||
{
|
||||
public function __construct(private \Rector\Tests\Symfony\Rector\MethodCall\AbstractToConstructorInjectionRectorSource\Contract\SomeTranslatorInterface $translator)
|
||||
public function __construct(private \Rector\Tests\DependencyInjection\Rector\Property\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeTranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ use JMS\DiExtraBundle\Annotation as DI;
|
||||
|
||||
class ClassWithPublicInjects
|
||||
{
|
||||
public function __construct(public \Rector\Tests\Symfony\Rector\MethodCall\AbstractToConstructorInjectionRectorSource\Contract\SomeTranslatorInterface $translator)
|
||||
public function __construct(public \Rector\Tests\DependencyInjection\Rector\Property\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeTranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ use JMS\DiExtraBundle\Annotation as DI;
|
||||
|
||||
final class SomeController
|
||||
{
|
||||
public function __construct(private \Rector\Tests\Symfony\Rector\MethodCall\AbstractToConstructorInjectionRectorSource\SomeEntityManager $entityManager, private \Rector\Tests\Symfony\Rector\MethodCall\AbstractToConstructorInjectionRectorSource\Contract\SomeTranslatorInterface $translator)
|
||||
public function __construct(private \Rector\Tests\DependencyInjection\Rector\Property\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeEntityManager $entityManager, private \Rector\Tests\DependencyInjection\Rector\Property\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeTranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use JMS\DiExtraBundle\Annotation as DI;
|
||||
class SomeController2
|
||||
{
|
||||
/**
|
||||
* @DI\Inject("Rector\Tests\Symfony\Rector\MethodCall\AbstractToConstructorInjectionRectorSource\SomeEntityManager")
|
||||
* @DI\Inject("Rector\Tests\DependencyInjection\Rector\Property\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeEntityManager")
|
||||
*/
|
||||
private $entityManager;
|
||||
}
|
||||
@ -22,7 +22,7 @@ use JMS\DiExtraBundle\Annotation as DI;
|
||||
|
||||
class SomeController2
|
||||
{
|
||||
public function __construct(private \Rector\Tests\Symfony\Rector\MethodCall\AbstractToConstructorInjectionRectorSource\SomeEntityManager $entityManager)
|
||||
public function __construct(private \Rector\Tests\DependencyInjection\Rector\Property\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeEntityManager $entityManager)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\DependencyInjection\Rector\Property\AnnotatedPropertyInjectToConstructorInjectionRector\Source;
|
||||
|
||||
final class SomeEntityManager
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\DependencyInjection\Rector\Property\AnnotatedPropertyInjectToConstructorInjectionRector\Source;
|
||||
|
||||
final class SomeTranslator implements SomeTranslatorInterface
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\DependencyInjection\Rector\Property\AnnotatedPropertyInjectToConstructorInjectionRector\Source;
|
||||
|
||||
interface SomeTranslatorInterface
|
||||
{
|
||||
|
||||
}
|
@ -8,10 +8,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(
|
||||
Option::SYMFONY_CONTAINER_XML_PATH_PARAMETER,
|
||||
__DIR__ . '/../../../../../Symfony/Rector/MethodCall/GetToConstructorInjectionRector/xml/services.xml'
|
||||
);
|
||||
$parameters->set(Option::SYMFONY_CONTAINER_XML_PATH_PARAMETER, __DIR__ . '/../xml/services.xml');
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(AnnotatedPropertyInjectToConstructorInjectionRector::class);
|
||||
|
@ -8,15 +8,15 @@
|
||||
<service id="some_service" alias="stdClass"></service>
|
||||
|
||||
<!-- ->register(id, class) -->
|
||||
<service id="translator.data_collector" class="Rector\Tests\Symfony\Rector\MethodCall\AbstractToConstructorInjectionRectorSource\SomeTranslator"></service>
|
||||
<service id="translator.data_collector" class="Rector\Tests\DependencyInjection\Rector\Property\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeTranslator"></service>
|
||||
|
||||
<!-- ->setAlias(alias, id) -->
|
||||
<service id="translator" alias="translator.data_collector"></service>
|
||||
|
||||
<!-- ->setAlias(alias, id) -->
|
||||
<service id="Rector\Tests\Symfony\Rector\MethodCall\AbstractToConstructorInjectionRectorSource\SomeTranslatorInterface" alias="translator.data_collector"></service>
|
||||
<service id="Rector\Tests\DependencyInjection\Rector\Property\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeTranslatorInterface" alias="translator.data_collector"></service>
|
||||
|
||||
<!-- ->register(id, class) -->
|
||||
<service id="entity.manager" class="Rector\Tests\Symfony\Rector\MethodCall\AbstractToConstructorInjectionRectorSource\SomeEntityManager"></service>
|
||||
<service id="entity.manager" class="Rector\Tests\DependencyInjection\Rector\Property\AnnotatedPropertyInjectToConstructorInjectionRector\Source\SomeEntityManager"></service>
|
||||
</services>
|
||||
</container>
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace spec\Rector\Tests\PhpSpecToPHPUnit\Rector\Variable\PhpSpecToPHPUnitRector\Fixture;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
|
||||
class CurrencySpec extends ObjectBehavior
|
||||
{
|
||||
public function it_returns_true()
|
||||
{
|
||||
$this->foo()->shouldEqual(true);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Tests\Rector\Tests\PhpSpecToPHPUnit\Rector\Variable\PhpSpecToPHPUnitRector\Fixture;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
|
||||
class CurrencyTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
private \Rector\Tests\PhpSpecToPHPUnit\Rector\Variable\PhpSpecToPHPUnitRector\Fixture\Currency $currency;
|
||||
private \CurrencyData|\PHPUnit\Framework\MockObject\MockObject $data;
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->currency = new \Rector\Tests\PhpSpecToPHPUnit\Rector\Variable\PhpSpecToPHPUnitRector\Fixture\Currency();
|
||||
}
|
||||
public function testReturnsTrue()
|
||||
{
|
||||
$this->assertEquals(true, $this->currency->foo());
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -21,7 +21,7 @@ final class PhpSpecToPHPUnitRectorTest extends AbstractRectorTestCase
|
||||
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return StaticFixtureFinder::yieldDirectory(__DIR__ . '/Fixture', '*.php.inc');
|
||||
return StaticFixtureFinder::yieldDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function provideConfigFilePath(): string
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\PhpSpecToPHPUnit\Rector\Class_\AddMockPropertiesRector;
|
||||
use Rector\PhpSpecToPHPUnit\Rector\Class_\PhpSpecClassToPHPUnitClassRector;
|
||||
use Rector\PhpSpecToPHPUnit\Rector\ClassMethod\PhpSpecMethodToPHPUnitMethodRector;
|
||||
@ -10,10 +12,8 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(
|
||||
# 1. first convert mocks
|
||||
PhpSpecMocksToPHPUnitMocksRector::class
|
||||
);
|
||||
|
||||
$services->set(PhpSpecMocksToPHPUnitMocksRector::class);
|
||||
$services->set(PhpSpecPromisesToPHPUnitAssertRector::class);
|
||||
$services->set(PhpSpecMethodToPHPUnitMethodRector::class);
|
||||
$services->set(PhpSpecClassToPHPUnitClassRector::class);
|
||||
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Attribute\ExtractAttributeRouteNameConstantsRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Symfony\Rector\Attribute\ExtractAttributeRouteNameConstantsRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
/**
|
||||
* @requires PHP 8.0
|
||||
*/
|
||||
final class ExtractAttributeRouteNameConstantsRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(
|
||||
SmartFileInfo $inputFile,
|
||||
string $expectedExtraFileName,
|
||||
string $expectedExtraContentFilePath
|
||||
): void {
|
||||
$this->doTestFileInfo($inputFile);
|
||||
$this->doTestExtraFile($expectedExtraFileName, $expectedExtraContentFilePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<string[]|SmartFileInfo[]>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
yield [
|
||||
new SmartFileInfo(__DIR__ . '/Fixture/fixture.php.inc'),
|
||||
'src/ValueObject/Routing/RouteName.php',
|
||||
__DIR__ . '/Source/extra_file.php',
|
||||
];
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return ExtractAttributeRouteNameConstantsRector::class;
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Attribute\ExtractAttributeRouteNameConstantsRector\Fixture;
|
||||
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class SomeClass
|
||||
{
|
||||
#[Route(path: "path", name: "name")]
|
||||
public function run()
|
||||
{
|
||||
}
|
||||
|
||||
#[Route(path: "path_2", name: "100_level")]
|
||||
public function go()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Attribute\ExtractAttributeRouteNameConstantsRector\Fixture;
|
||||
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class SomeClass
|
||||
{
|
||||
#[Route(path: "path", name: \App\ValueObject\Routing\RouteName::NAME)]
|
||||
public function run()
|
||||
{
|
||||
}
|
||||
|
||||
#[Route(path: "path_2", name: \App\ValueObject\Routing\RouteName::ROUTE_100_LEVEL)]
|
||||
public function go()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Core\ValueObject\Routing;
|
||||
|
||||
final class RouteName
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const NAME = 'name';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ROUTE_100_LEVEL = '100_level';
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\BinaryOp\ResponseStatusCodeRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$response = new \Symfony\Component\HttpFoundation\Response();
|
||||
$response->setStatusCode(200);
|
||||
|
||||
if ($response->getStatusCode() === 200) {}
|
||||
if (200 === $response->getStatusCode()) {}
|
||||
if ($response->getStatusCode() > 200) {}
|
||||
if ($response->getStatusCode() < 200) {}
|
||||
if ($response->getStatusCode() != 200) {}
|
||||
if ($response->getStatusCode() !== 200) {}
|
||||
if ($response->getStatusCode() === 200 || $response->getStatusCode() === 201) {}
|
||||
if ($response->getStatusCode() !== 999999) {}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\BinaryOp\ResponseStatusCodeRector\Fixture;
|
||||
|
||||
class Fixture
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$response = new \Symfony\Component\HttpFoundation\Response();
|
||||
$response->setStatusCode(\Symfony\Component\HttpFoundation\Response::HTTP_OK);
|
||||
|
||||
if ($response->getStatusCode() === \Symfony\Component\HttpFoundation\Response::HTTP_OK) {}
|
||||
if (\Symfony\Component\HttpFoundation\Response::HTTP_OK === $response->getStatusCode()) {}
|
||||
if ($response->getStatusCode() > \Symfony\Component\HttpFoundation\Response::HTTP_OK) {}
|
||||
if ($response->getStatusCode() < \Symfony\Component\HttpFoundation\Response::HTTP_OK) {}
|
||||
if ($response->getStatusCode() != \Symfony\Component\HttpFoundation\Response::HTTP_OK) {}
|
||||
if ($response->getStatusCode() !== \Symfony\Component\HttpFoundation\Response::HTTP_OK) {}
|
||||
if ($response->getStatusCode() === \Symfony\Component\HttpFoundation\Response::HTTP_OK || $response->getStatusCode() === \Symfony\Component\HttpFoundation\Response::HTTP_CREATED) {}
|
||||
if ($response->getStatusCode() !== 999999) {}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\BinaryOp\ResponseStatusCodeRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Symfony\Rector\BinaryOp\ResponseStatusCodeRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ResponseStatusCodeRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return ResponseStatusCodeRector::class;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\ActionSuffixRemoverRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Symfony\Rector\ClassMethod\ActionSuffixRemoverRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ActionSuffixRemoverRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return ActionSuffixRemoverRector::class;
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\ActionSuffixRemoverRector\Fixture;
|
||||
|
||||
use Rector\Tests\Symfony\Rector\Source\SymfonyController;
|
||||
|
||||
class AppController extends SymfonyController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\ActionSuffixRemoverRector\Fixture;
|
||||
|
||||
use Rector\Tests\Symfony\Rector\Source\SymfonyController;
|
||||
|
||||
class AppController extends SymfonyController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\ActionSuffixRemoverRector\Fixture;
|
||||
|
||||
use Rector\Tests\Symfony\Rector\Source\AbstractSymfonyController;
|
||||
|
||||
class AppController2 extends AbstractSymfonyController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\ActionSuffixRemoverRector\Fixture;
|
||||
|
||||
use Rector\Tests\Symfony\Rector\Source\AbstractSymfonyController;
|
||||
|
||||
class AppController2 extends AbstractSymfonyController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\RemoveServiceFromSensioRouteRector\Fixture;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
|
||||
final class SomeClass
|
||||
{
|
||||
/**
|
||||
* @Route(service="some_service")
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\RemoveServiceFromSensioRouteRector\Fixture;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
|
||||
final class SomeClass
|
||||
{
|
||||
/**
|
||||
* @Route()
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\RemoveServiceFromSensioRouteRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Symfony\Rector\ClassMethod\RemoveServiceFromSensioRouteRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class RemoveServiceFromSensioRouteRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return RemoveServiceFromSensioRouteRector::class;
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\ReplaceSensioRouteAnnotationWithSymfonyRector\Fixture;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
|
||||
final class SomeClass
|
||||
{
|
||||
/**
|
||||
* @Route()
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\ReplaceSensioRouteAnnotationWithSymfonyRector\Fixture;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
|
||||
final class SomeClass
|
||||
{
|
||||
/**
|
||||
* @\Symfony\Component\Routing\Annotation\Route()
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\ReplaceSensioRouteAnnotationWithSymfonyRector\Fixture;
|
||||
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
final class SkipAlreadyRouteAnnotation
|
||||
{
|
||||
/**
|
||||
* @Route()
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\ReplaceSensioRouteAnnotationWithSymfonyRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Symfony\Rector\ClassMethod\ReplaceSensioRouteAnnotationWithSymfonyRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ReplaceSensioRouteAnnotationWithSymfonyRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return ReplaceSensioRouteAnnotationWithSymfonyRector::class;
|
||||
}
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
final class ClassWithArrayAndManyResponseController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return $this->handleStuff();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]|Response
|
||||
*/
|
||||
private function handleStuff()
|
||||
{
|
||||
if (mt_rand(0, 100)) {
|
||||
return [
|
||||
'hello' => 'world'
|
||||
];
|
||||
} else {
|
||||
return new JsonResponse([]);
|
||||
}
|
||||
|
||||
return new RedirectResponse('elsewhere');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
final class ClassWithArrayAndManyResponseController extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$responseOrData = $this->handleStuff();
|
||||
if ($responseOrData instanceof \Symfony\Component\HttpFoundation\Response) {
|
||||
return $responseOrData;
|
||||
}
|
||||
return $this->render('@App/Class_With_Array_And_Many_Response/index.html.twig', $responseOrData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]|Response
|
||||
*/
|
||||
private function handleStuff()
|
||||
{
|
||||
if (mt_rand(0, 100)) {
|
||||
return [
|
||||
'hello' => 'world'
|
||||
];
|
||||
} else {
|
||||
return new JsonResponse([]);
|
||||
}
|
||||
|
||||
return new RedirectResponse('elsewhere');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,70 +0,0 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
final class ClassWithArrayAndResponseController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template("with_some_template.twig")
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return $this->handleStuff();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|RedirectResponse
|
||||
*/
|
||||
private function handleStuff()
|
||||
{
|
||||
if (mt_rand(0, 100)) {
|
||||
return [
|
||||
'hello' => 'world'
|
||||
];
|
||||
}
|
||||
|
||||
return new RedirectResponse('elsewhere');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
final class ClassWithArrayAndResponseController extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$responseOrData = $this->handleStuff();
|
||||
if ($responseOrData instanceof \Symfony\Component\HttpFoundation\Response) {
|
||||
return $responseOrData;
|
||||
}
|
||||
return $this->render('with_some_template.twig', $responseOrData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|RedirectResponse
|
||||
*/
|
||||
private function handleStuff()
|
||||
{
|
||||
if (mt_rand(0, 100)) {
|
||||
return [
|
||||
'hello' => 'world'
|
||||
];
|
||||
}
|
||||
|
||||
return new RedirectResponse('elsewhere');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,74 +0,0 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
final class ClassWithArrayAndResponseWithArrayController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template("with_some_template.twig")
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return $this->handleStuff([
|
||||
'a' => 'b'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|RedirectResponse
|
||||
*/
|
||||
private function handleStuff(...$args)
|
||||
{
|
||||
if (mt_rand(0, 100)) {
|
||||
return [
|
||||
'hello' => 'world'
|
||||
];
|
||||
}
|
||||
|
||||
return new RedirectResponse('elsewhere');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
final class ClassWithArrayAndResponseWithArrayController extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$responseOrData = $this->handleStuff([
|
||||
'a' => 'b'
|
||||
]);
|
||||
if ($responseOrData instanceof \Symfony\Component\HttpFoundation\Response) {
|
||||
return $responseOrData;
|
||||
}
|
||||
return $this->render('with_some_template.twig', $responseOrData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|RedirectResponse
|
||||
*/
|
||||
private function handleStuff(...$args)
|
||||
{
|
||||
if (mt_rand(0, 100)) {
|
||||
return [
|
||||
'hello' => 'world'
|
||||
];
|
||||
}
|
||||
|
||||
return new RedirectResponse('elsewhere');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,46 +0,0 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Rector\Tests\Symfony\Rector\ClassMethod\TemplateAnnotationToThisRenderRector\Source\ClassToBeCreated;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
final class ArrayMapReturnController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template("items_template")
|
||||
*/
|
||||
public function indexAction($items)
|
||||
{
|
||||
$filteredItems = array_map(function ($item) {
|
||||
return new ClassToBeCreated($item);
|
||||
}, $items);
|
||||
|
||||
return compact('filteredItems');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Rector\Tests\Symfony\Rector\ClassMethod\TemplateAnnotationToThisRenderRector\Source\ClassToBeCreated;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
final class ArrayMapReturnController extends AbstractController
|
||||
{
|
||||
public function indexAction($items): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$filteredItems = array_map(function ($item) {
|
||||
return new ClassToBeCreated($item);
|
||||
}, $items);
|
||||
|
||||
return $this->render('items_template', ['filteredItems' => $filteredItems]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,62 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class ClassWithNamedService15Controller extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @Template
|
||||
*/
|
||||
public function index2Action()
|
||||
{
|
||||
return ['someKey' => 'someValue'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @Template("someFile.toBe.used")
|
||||
*/
|
||||
public function index3Action()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class ClassWithNamedService15Controller extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('@App/Class_With_Named_Service15/index.html.twig');
|
||||
}
|
||||
|
||||
public function index2Action(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('@App/Class_With_Named_Service15/index2.html.twig', ['someKey' => 'someValue']);
|
||||
}
|
||||
|
||||
public function index3Action(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('someFile.toBe.used');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
final class ClassWithAnonymousFunctionReturnController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template("items_template")
|
||||
*/
|
||||
public function indexAction($items)
|
||||
{
|
||||
$filteredItems = array_filter($items, function ($items) {
|
||||
return count($items) > 0;
|
||||
});
|
||||
|
||||
return compact('items');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
final class ClassWithAnonymousFunctionReturnController extends AbstractController
|
||||
{
|
||||
public function indexAction($items): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$filteredItems = array_filter($items, function ($items) {
|
||||
return count($items) > 0;
|
||||
});
|
||||
|
||||
return $this->render('items_template', ['items' => $items]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\TemplateAnnotationToThisRenderRector\Fixture;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
final class CompactController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template()
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$hello = 'hi';
|
||||
$world = 'earth';
|
||||
|
||||
return compact('hello', 'world');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\TemplateAnnotationToThisRenderRector\Fixture;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
final class CompactController extends AbstractController
|
||||
{
|
||||
public function index(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
$hello = 'hi';
|
||||
$world = 'earth';
|
||||
|
||||
return $this->render('index.html.twig', ['hello' => $hello, 'world' => $world]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class EmptyBodyController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class EmptyBodyController extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('@App/Empty_Body/index.html.twig');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,65 +0,0 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class ClassWithNamedService35Controller extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
if(true){
|
||||
return $this->redirectToRoute('rector_is_cool');
|
||||
}
|
||||
|
||||
return array(
|
||||
'form' => $form->createView()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Template()
|
||||
*/
|
||||
public function index2Action()
|
||||
{
|
||||
return $this->render('AppBundle:NameNotFollowingConvention:index.html.twig', array(
|
||||
'form' => $form->createView()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class ClassWithNamedService35Controller extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
if(true){
|
||||
return $this->redirectToRoute('rector_is_cool');
|
||||
}
|
||||
|
||||
return $this->render('@App/Class_With_Named_Service35/index.html.twig', array(
|
||||
'form' => $form->createView()
|
||||
));
|
||||
}
|
||||
|
||||
public function index2Action(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('AppBundle:NameNotFollowingConvention:index.html.twig', array(
|
||||
'form' => $form->createView()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class ClassWithNamedService55Controller extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template()
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class ClassWithNamedService55Controller extends AbstractController
|
||||
{
|
||||
public function index(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('Class_With_Named_Service55/index.html.twig');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,60 +0,0 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Throwable;
|
||||
|
||||
class ClassIfElseArrayController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
if (mt_rand(0, 100)) {
|
||||
return [
|
||||
'key' => 'value'
|
||||
];
|
||||
} elseif (mt_rand(0, 200)) {
|
||||
return [
|
||||
'key' => 'value2'
|
||||
];
|
||||
} else {
|
||||
return new RedirectResponse('here');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Throwable;
|
||||
|
||||
class ClassIfElseArrayController extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
if (mt_rand(0, 100)) {
|
||||
return $this->render('@App/Class_If_Else_Array/index.html.twig', [
|
||||
'key' => 'value'
|
||||
]);
|
||||
} elseif (mt_rand(0, 200)) {
|
||||
return $this->render('@App/Class_If_Else_Array/index.html.twig', [
|
||||
'key' => 'value2'
|
||||
]);
|
||||
} else {
|
||||
return new RedirectResponse('here');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,58 +0,0 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
final class ClassWithNestedArrayController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template("with_some_template.twig")
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return $this->handleStuff();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function handleStuff()
|
||||
{
|
||||
return [
|
||||
'hello' => 'world'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
final class ClassWithNestedArrayController extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('with_some_template.twig', $this->handleStuff());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function handleStuff()
|
||||
{
|
||||
return [
|
||||
'hello' => 'world'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class ClassWithNamedService45Controller extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template("AdminBundle:Payment:create.html.twig")
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return $this->render('payment/new.html.twig', array(
|
||||
'form' => $form->createView(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class ClassWithNamedService45Controller extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('payment/new.html.twig', array(
|
||||
'form' => $form->createView(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class RemoveTemplateAnnotatoinController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return new Response('...');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class RemoveTemplateAnnotatoinController extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return new Response('...');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,36 +0,0 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
final class RemoveEmptyTemplateWithThisRenderController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
return $this->render('AppBundle:ClassWithNamedService25:index.html.twig');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
final class RemoveEmptyTemplateWithThisRenderController extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('AppBundle:ClassWithNamedService25:index.html.twig');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
class ReturnResponseController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
if ($response = $this->createResponse()) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
return new RedirectResponse('...');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RedirectResponse|null
|
||||
*/
|
||||
private function createResponse()
|
||||
{
|
||||
if (mt_rand(0, 100)) {
|
||||
return new RedirectResponse('...');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
class ReturnResponseController extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
if ($response = $this->createResponse()) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
return new RedirectResponse('...');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RedirectResponse|null
|
||||
*/
|
||||
private function createResponse()
|
||||
{
|
||||
if (mt_rand(0, 100)) {
|
||||
return new RedirectResponse('...');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\TemplateAnnotationToThisRenderRector\Fixture;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
final class SkipOnlyRemoveController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template()
|
||||
*/
|
||||
public function index($value)
|
||||
{
|
||||
return $this->createWhatever($value);
|
||||
}
|
||||
|
||||
private function createWhatever($value)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class WithoutBaseClassAndTemplate
|
||||
{
|
||||
/**
|
||||
* @Route("/route", name="route")
|
||||
*/
|
||||
public function index(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Throwable;
|
||||
|
||||
class ClassTryCatchArrayResponseController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template()
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
try {
|
||||
return [
|
||||
'key' => 'value'
|
||||
];
|
||||
} catch (Throwable $throwable) {
|
||||
return new RedirectResponse('here');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php declare (strict_types=1);
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Throwable;
|
||||
|
||||
class ClassTryCatchArrayResponseController extends AbstractController
|
||||
{
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
try {
|
||||
return $this->render('@App/Class_Try_Catch_Array_Response/index.html.twig', [
|
||||
'key' => 'value'
|
||||
]);
|
||||
} catch (Throwable $throwable) {
|
||||
return new RedirectResponse('here');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class WithOnlyVarsController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template(vars={"post"})
|
||||
*/
|
||||
public function index(Post $post)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class WithOnlyVarsController extends AbstractController
|
||||
{
|
||||
public function index(Post $post): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('With_Only_Vars/index.html.twig', ['post' => $post]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,90 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class ClassWithReturnTypes extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template("AppBundle:Module:index.html.twig")
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function indexAction(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @Template("AppBundle:Module:index2.html.twig")
|
||||
*
|
||||
* @return array|Response
|
||||
*/
|
||||
public function index2Action()
|
||||
{
|
||||
if (true) {
|
||||
return $this->redirectToRoute('index');
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @Template("AppBundle:Module:index3.html.twig")
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index3Action(): Response
|
||||
{
|
||||
return $this->render('AppBundle:Module:index3.html.twig');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace AppBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class ClassWithReturnTypes extends AbstractController
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function indexAction(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('AppBundle:Module:index.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function index2Action(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
if (true) {
|
||||
return $this->redirectToRoute('index');
|
||||
}
|
||||
|
||||
return $this->render('AppBundle:Module:index2.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index3Action(): Response
|
||||
{
|
||||
return $this->render('AppBundle:Module:index3.html.twig');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class WithRouteOptions extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route("/{category}", name="report_overview", defaults={"category"=null}, requirements={"category"="[a-z]\d+"})
|
||||
* @Template("PAPPReportBundle:Report:report_list.html.twig")
|
||||
*/
|
||||
public function index($category = null)
|
||||
{
|
||||
return [
|
||||
'category' => $category,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class WithRouteOptions extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route("/{category}", name="report_overview", defaults={"category"=null}, requirements={"category"="[a-z]\d+"})
|
||||
*/
|
||||
public function index($category = null): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('PAPPReportBundle:Report:report_list.html.twig', [
|
||||
'category' => $category,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class WithRouteToo extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route("/change", name="facility_change")
|
||||
* @Template("PAPPUserBundle:Facility:facility.html.twig")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class WithRouteToo extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route("/change", name="facility_change")
|
||||
*/
|
||||
public function index(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('PAPPUserBundle:Facility:facility.html.twig');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class WithVarsController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Template("@SensioBlog/post/show.html.twig", vars={"post"})
|
||||
*/
|
||||
public function index(Post $post): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class WithVarsController extends AbstractController
|
||||
{
|
||||
public function index(Post $post): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('@SensioBlog/post/show.html.twig', ['post' => $post]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class WithoutBaseClass
|
||||
{
|
||||
/**
|
||||
* @Route("/change", name="facility_change")
|
||||
* @Template("AppBundle:ClassWithNamedService25:index.html.twig")
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class WithoutBaseClass extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route("/change", name="facility_change")
|
||||
*/
|
||||
public function index(): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
return $this->render('AppBundle:ClassWithNamedService25:index.html.twig');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\TemplateAnnotationToThisRenderRector\Source;
|
||||
|
||||
final class ClassToBeCreated
|
||||
{
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\ClassMethod\TemplateAnnotationToThisRenderRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Symfony\Rector\ClassMethod\TemplateAnnotationToThisRenderRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class TemplateAnnotationToThisRenderRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function getRectorClass(): string
|
||||
{
|
||||
return TemplateAnnotationToThisRenderRector::class;
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\ChangeFileLoaderInExtensionAndKernelRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class ChangeFileLoaderInExtensionAndKernelRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function provideConfigFilePath(): string
|
||||
{
|
||||
return __DIR__ . '/config/configured_rule.php';
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\ChangeFileLoaderInExtensionAndKernelRector\Fixture;
|
||||
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
|
||||
final class SomeExtension extends Extension
|
||||
{
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new XmlFileLoader($container, new FileLocator());
|
||||
$loader->load(__DIR__ . '/../Resources/config/controller.xml');
|
||||
$loader->load(__DIR__ . '/../Resources/config/events.xml');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\ChangeFileLoaderInExtensionAndKernelRector\Fixture;
|
||||
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
|
||||
final class SomeExtension extends Extension
|
||||
{
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new \Symfony\Component\DependencyInjection\Loader\YamlFileLoader($container, new FileLocator());
|
||||
$loader->load(__DIR__ . '/../Resources/config/controller.yaml');
|
||||
$loader->load(__DIR__ . '/../Resources/config/events.yaml');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\ChangeFileLoaderInExtensionAndKernelRector\Fixture;
|
||||
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
final class KernelToo extends Kernel
|
||||
{
|
||||
public function registerContainerConfiguration(LoaderInterface $loader): void
|
||||
{
|
||||
$loader->load(__DIR__ . '/../../config/config.xml');
|
||||
}
|
||||
|
||||
public function registerBundles()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\ChangeFileLoaderInExtensionAndKernelRector\Fixture;
|
||||
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
final class KernelToo extends Kernel
|
||||
{
|
||||
public function registerContainerConfiguration(LoaderInterface $loader): void
|
||||
{
|
||||
$loader->load(__DIR__ . '/../../config/config.yaml');
|
||||
}
|
||||
|
||||
public function registerBundles()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\ChangeFileLoaderInExtensionAndKernelRector\Fixture;
|
||||
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
final class SkipAnotherExtyension extends Kernel
|
||||
{
|
||||
public function registerContainerConfiguration(LoaderInterface $loader): void
|
||||
{
|
||||
$loader->load(__DIR__ . '/../../config/config.php');
|
||||
}
|
||||
|
||||
public function registerBundles()
|
||||
{
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Symfony\Rector\Class_\ChangeFileLoaderInExtensionAndKernelRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(ChangeFileLoaderInExtensionAndKernelRector::class)
|
||||
->call('configure', [[
|
||||
ChangeFileLoaderInExtensionAndKernelRector::FROM => 'xml',
|
||||
ChangeFileLoaderInExtensionAndKernelRector::TO => 'yaml',
|
||||
]]);
|
||||
};
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector;
|
||||
|
||||
use Iterator;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
|
||||
final class EventListenerToEventSubscriberRectorTest extends AbstractRectorTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provideData()
|
||||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator<SmartFileInfo>
|
||||
*/
|
||||
public function provideData(): Iterator
|
||||
{
|
||||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
|
||||
}
|
||||
|
||||
protected function provideConfigFilePath(): string
|
||||
{
|
||||
return __DIR__ . '/config/config_with_parameter.php';
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture;
|
||||
|
||||
class MultipleMethods
|
||||
{
|
||||
public function callMe()
|
||||
{
|
||||
}
|
||||
|
||||
public function singles()
|
||||
{
|
||||
}
|
||||
|
||||
public function meToo()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture;
|
||||
|
||||
class MultipleMethodsEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
|
||||
{
|
||||
public function callMe()
|
||||
{
|
||||
}
|
||||
|
||||
public function singles()
|
||||
{
|
||||
}
|
||||
|
||||
public function meToo()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return ['single_event' => 'singles', 'multi_event' => ['callMe', 'meToo']];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture;
|
||||
|
||||
class MultipleListenersCalledOnce
|
||||
{
|
||||
public function singles()
|
||||
{
|
||||
}
|
||||
|
||||
public function second()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture;
|
||||
|
||||
class MultipleListenersCalledOnceEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
|
||||
{
|
||||
public function singles()
|
||||
{
|
||||
}
|
||||
|
||||
public function second()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return ['single_event' => 'singles', 'single_second_event' => 'second'];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture;
|
||||
|
||||
class MultipleMethodsWithNonKernel
|
||||
{
|
||||
public function singles()
|
||||
{
|
||||
}
|
||||
|
||||
public function unknownMethod()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture;
|
||||
|
||||
class MultipleMethodsWithNonKernelEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
|
||||
{
|
||||
public function singles()
|
||||
{
|
||||
}
|
||||
|
||||
public function unknownMethod()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return ['single_event' => 'singles'];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture;
|
||||
|
||||
class SomeListener
|
||||
{
|
||||
public function methodToBeCalled()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture;
|
||||
|
||||
class SomeEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
|
||||
{
|
||||
public function methodToBeCalled()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return ['some_event' => 'methodToBeCalled'];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture;
|
||||
|
||||
class WithPriorityListener
|
||||
{
|
||||
public function callMe()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture;
|
||||
|
||||
class WithPriorityEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
|
||||
{
|
||||
public function callMe()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return ['some_event' => ['callMe', 1540]];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Symfony\Rector\Class_\EventListenerToEventSubscriberRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
// wtf: all test have to be in single file due to autoloading race-condigition and container creating issue of fixture
|
||||
$parameters->set(Option::SYMFONY_CONTAINER_XML_PATH_PARAMETER, __DIR__ . '/listener_services.xml');
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(EventListenerToEventSubscriberRector::class);
|
||||
};
|
@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
<services>
|
||||
<service id="first_listener" class="Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture\SomeListener">
|
||||
<tag name="kernel.event_listener" event="some_event" method="methodToBeCalled"/>
|
||||
</service>
|
||||
|
||||
<service id="second_listener" class="Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture\WithPriorityListener">
|
||||
<tag name="kernel.event_listener" event="some_event" method="callMe" priority="1540" />
|
||||
</service>
|
||||
|
||||
<service id="third_listener" class="Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture\MultipleMethods">
|
||||
<tag name="kernel.event_listener" event="single_event" method="singles"/>
|
||||
<tag name="kernel.event_listener" event="multi_event" method="callMe"/>
|
||||
<tag name="kernel.event_listener" event="multi_event" method="meToo"/>
|
||||
</service>
|
||||
|
||||
<service id="fourth_listener" class="Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture\MultipleListenersCalledOnce">
|
||||
<tag name="kernel.event_listener" event="single_event" method="singles"/>
|
||||
<tag name="kernel.event_listener" event="single_second_event" method="second"/>
|
||||
</service>
|
||||
|
||||
<service id="fifth_listener" class="Rector\Tests\Symfony\Rector\Class_\EventListenerToEventSubscriberRector\Fixture\MultipleMethodsWithNonKernel">
|
||||
<tag name="another_listener" event="unknown_event" method="unknownMethod"/>
|
||||
<tag name="kernel.event_listener" event="single_event" method="singles"/>
|
||||
</service>
|
||||
|
||||
<service id="event_dispatcher" class="Symfony\Component\EventDispatcher\EventDispatcher"/>
|
||||
</services>
|
||||
</container>
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\MakeCommandLazyRector\Fixture;
|
||||
|
||||
class ConstantDefinedName extends \Symfony\Component\Console\Command\Command
|
||||
{
|
||||
private const COMMAND_NAME = 'regge';
|
||||
|
||||
public function configure()
|
||||
{
|
||||
$this->setName(self::COMMAND_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\MakeCommandLazyRector\Fixture;
|
||||
|
||||
class ConstantDefinedName extends \Symfony\Component\Console\Command\Command
|
||||
{
|
||||
protected static $defaultName = self::COMMAND_NAME;
|
||||
private const COMMAND_NAME = 'regge';
|
||||
|
||||
public function configure()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\MakeCommandLazyRector\Fixture;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class SunshineCommand extends \Symfony\Component\Console\Command\Command
|
||||
{
|
||||
public function configure()
|
||||
{
|
||||
$this->setName('sunshine');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$input->setName('trap');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\MakeCommandLazyRector\Fixture;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class SunshineCommand extends \Symfony\Component\Console\Command\Command
|
||||
{
|
||||
protected static $defaultName = 'sunshine';
|
||||
public function configure()
|
||||
{
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$input->setName('trap');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\MakeCommandLazyRector\Fixture;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
||||
final class InConstructCommand extends Command
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('moonshine');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\Symfony\Rector\Class_\MakeCommandLazyRector\Fixture;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
||||
final class InConstructCommand extends Command
|
||||
{
|
||||
protected static $defaultName = 'moonshine';
|
||||
}
|
||||
|
||||
?>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user