make use of TwigSetList (#5917)

This commit is contained in:
Tomas Votruba 2021-03-20 03:03:02 +01:00 committed by GitHub
parent 57cf573e69
commit 8b1d88926e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 69 additions and 700 deletions

View File

@ -1,19 +0,0 @@
<?php
declare(strict_types=1);
use Rector\CodingStyle\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector;
use Rector\PHPUnit\Rector\Class_\AddSeeTestAnnotationRector;
use Rector\PHPUnit\Rector\Class_\ConstructClassMethodToSetUpTestCaseRector;
use Rector\PHPUnit\Rector\MethodCall\AssertSameTrueFalseToAssertTrueFalseRector;
use Rector\PHPUnit\Rector\MethodCall\RemoveExpectAnyFromMockRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RemoveExpectAnyFromMockRector::class);
$services->set(AddSeeTestAnnotationRector::class);
$services->set(ReturnArrayClassMethodToYieldRector::class);
$services->set(ConstructClassMethodToSetUpTestCaseRector::class);
$services->set(AssertSameTrueFalseToAssertTrueFalseRector::class);
};

View File

@ -1,27 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPUnit\Rector\ClassMethod\ExceptionAnnotationRector;
use Rector\PHPUnit\Rector\MethodCall\DelegateExceptionArgumentsRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
# handles 2nd and 3rd argument of setExpectedException
$services->set(DelegateExceptionArgumentsRector::class);
$services->set(ExceptionAnnotationRector::class);
$services->set(RenameMethodRector::class)
->call('configure', [[
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
new MethodCallRename('PHPUnit\Framework\TestClass', 'setExpectedException', 'expectedException'),
new MethodCallRename('PHPUnit\Framework\TestClass', 'setExpectedExceptionRegExp', 'expectedException'),
]),
]]);
};

View File

@ -1,12 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPUnit\Rector\MethodCall\UseSpecificWillMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(UseSpecificWillMethodRector::class);
};

View File

@ -1,45 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPUnit\Rector\Foreach_\SimplifyForeachInstanceOfRector;
use Rector\PHPUnit\Rector\MethodCall\AssertCompareToSpecificMethodRector;
use Rector\PHPUnit\Rector\MethodCall\AssertComparisonToSpecificMethodRector;
use Rector\PHPUnit\Rector\MethodCall\AssertFalseStrposToContainsRector;
use Rector\PHPUnit\Rector\MethodCall\AssertInstanceOfComparisonRector;
use Rector\PHPUnit\Rector\MethodCall\AssertIssetToSpecificMethodRector;
use Rector\PHPUnit\Rector\MethodCall\AssertNotOperatorRector;
use Rector\PHPUnit\Rector\MethodCall\AssertPropertyExistsRector;
use Rector\PHPUnit\Rector\MethodCall\AssertRegExpRector;
use Rector\PHPUnit\Rector\MethodCall\AssertSameBoolNullToSpecificMethodRector;
use Rector\PHPUnit\Rector\MethodCall\AssertTrueFalseInternalTypeToSpecificMethodRector;
use Rector\PHPUnit\Rector\MethodCall\AssertTrueFalseToSpecificMethodRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(AssertNotOperatorRector::class);
$services->set(AssertComparisonToSpecificMethodRector::class);
$services->set(AssertTrueFalseToSpecificMethodRector::class);
$services->set(AssertSameBoolNullToSpecificMethodRector::class);
$services->set(AssertFalseStrposToContainsRector::class);
$services->set(AssertTrueFalseInternalTypeToSpecificMethodRector::class);
$services->set(AssertCompareToSpecificMethodRector::class);
$services->set(AssertIssetToSpecificMethodRector::class);
$services->set(AssertInstanceOfComparisonRector::class);
$services->set(AssertPropertyExistsRector::class);
$services->set(AssertRegExpRector::class);
$services->set(SimplifyForeachInstanceOfRector::class);
};

View File

@ -1,20 +0,0 @@
<?php
declare(strict_types=1);
use Rector\CodingStyle\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector;
use Rector\CodingStyle\ValueObject\ReturnArrayClassMethodToYield;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ReturnArrayClassMethodToYieldRector::class)
->call('configure', [[
ReturnArrayClassMethodToYieldRector::METHODS_TO_YIELDS => ValueObjectInliner::inline([
new ReturnArrayClassMethodToYield('PHPUnit\Framework\TestCase', 'provide*'),
new ReturnArrayClassMethodToYield('PHPUnit\Framework\TestCase', 'dataProvider*'),
]),
]]);
};

View File

@ -1,24 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameMethodRector::class)
->call('configure', [[
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
new MethodCallRename(
'PHPUnit_Framework_MockObject_MockObject',
# see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/137
'staticExpects',
'expects'
),
]),
]]);
};

View File

@ -1,12 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPUnit\Rector\StaticCall\GetMockRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(GetMockRector::class);
};

View File

@ -1,59 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPUnit\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector;
use Rector\PHPUnit\Rector\MethodCall\GetMockBuilderGetMockToCreateMockRector;
use Rector\Renaming\Rector\FileWithoutNamespace\PseudoNamespaceToNamespaceRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use Rector\Renaming\ValueObject\PseudoNamespaceToNamespace;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/phpunit-exception.php');
$services = $containerConfigurator->services();
$services->set(RenameMethodRector::class)
->call('configure', [[
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
new MethodCallRename('PHPUnit\Framework\TestCase', 'createMockBuilder', 'getMockBuilder'),
]),
]]);
$services->set(RenameClassRector::class)
->call('configure', [[
RenameClassRector::OLD_TO_NEW_CLASSES => [
'PHPUnit_Framework_MockObject_Stub' => 'PHPUnit\Framework\MockObject\Stub',
'PHPUnit_Framework_MockObject_Stub_Return' => 'PHPUnit\Framework\MockObject\Stub\ReturnStub',
'PHPUnit_Framework_MockObject_Matcher_Parameters' => 'PHPUnit\Framework\MockObject\Matcher\Parameters',
'PHPUnit_Framework_MockObject_Matcher_Invocation' => 'PHPUnit\Framework\MockObject\Matcher\Invocation',
'PHPUnit_Framework_MockObject_MockObject' => 'PHPUnit\Framework\MockObject\MockObject',
'PHPUnit_Framework_MockObject_Invocation_Object' => 'PHPUnit\Framework\MockObject\Invocation\ObjectInvocation',
],
]]);
$services->set(PseudoNamespaceToNamespaceRector::class)
->call('configure', [[
// ref. https://github.com/sebastianbergmann/phpunit/compare/5.7.9...6.0.0
PseudoNamespaceToNamespaceRector::NAMESPACE_PREFIXES_WITH_EXCLUDED_CLASSES => ValueObjectInliner::inline(
[
new PseudoNamespaceToNamespace('PHPUnit_', [
'PHPUnit_Framework_MockObject_MockObject',
'PHPUnit_Framework_MockObject_Invocation_Object',
'PHPUnit_Framework_MockObject_Matcher_Invocation',
'PHPUnit_Framework_MockObject_Matcher_Parameters',
'PHPUnit_Framework_MockObject_Stub_Return',
'PHPUnit_Framework_MockObject_Stub',
]),
]
),
]]);
$services->set(AddDoesNotPerformAssertionToNonAssertingTestRector::class);
$services->set(GetMockBuilderGetMockToCreateMockRector::class);
};

View File

@ -1,24 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPUnit\Rector\Class_\RemoveDataProviderTestPrefixRector;
use Rector\Renaming\Rector\ClassMethod\RenameAnnotationRector;
use Rector\Renaming\ValueObject\RenameAnnotation;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/phpunit-exception.php');
$services = $containerConfigurator->services();
$services->set(RenameAnnotationRector::class)
->call('configure', [[
RenameAnnotationRector::RENAMED_ANNOTATIONS_IN_TYPES => ValueObjectInliner::inline([
new RenameAnnotation('PHPUnit\Framework\TestCase', 'scenario', 'test'),
]),
]]);
$services->set(RemoveDataProviderTestPrefixRector::class);
};

View File

@ -1,12 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPUnit\Rector\MethodCall\WithConsecutiveArgToArrayRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(WithConsecutiveArgToArrayRector::class);
};

View File

@ -1,12 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPUnit\Rector\MethodCall\ReplaceAssertArraySubsetWithDmsPolyfillRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ReplaceAssertArraySubsetWithDmsPolyfillRector::class);
};

View File

@ -1,61 +0,0 @@
<?php
declare(strict_types=1);
use PHPStan\Type\MixedType;
use PHPStan\Type\VoidType;
use Rector\Core\ValueObject\MethodName;
use Rector\PHPUnit\Rector\MethodCall\AssertEqualsParameterToSpecificMethodsTypeRector;
use Rector\PHPUnit\Rector\MethodCall\ReplaceAssertArraySubsetWithDmsPolyfillRector;
use Rector\PHPUnit\Rector\MethodCall\SpecificAssertContainsRector;
use Rector\PHPUnit\Rector\MethodCall\SpecificAssertInternalTypeRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
use Rector\TypeDeclaration\ValueObject\AddParamTypeDeclaration;
use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/phpunit-exception.php');
$services = $containerConfigurator->services();
$services->set(AddParamTypeDeclarationRector::class)
->call('configure', [[
AddParamTypeDeclarationRector::PARAMETER_TYPEHINTS => ValueObjectInliner::inline([
// https://github.com/rectorphp/rector/issues/1024 - no type, $dataName
new AddParamTypeDeclaration('PHPUnit\Framework\TestCase', MethodName::CONSTRUCT, 2, new MixedType()),
]),
]]);
$services->set(SpecificAssertContainsRector::class);
$services->set(SpecificAssertInternalTypeRector::class);
$services->set(RenameClassRector::class)
->call('configure', [[
RenameClassRector::OLD_TO_NEW_CLASSES => [
# https://github.com/sebastianbergmann/phpunit/issues/3123
'PHPUnit_Framework_MockObject_MockObject' => 'PHPUnit\Framework\MockObject\MockObject',
],
]]);
$services->set(AssertEqualsParameterToSpecificMethodsTypeRector::class);
$services->set(AddReturnTypeDeclarationRector::class)
->call('configure', [[
AddReturnTypeDeclarationRector::METHOD_RETURN_TYPES => ValueObjectInliner::inline([
new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'setUpBeforeClass', new VoidType()),
new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'setUp', new VoidType()),
new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'assertPreConditions', new VoidType()),
new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'assertPostConditions', new VoidType()),
new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'tearDown', new VoidType()),
new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'tearDownAfterClass', new VoidType()),
new AddReturnTypeDeclaration('PHPUnit\Framework\TestCase', 'onNotSuccessfulTest', new VoidType()),
]),
]]);
$services->set(ReplaceAssertArraySubsetWithDmsPolyfillRector::class);
};

View File

@ -1,34 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPUnit\Rector\Class_\TestListenerToHooksRector;
use Rector\PHPUnit\Rector\MethodCall\ExplicitPhpErrorApiRector;
use Rector\PHPUnit\Rector\MethodCall\SpecificAssertContainsWithoutIdentityRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(TestListenerToHooksRector::class);
$services->set(ExplicitPhpErrorApiRector::class);
$services->set(SpecificAssertContainsWithoutIdentityRector::class);
$services->set(RenameMethodRector::class)
->call('configure', [[
// see https://github.com/sebastianbergmann/phpunit/issues/3957
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
new MethodCallRename(
'PHPUnit\Framework\TestCase',
'expectExceptionMessageRegExp',
'expectExceptionMessageMatches'
),
new MethodCallRename('PHPUnit\Framework\TestCase', 'assertRegExp', 'assertMatchesRegularExpression'),
]),
]]);
};

View File

@ -1,22 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPUnit\Rector\Class_\AddProphecyTraitRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(AddProphecyTraitRector::class);
$services->set(RenameMethodRector::class)
->call('configure', [[
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
new MethodCallRename('PHPUnit\Framework\TestCase', 'assertFileNotExists', 'assertFileDoesNotExist'),
]),
]]);
};

View File

@ -1,18 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\Name\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->call('configure', [[
RenameClassRector::OLD_TO_NEW_CLASSES => [
# swiftmailer 60
'Swift_Mime_Message' => 'Swift_Mime_SimpleMessage',
],
]]);
};

View File

@ -1,178 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\FileWithoutNamespace\PseudoNamespaceToNamespaceRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Renaming\ValueObject\PseudoNamespaceToNamespace;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->call('configure', [[
RenameClassRector::OLD_TO_NEW_CLASSES => [
'Twig_LoaderInterface' => 'Twig\Loader\LoaderInterface',
'Twig_Extension_StringLoader' => 'Twig\Extension\StringLoaderExtension',
'Twig_Extension_Optimizer' => 'Twig\Extension\OptimizerExtension',
'Twig_Extension_Debug' => 'Twig\Extension\DebugExtension',
'Twig_Extension_Sandbox' => 'Twig\Extension\SandboxExtension',
'Twig_Extension_Profiler' => 'Twig\Extension\ProfilerExtension',
'Twig_Extension_Escaper' => 'Twig\Extension\EscaperExtension',
'Twig_Extension_Staging' => 'Twig\Extension\StagingExtension',
'Twig_Extension_Core' => 'Twig\Extension\CoreExtension',
'Twig_Node' => 'Twig\Node\Node',
'Twig_NodeVisitor_Optimizer' => 'Twig\NodeVisitor\OptimizerNodeVisitor',
'Twig_NodeVisitor_SafeAnalysis' => 'Twig\NodeVisitor\SafeAnalysisNodeVisitor',
'Twig_NodeVisitor_Sandbox' => 'Twig\NodeVisitor\SandboxNodeVisitor',
'Twig_NodeVisitor_Escaper' => 'Twig\NodeVisitor\EscaperNodeVisitor',
'Twig_SimpleFunction' => 'Twig\TwigFunction',
'Twig_Function' => 'Twig\TwigFunction',
'Twig_Error_Syntax' => 'Twig\Error\SyntaxError',
'Twig_Error_Loader' => 'Twig\Error\LoaderError',
'Twig_Error_Runtime' => 'Twig\Error\RuntimeError',
'Twig_TokenParser' => 'Twig\TokenParser\AbstractTokenParser',
'Twig_TokenParserInterface' => 'Twig\TokenParser\TokenParserInterface',
'Twig_CacheInterface' => 'Twig\Cache\CacheInterface',
'Twig_NodeVisitorInterface' => 'Twig\NodeVisitor\NodeVisitorInterface',
'Twig_Profiler_NodeVisitor_Profiler' => 'Twig\Profiler\NodeVisitor\ProfilerNodeVisitor',
'Twig_Profiler_Dumper_Text' => 'Twig\Profiler\Dumper\TextDumper',
'Twig_Profiler_Dumper_Base' => 'Twig\Profiler\Dumper\BaseDumper',
'Twig_Profiler_Dumper_Blackfire' => 'Twig\Profiler\Dumper\BlackfireDumper',
'Twig_Profiler_Dumper_Html' => 'Twig\Profiler\Dumper\HtmlDumper',
'Twig_Profiler_Node_LeaveProfile' => 'Twig\Profiler\Node\LeaveProfileNode',
'Twig_Profiler_Node_EnterProfile' => 'Twig\Profiler\Node\EnterProfileNode',
'Twig_Error' => 'Twig\Error\Error',
'Twig_ExistsLoaderInterface' => 'Twig\Loader\ExistsLoaderInterface',
'Twig_SimpleTest' => 'Twig\TwigTest',
'Twig_Test' => 'Twig\TwigTest',
'Twig_FactoryRuntimeLoader' => 'Twig\RuntimeLoader\FactoryRuntimeLoader',
'Twig_NodeOutputInterface' => 'Twig\Node\NodeOutputInterface',
'Twig_SimpleFilter' => 'Twig\TwigFilter',
'Twig_Filter' => 'Twig\TwigFilter',
'Twig_Loader_Chain' => 'Twig\Loader\ChainLoader',
'Twig_Loader_Array' => 'Twig\Loader\ArrayLoader',
'Twig_Loader_Filesystem' => 'Twig\Loader\FilesystemLoader',
'Twig_Cache_Null' => 'Twig\Cache\NullCache',
'Twig_Cache_Filesystem' => 'Twig\Cache\FilesystemCache',
'Twig_NodeCaptureInterface' => 'Twig\Node\NodeCaptureInterface',
'Twig_Extension' => 'Twig\Extension\AbstractExtension',
'Twig_TokenParser_Macro' => 'Twig\TokenParser\MacroTokenParser',
'Twig_TokenParser_Embed' => 'Twig\TokenParser\EmbedTokenParser',
'Twig_TokenParser_Do' => 'Twig\TokenParser\DoTokenParser',
'Twig_TokenParser_From' => 'Twig\TokenParser\FromTokenParser',
'Twig_TokenParser_Extends' => 'Twig\TokenParser\ExtendsTokenParser',
'Twig_TokenParser_Set' => 'Twig\TokenParser\SetTokenParser',
'Twig_TokenParser_Sandbox' => 'Twig\TokenParser\SandboxTokenParser',
'Twig_TokenParser_AutoEscape' => 'Twig\TokenParser\AutoEscapeTokenParser',
'Twig_TokenParser_With' => 'Twig\TokenParser\WithTokenParser',
'Twig_TokenParser_Include' => 'Twig\TokenParser\IncludeTokenParser',
'Twig_TokenParser_Block' => 'Twig\TokenParser\BlockTokenParser',
'Twig_TokenParser_Filter' => 'Twig\TokenParser\FilterTokenParser',
'Twig_TokenParser_If' => 'Twig\TokenParser\IfTokenParser',
'Twig_TokenParser_For' => 'Twig\TokenParser\ForTokenParser',
'Twig_TokenParser_Flush' => 'Twig\TokenParser\FlushTokenParser',
'Twig_TokenParser_Spaceless' => 'Twig\TokenParser\SpacelessTokenParser',
'Twig_TokenParser_Use' => 'Twig\TokenParser\UseTokenParser',
'Twig_TokenParser_Import' => 'Twig\TokenParser\ImportTokenParser',
'Twig_ContainerRuntimeLoader' => 'Twig\RuntimeLoader\ContainerRuntimeLoader',
'Twig_SourceContextLoaderInterface' => 'Twig\Loader\SourceContextLoaderInterface',
'Twig_NodeTraverser' => 'Twig\NodeTraverser',
'Twig_ExtensionInterface' => 'Twig\Extension\ExtensionInterface',
'Twig_Node_Macro' => 'Twig\Node\MacroNode',
'Twig_Node_Embed' => 'Twig\Node\EmbedNode',
'Twig_Node_Do' => 'Twig\Node\DoNode',
'Twig_Node_Text' => 'Twig\Node\TextNode',
'Twig_Node_Set' => 'Twig\Node\SetNode',
'Twig_Node_Sandbox' => 'Twig\Node\SandboxNode',
'Twig_Node_AutoEscape' => 'Twig\Node\AutoEscapeNode',
'Twig_Node_With' => 'Twig\Node\WithNode',
'Twig_Node_Include' => 'Twig\Node\IncludeNode',
'Twig_Node_Print' => 'Twig\Node\PrintNode',
'Twig_Node_Block' => 'Twig\Node\BlockNode',
'Twig_Node_Expression_MethodCall' => 'Twig\Node\Expression\MethodCallExpression',
'Twig_Node_Expression_Unary_Pos' => 'Twig\Node\Expression\Unary\PosUnary',
'Twig_Node_Expression_Unary_Not' => 'Twig\Node\Expression\Unary\NotUnary',
'Twig_Node_Expression_Unary_Neg' => 'Twig\Node\Expression\Unary\NegUnary',
'Twig_Node_Expression_GetAttr' => 'Twig\Node\Expression\GetAttrExpression',
'Twig_Node_Expression_Function' => 'Twig\Node\Expression\FunctionExpression',
'Twig_Node_Expression_Binary_Power' => 'Twig\Node\Expression\Binary\PowerBinary',
'Twig_Node_Expression_Binary_In' => 'Twig\Node\Expression\Binary\InBinary',
'Twig_Node_Expression_Binary_BitwiseXor' => 'Twig\Node\Expression\Binary\BitwiseXorBinary',
'Twig_Node_Expression_Binary_Concat' => 'Twig\Node\Expression\Binary\ConcatBinary',
'Twig_Node_Expression_Binary_NotEqual' => 'Twig\Node\Expression\Binary\NotEqualBinary',
'Twig_Node_Expression_Binary_Less' => 'Twig\Node\Expression\Binary\LessBinary',
'Twig_Node_Expression_Binary_And' => 'Twig\Node\Expression\Binary\AndBinary',
'Twig_Node_Expression_Binary_GreaterEqual' => 'Twig\Node\Expression\Binary\GreaterEqualBinary',
'Twig_Node_Expression_Binary_Mod' => 'Twig\Node\Expression\Binary\ModBinary',
'Twig_Node_Expression_Binary_NotIn' => 'Twig\Node\Expression\Binary\NotInBinary',
'Twig_Node_Expression_Binary_Add' => 'Twig\Node\Expression\Binary\AddBinary',
'Twig_Node_Expression_Binary_Matches' => 'Twig\Node\Expression\Binary\MatchesBinary',
'Twig_Node_Expression_Binary_EndsWith' => 'Twig\Node\Expression\Binary\EndsWithBinary',
'Twig_Node_Expression_Binary_FloorDiv' => 'Twig\Node\Expression\Binary\FloorDivBinary',
'Twig_Node_Expression_Binary_StartsWith' => 'Twig\Node\Expression\Binary\StartsWithBinary',
'Twig_Node_Expression_Binary_LessEqual' => 'Twig\Node\Expression\Binary\LessEqualBinary',
'Twig_Node_Expression_Binary_Equal' => 'Twig\Node\Expression\Binary\EqualBinary',
'Twig_Node_Expression_Binary_BitwiseAnd' => 'Twig\Node\Expression\Binary\BitwiseAndBinary',
'Twig_Node_Expression_Binary_Mul' => 'Twig\Node\Expression\Binary\MulBinary',
'Twig_Node_Expression_Binary_Range' => 'Twig\Node\Expression\Binary\RangeBinary',
'Twig_Node_Expression_Binary_Or' => 'Twig\Node\Expression\Binary\OrBinary',
'Twig_Node_Expression_Binary_Greater' => 'Twig\Node\Expression\Binary\GreaterBinary',
'Twig_Node_Expression_Binary_Div' => 'Twig\Node\Expression\Binary\DivBinary',
'Twig_Node_Expression_Binary_BitwiseOr' => 'Twig\Node\Expression\Binary\BitwiseOrBinary',
'Twig_Node_Expression_Binary_Sub' => 'Twig\Node\Expression\Binary\SubBinary',
'Twig_Node_Expression_Test_Even' => 'Twig\Node\Expression\Test\EvenTest',
'Twig_Node_Expression_Test_Defined' => 'Twig\Node\Expression\Test\DefinedTest',
'Twig_Node_Expression_Test_Sameas' => 'Twig\Node\Expression\Test\SameasTest',
'Twig_Node_Expression_Test_Odd' => 'Twig\Node\Expression\Test\OddTest',
'Twig_Node_Expression_Test_Constant' => 'Twig\Node\Expression\Test\ConstantTest',
'Twig_Node_Expression_Test_Null' => 'Twig\Node\Expression\Test\NullTest',
'Twig_Node_Expression_Test_Divisibleby' => 'Twig\Node\Expression\Test\DivisiblebyTest',
'Twig_Node_Expression_Array' => 'Twig\Node\Expression\ArrayExpression',
'Twig_Node_Expression_Binary' => 'Twig\Node\Expression\Binary\AbstractBinary',
'Twig_Node_Expression_Constant' => 'Twig\Node\Expression\ConstantExpression',
'Twig_Node_Expression_Parent' => 'Twig\Node\Expression\ParentExpression',
'Twig_Node_Expression_Test' => 'Twig\Node\Expression\TestExpression',
'Twig_Node_Expression_Filter_Default' => 'Twig\Node\Expression\Filter\DefaultFilter',
'Twig_Node_Expression_Filter' => 'Twig\Node\Expression\FilterExpression',
'Twig_Node_Expression_BlockReference' => 'Twig\Node\Expression\BlockReferenceExpression',
'Twig_Node_Expression_NullCoalesce' => 'Twig\Node\Expression\NullCoalesceExpression',
'Twig_Node_Expression_Name' => 'Twig\Node\Expression\NameExpression',
'Twig_Node_Expression_TempName' => 'Twig\Node\Expression\TempNameExpression',
'Twig_Node_Expression_Call' => 'Twig\Node\Expression\CallExpression',
'Twig_Node_Expression_Unary' => 'Twig\Node\Expression\Unary\AbstractUnary',
'Twig_Node_Expression_AssignName' => 'Twig\Node\Expression\AssignNameExpression',
'Twig_Node_Expression_Conditional' => 'Twig\Node\Expression\ConditionalExpression',
'Twig_Node_CheckSecurity' => 'Twig\Node\CheckSecurityNode',
'Twig_Node_Expression' => 'Twig\Node\Expression\AbstractExpression',
'Twig_Node_ForLoop' => 'Twig\Node\ForLoopNode',
'Twig_Node_If' => 'Twig\Node\IfNode',
'Twig_Node_For' => 'Twig\Node\ForNode',
'Twig_Node_BlockReference' => 'Twig\Node\BlockReferenceNode',
'Twig_Node_Flush' => 'Twig\Node\FlushNode',
'Twig_Node_Body' => 'Twig\Node\BodyNode',
'Twig_Node_Spaceless' => 'Twig\Node\SpacelessNode',
'Twig_Node_Import' => 'Twig\Node\ImportNode',
'Twig_Node_SandboxedPrint' => 'Twig\Node\SandboxedPrintNode',
'Twig_Node_Module' => 'Twig\Node\ModuleNode',
'Twig_RuntimeLoaderInterface' => 'Twig\RuntimeLoader\RuntimeLoaderInterface',
'Twig_BaseNodeVisitor' => 'Twig\NodeVisitor\AbstractNodeVisitor',
'Twig_Extensions_Extension_Text' => 'Twig\Extensions\TextExtension',
'Twig_Extensions_Extension_Array' => 'Twig\Extensions\ArrayExtension',
'Twig_Extensions_Extension_Date' => 'Twig\Extensions\DateExtension',
'Twig_Extensions_Extension_I18n' => 'Twig\Extensions\I18nExtension',
'Twig_Extensions_Extension_Intl' => 'Twig\Extensions\IntlExtension',
'Twig_Extensions_TokenParser_Trans' => 'Twig\Extensions\TokenParser\TransTokenParser',
'Twig_Extensions_Node_Trans' => 'Twig\Extensions\Node\TransNode',
],
]]);
$services->set(PseudoNamespaceToNamespaceRector::class)
->call('configure', [[
PseudoNamespaceToNamespaceRector::NAMESPACE_PREFIXES_WITH_EXCLUDED_CLASSES => ValueObjectInliner::inline([
new PseudoNamespaceToNamespace('Twig_'),
]),
]]);
};

View File

@ -1,22 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\Name\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
# see https://stackoverflow.com/a/43495506/1348344
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->call('configure', [[
RenameClassRector::OLD_TO_NEW_CLASSES => [
'Twig_Function_Node' => 'Twig_SimpleFunction',
'Twig_Function' => 'Twig_SimpleFunction',
'Twig_Filter' => 'Twig_SimpleFilter',
'Twig_Test' => 'Twig_SimpleTest',
],
]]);
};

View File

@ -1,23 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameMethodRector::class)
->call('configure', [[
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
new MethodCallRename('Twig_Node', 'getLine', 'getTemplateLine'),
new MethodCallRename('Twig_Node', 'getFilename', 'getTemplateName'),
new MethodCallRename('Twig_Template', 'getSource', 'getSourceContext'),
new MethodCallRename('Twig_Error', 'getTemplateFile', 'getTemplateName'),
new MethodCallRename('Twig_Error', 'getTemplateName', 'setTemplateName'),
]),
]]);
};

View File

@ -1,12 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Symfony\Rector\Return_\SimpleFunctionAndFilterRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(SimpleFunctionAndFilterRector::class);
};

View File

@ -1,9 +0,0 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/twig-underscore-to-namespace.php');
};

View File

@ -1,24 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Renaming\Rector\Name\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RenameClassRector::class)
->call('configure', [[
RenameClassRector::OLD_TO_NEW_CLASSES => [
#filters
# see https://twig.symfony.com/doc/1.x/deprecated.html
'Twig_SimpleFilter' => 'Twig_Filter',
#functions
# see https://twig.symfony.com/doc/1.x/deprecated.html
'Twig_SimpleFunction' => 'Twig_Function',
# see https://github.com/bolt/bolt/pull/6596
'Twig_SimpleTest' => 'Twig_Test',
],
]]);
};

View File

@ -1,9 +0,0 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/twig-underscore-to-namespace.php');
};

View File

@ -5,9 +5,12 @@ declare(strict_types=1);
namespace Rector\Set\ValueObject;
use Rector\Laravel\Set\LaravelSetList;
use Rector\PHPUnit\Sets\PHPUnitSetList;
use Rector\Set\Contract\SetListInterface;
use Rector\Set\NetteSetList;
use Rector\Set\SwiftmailerSetList;
use Rector\Set\SymfonySetList;
use Rector\Set\TwigSetList;
final class SetList implements SetListInterface
{
@ -365,74 +368,102 @@ final class SetList implements SetListInterface
public const PHPSPEC_TO_PHPUNIT = __DIR__ . '/../../../config/set/phpspec-to-phpunit.php';
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT80_DMS = __DIR__ . '/../../../config/set/phpunit80-dms.php';
public const PHPUNIT80_DMS = PHPUnitSetList::PHPUNIT80_DMS;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_40 = __DIR__ . '/../../../config/set/phpunit40.php';
public const PHPUNIT_40 = PHPUnitSetList::PHPUNIT_40;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_50 = __DIR__ . '/../../../config/set/phpunit50.php';
public const PHPUNIT_50 = PHPUnitSetList::PHPUNIT_50;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_60 = __DIR__ . '/../../../config/set/phpunit60.php';
public const PHPUNIT_60 = PHPUnitSetList::PHPUNIT_60;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_70 = __DIR__ . '/../../../config/set/phpunit70.php';
public const PHPUNIT_70 = PHPUnitSetList::PHPUNIT_70;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_75 = __DIR__ . '/../../../config/set/phpunit75.php';
public const PHPUNIT_75 = PHPUnitSetList::PHPUNIT_75;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_80 = __DIR__ . '/../../../config/set/phpunit80.php';
public const PHPUNIT_80 = PHPUnitSetList::PHPUNIT_80;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_90 = __DIR__ . '/../../../config/set/phpunit90.php';
public const PHPUNIT_90 = PHPUnitSetList::PHPUNIT_90;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_91 = __DIR__ . '/../../../config/set/phpunit91.php';
public const PHPUNIT_91 = PHPUnitSetList::PHPUNIT_91;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_CODE_QUALITY = __DIR__ . '/../../../config/set/phpunit-code-quality.php';
public const PHPUNIT_CODE_QUALITY = PHPUnitSetList::PHPUNIT_CODE_QUALITY;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_EXCEPTION = __DIR__ . '/../../../config/set/phpunit-exception.php';
public const PHPUNIT_EXCEPTION = PHPUnitSetList::PHPUNIT_EXCEPTION;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_MOCK = __DIR__ . '/../../../config/set/phpunit-mock.php';
public const PHPUNIT_MOCK = PHPUnitSetList::PHPUNIT_MOCK;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_SPECIFIC_METHOD = __DIR__ . '/../../../config/set/phpunit-specific-method.php';
public const PHPUNIT_SPECIFIC_METHOD = PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD;
/**
* @deprecated
* @see Use PHPUnitSetList instead
* @var string
*/
public const PHPUNIT_YIELD_DATA_PROVIDER = __DIR__ . '/../../../config/set/phpunit-yield-data-provider.php';
public const PHPUNIT_YIELD_DATA_PROVIDER = PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER;
/**
* @var string
@ -505,9 +536,11 @@ final class SetList implements SetListInterface
public const SAFE_07 = __DIR__ . '/../../../config/set/safe07.php';
/**
* For BC layer
* @deprecated Use SwiftmailerSetList from rector/rector-symfony instead
* @var string
*/
public const SWIFTMAILER_60 = __DIR__ . '/../../../config/set/swiftmailer60.php';
public const SWIFTMAILER_60 = SwiftmailerSetList::SWIFTMAILER_60;
/**
* For BC layer
@ -629,39 +662,53 @@ final class SetList implements SetListInterface
public const SYMFONY_CONSTRUCTOR_INJECTION = SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION;
/**
* For BC layer
* @deprecated Use TwigSetList from rector/rector-symfony instead
* @var string
*/
public const TWIG_112 = __DIR__ . '/../../../config/set/twig112.php';
public const TWIG_112 = TwigSetList::TWIG_112;
/**
* For BC layer
* @deprecated Use TwigSetList from rector/rector-symfony instead
* @var string
*/
public const TWIG_127 = __DIR__ . '/../../../config/set/twig127.php';
public const TWIG_127 = TwigSetList::TWIG_127;
/**
* For BC layer
* @deprecated Use TwigSetList from rector/rector-symfony instead
* @var string
*/
public const TWIG_134 = __DIR__ . '/../../../config/set/twig134.php';
public const TWIG_134 = TwigSetList::TWIG_134;
/**
* For BC layer
* @deprecated Use TwigSetList from rector/rector-symfony instead
* @var string
*/
public const TWIG_140 = __DIR__ . '/../../../config/set/twig140.php';
public const TWIG_140 = TwigSetList::TWIG_140;
/**
* For BC layer
* @deprecated Use TwigSetList from rector/rector-symfony instead
* @var string
*/
public const TWIG_20 = __DIR__ . '/../../../config/set/twig20.php';
public const TWIG_20 = TwigSetList::TWIG_20;
/**
* For BC layer
* @deprecated Use TwigSetList from rector/rector-symfony instead
* @var string
*/
public const TWIG_240 = __DIR__ . '/../../../config/set/twig240.php';
public const TWIG_240 = TwigSetList::TWIG_240;
/**
* For BC layer
* @deprecated Use TwigSetList from rector/rector-symfony instead
* @var string
*/
public const TWIG_UNDERSCORE_TO_NAMESPACE = __DIR__ . '/../../../config/set/twig-underscore-to-namespace.php';
public const TWIG_UNDERSCORE_TO_NAMESPACE = TwigSetList::TWIG_UNDERSCORE_TO_NAMESPACE;
/**
* @var string