mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-19 06:52:51 +02:00
fix array indent
This commit is contained in:
parent
79696369c1
commit
661d2c8e54
@ -17,10 +17,14 @@ final class RenameAnnotationRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [RenameAnnotationRector::class => [
|
||||
'$classToAnnotationMap' => [
|
||||
'PHPUnit\Framework\TestCase' => ['scenario' => 'test'],
|
||||
return [
|
||||
RenameAnnotationRector::class => [
|
||||
'$classToAnnotationMap' => [
|
||||
'PHPUnit\Framework\TestCase' => [
|
||||
'scenario' => 'test',
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,10 @@ final class AnnotatedPropertyInjectToConstructorInjectionRectorTest extends Abst
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [AnnotatedPropertyInjectToConstructorInjectionRector::class => ['$annotation' => 'inject']];
|
||||
return [
|
||||
AnnotatedPropertyInjectToConstructorInjectionRector::class => [
|
||||
'$annotation' => 'inject',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,15 @@ final class NewObjectToFactoryCreateRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [NewObjectToFactoryCreateRector::class => [
|
||||
'$objectToFactoryMethod' => [
|
||||
MyClass::class => [
|
||||
'class' => MyClassFactory::class,
|
||||
'method' => 'create',
|
||||
], ],
|
||||
]];
|
||||
return [
|
||||
NewObjectToFactoryCreateRector::class => [
|
||||
'$objectToFactoryMethod' => [
|
||||
MyClass::class => [
|
||||
'class' => MyClassFactory::class,
|
||||
'method' => 'create',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -23,24 +23,26 @@ final class ArgumentAdderRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [ArgumentAdderRector::class => [
|
||||
'$positionWithDefaultValueByMethodNamesByClassTypes' => [
|
||||
SomeContainerBuilder::class => [
|
||||
'compile' => [
|
||||
0 => [
|
||||
'name' => 'isCompiled',
|
||||
'default_value' => false,
|
||||
return [
|
||||
ArgumentAdderRector::class => [
|
||||
'$positionWithDefaultValueByMethodNamesByClassTypes' => [
|
||||
SomeContainerBuilder::class => [
|
||||
'compile' => [
|
||||
0 => [
|
||||
'name' => 'isCompiled',
|
||||
'default_value' => false,
|
||||
],
|
||||
],
|
||||
],
|
||||
'addCompilerPass' => [
|
||||
2 => [
|
||||
'name' => 'priority',
|
||||
'default_value' => 0,
|
||||
'type' => 'int',
|
||||
'addCompilerPass' => [
|
||||
2 => [
|
||||
'name' => 'priority',
|
||||
'default_value' => 0,
|
||||
'type' => 'int',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -35,26 +35,30 @@ final class ArgumentDefaultValueReplacerRectorTest extends AbstractRectorTestCas
|
||||
],
|
||||
],
|
||||
'Symfony\Component\Yaml\Yaml' => [
|
||||
'parse' => [1 => [[
|
||||
'before' => ['false', 'false', 'true'],
|
||||
'after' => 'Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP',
|
||||
], [
|
||||
'before' => ['false', 'true'],
|
||||
'after' => 'Symfony\Component\Yaml\Yaml::PARSE_OBJECT',
|
||||
], [
|
||||
'before' => 'false',
|
||||
'after' => 0,
|
||||
], [
|
||||
'before' => 'true',
|
||||
'after' => 'Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE',
|
||||
]]],
|
||||
'dump' => [3 => [[
|
||||
'before' => ['false', 'true'],
|
||||
'after' => 'Symfony\Component\Yaml\Yaml::DUMP_OBJECT',
|
||||
], [
|
||||
'before' => 'true',
|
||||
'after' => 'Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE',
|
||||
]]],
|
||||
'parse' => [
|
||||
1 => [[
|
||||
'before' => ['false', 'false', 'true'],
|
||||
'after' => 'Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP',
|
||||
], [
|
||||
'before' => ['false', 'true'],
|
||||
'after' => 'Symfony\Component\Yaml\Yaml::PARSE_OBJECT',
|
||||
], [
|
||||
'before' => 'false',
|
||||
'after' => 0,
|
||||
], [
|
||||
'before' => 'true',
|
||||
'after' => 'Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE',
|
||||
]],
|
||||
],
|
||||
'dump' => [
|
||||
3 => [[
|
||||
'before' => ['false', 'true'],
|
||||
'after' => 'Symfony\Component\Yaml\Yaml::DUMP_OBJECT',
|
||||
], [
|
||||
'before' => 'true',
|
||||
'after' => 'Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE',
|
||||
]],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -19,11 +19,17 @@ final class PropertyAssignToMethodCallRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [PropertyAssignToMethodCallRector::class => [
|
||||
'$oldPropertiesToNewMethodCallsByType' => [
|
||||
ChoiceControl::class => ['checkAllowedValues' => 'checkDefaultValue'],
|
||||
MultiChoiceControl::class => ['checkAllowedValues' => 'checkDefaultValue'],
|
||||
return [
|
||||
PropertyAssignToMethodCallRector::class => [
|
||||
'$oldPropertiesToNewMethodCallsByType' => [
|
||||
ChoiceControl::class => [
|
||||
'checkAllowedValues' => 'checkDefaultValue',
|
||||
],
|
||||
MultiChoiceControl::class => [
|
||||
'checkAllowedValues' => 'checkDefaultValue',
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,10 @@ final class RemoveTraitRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [RemoveTraitRector::class => [
|
||||
'$traitsToRemove' => [TraitToBeRemoved::class],
|
||||
]];
|
||||
return [
|
||||
RemoveTraitRector::class => [
|
||||
'$traitsToRemove' => [TraitToBeRemoved::class],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,18 +18,20 @@ final class AddReturnTypeDeclarationRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [AddReturnTypeDeclarationRector::class => [
|
||||
'$typehintForMethodByClass' => [
|
||||
'Rector\Tests\Rector\Typehint\AddReturnTypeDeclarationRector\Fixture\SomeClass' => [
|
||||
'parse' => 'array',
|
||||
'resolve' => 'SomeType',
|
||||
'nullable' => '?SomeType',
|
||||
'clear' => '',
|
||||
],
|
||||
PHPUnitTestCase::class => [
|
||||
'tearDown' => 'void',
|
||||
return [
|
||||
AddReturnTypeDeclarationRector::class => [
|
||||
'$typehintForMethodByClass' => [
|
||||
'Rector\Tests\Rector\Typehint\AddReturnTypeDeclarationRector\Fixture\SomeClass' => [
|
||||
'parse' => 'array',
|
||||
'resolve' => 'SomeType',
|
||||
'nullable' => '?SomeType',
|
||||
'clear' => '',
|
||||
],
|
||||
PHPUnitTestCase::class => [
|
||||
'tearDown' => 'void',
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,14 @@ final class WrapReturnRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [WrapReturnRector::class => [
|
||||
'$typeToMethodToWrap' => [
|
||||
SomeReturnClass::class => [
|
||||
'getItem' => 'array',
|
||||
return [
|
||||
WrapReturnRector::class => [
|
||||
'$typeToMethodToWrap' => [
|
||||
SomeReturnClass::class => [
|
||||
'getItem' => 'array',
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -27,11 +27,13 @@ final class ParentClassToTraitsRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [ParentClassToTraitsRector::class => [
|
||||
'$parentClassToTraits' => [
|
||||
ParentObject::class => [SomeTrait::class],
|
||||
AnotherParentObject::class => [SomeTrait::class, SecondTrait::class],
|
||||
return [
|
||||
ParentClassToTraitsRector::class => [
|
||||
'$parentClassToTraits' => [
|
||||
ParentObject::class => [SomeTrait::class],
|
||||
AnotherParentObject::class => [SomeTrait::class, SecondTrait::class],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -50,23 +50,25 @@ final class RenameClassRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [RenameClassRector::class => [
|
||||
'oldToNewClasses' => [
|
||||
OldClass::class => NewClass::class,
|
||||
OldClassWithTypo::class => NewClassWithoutTypo::class,
|
||||
'DateTime' => 'DateTimeInterface',
|
||||
'Countable' => 'stdClass',
|
||||
Manual_Twig_Filter::class => TwigFilter::class,
|
||||
'Twig_AbstractManualExtension' => AbstractManualExtension::class,
|
||||
'Twig_Extension_Sandbox' => 'Twig\Extension\SandboxExtension',
|
||||
// Renaming class itself and its namespace
|
||||
'MyNamespace\MyClass' => 'MyNewNamespace\MyNewClass',
|
||||
'MyNamespace\MyTrait' => 'MyNewNamespace\MyNewTrait',
|
||||
'MyNamespace\MyInterface' => 'MyNewNamespace\MyNewInterface',
|
||||
'MyOldClass' => 'MyNamespace\MyNewClass',
|
||||
'AnotherMyOldClass' => 'AnotherMyNewClass',
|
||||
'MyNamespace\AnotherMyClass' => 'MyNewClassWithoutNamespace',
|
||||
return [
|
||||
RenameClassRector::class => [
|
||||
'oldToNewClasses' => [
|
||||
OldClass::class => NewClass::class,
|
||||
OldClassWithTypo::class => NewClassWithoutTypo::class,
|
||||
'DateTime' => 'DateTimeInterface',
|
||||
'Countable' => 'stdClass',
|
||||
Manual_Twig_Filter::class => TwigFilter::class,
|
||||
'Twig_AbstractManualExtension' => AbstractManualExtension::class,
|
||||
'Twig_Extension_Sandbox' => 'Twig\Extension\SandboxExtension',
|
||||
// Renaming class itself and its namespace
|
||||
'MyNamespace\MyClass' => 'MyNewNamespace\MyNewClass',
|
||||
'MyNamespace\MyTrait' => 'MyNewNamespace\MyNewTrait',
|
||||
'MyNamespace\MyInterface' => 'MyNewNamespace\MyNewInterface',
|
||||
'MyOldClass' => 'MyNamespace\MyNewClass',
|
||||
'AnotherMyOldClass' => 'AnotherMyNewClass',
|
||||
'MyNamespace\AnotherMyClass' => 'MyNewClassWithoutNamespace',
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -19,15 +19,17 @@ final class RenameClassConstantRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [RenameClassConstantRector::class => [
|
||||
'oldToNewConstantsByClass' => [
|
||||
LocalFormEvents::class => [
|
||||
'PRE_BIND' => 'PRE_SUBMIT',
|
||||
'BIND' => 'SUBMIT',
|
||||
'POST_BIND' => 'POST_SUBMIT',
|
||||
'OLD_CONSTANT' => DifferentClass::class . '::NEW_CONSTANT',
|
||||
return [
|
||||
RenameClassConstantRector::class => [
|
||||
'oldToNewConstantsByClass' => [
|
||||
LocalFormEvents::class => [
|
||||
'PRE_BIND' => 'PRE_SUBMIT',
|
||||
'BIND' => 'SUBMIT',
|
||||
'POST_BIND' => 'POST_SUBMIT',
|
||||
'OLD_CONSTANT' => DifferentClass::class . '::NEW_CONSTANT',
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,14 +18,15 @@ final class RenameClassConstantsUseToStringsRectorTest extends AbstractRectorTes
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [RenameClassConstantsUseToStringsRector::class => [
|
||||
'$oldConstantsToNewValuesByType' => [
|
||||
Configurator::class => [
|
||||
'DEVELOPMENT' => 'development',
|
||||
'PRODUCTION' => 'production',
|
||||
return [
|
||||
RenameClassConstantsUseToStringsRector::class => [
|
||||
'$oldConstantsToNewValuesByType' => [
|
||||
Configurator::class => [
|
||||
'DEVELOPMENT' => 'development',
|
||||
'PRODUCTION' => 'production',
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,12 @@ final class FunctionToNewRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [FunctionToNewRector::class => [
|
||||
'$functionToNew' => [
|
||||
'collection' => ['Collection'],
|
||||
return [
|
||||
FunctionToNewRector::class => [
|
||||
'$functionToNew' => [
|
||||
'collection' => ['Collection'],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,12 @@ final class FunctionToMethodCallRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [FunctionToMethodCallRector::class => [
|
||||
'$functionToMethodCall' => [
|
||||
'view' => ['this', 'render'],
|
||||
return [
|
||||
FunctionToMethodCallRector::class => [
|
||||
'$functionToMethodCall' => [
|
||||
'view' => ['this', 'render'],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -17,11 +17,13 @@ final class FunctionToStaticCallRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [FunctionToStaticCallRector::class => [
|
||||
'$functionToStaticCall' => [
|
||||
'view' => ['SomeStaticClass', 'render'],
|
||||
'SomeNamespaced\view' => ['AnotherStaticClass', 'render'],
|
||||
return [
|
||||
FunctionToStaticCallRector::class => [
|
||||
'$functionToStaticCall' => [
|
||||
'view' => ['SomeStaticClass', 'render'],
|
||||
'SomeNamespaced\view' => ['AnotherStaticClass', 'render'],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -21,12 +21,14 @@ final class RenameFunctionRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [RenameFunctionRector::class => [
|
||||
'$oldFunctionToNewFunction' => [
|
||||
'view' => 'Laravel\Templating\render',
|
||||
'sprintf' => 'Safe\sprintf',
|
||||
'hebrevc' => ['nl2br', 'hebrev'],
|
||||
return [
|
||||
RenameFunctionRector::class => [
|
||||
'$oldFunctionToNewFunction' => [
|
||||
'view' => 'Laravel\Templating\render',
|
||||
'sprintf' => 'Safe\sprintf',
|
||||
'hebrevc' => ['nl2br', 'hebrev'],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,12 @@ final class MergeInterfacesRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [MergeInterfacesRector::class => [
|
||||
'$oldToNewInterfaces' => [
|
||||
SomeOldInterface::class => SomeInterface::class,
|
||||
return [
|
||||
MergeInterfacesRector::class => [
|
||||
'$oldToNewInterfaces' => [
|
||||
SomeOldInterface::class => SomeInterface::class,
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,10 @@ final class RemoveInterfacesRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [RemoveInterfacesRector::class => [
|
||||
'$interfacesToRemove' => [SomeInterface::class],
|
||||
]];
|
||||
return [
|
||||
RemoveInterfacesRector::class => [
|
||||
'$interfacesToRemove' => [SomeInterface::class],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -24,20 +24,22 @@ final class GetAndSetToMethodCallRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [GetAndSetToMethodCallRector::class => [
|
||||
'$typeToMethodCalls' => [
|
||||
SomeContainer::class => [
|
||||
'get' => 'getService',
|
||||
'set' => 'addService',
|
||||
],
|
||||
'Enlight_View_Default' => [
|
||||
'get' => 'getService',
|
||||
'set' => 'addService',
|
||||
],
|
||||
Klarka::class => [
|
||||
'get' => 'get',
|
||||
return [
|
||||
GetAndSetToMethodCallRector::class => [
|
||||
'$typeToMethodCalls' => [
|
||||
SomeContainer::class => [
|
||||
'get' => 'getService',
|
||||
'set' => 'addService',
|
||||
],
|
||||
'Enlight_View_Default' => [
|
||||
'get' => 'getService',
|
||||
'set' => 'addService',
|
||||
],
|
||||
Klarka::class => [
|
||||
'get' => 'get',
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,10 +18,12 @@ final class ToStringToMethodCallRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [ToStringToMethodCallRector::class => [
|
||||
'$methodNamesByType' => [
|
||||
ConfigCache::class => 'getPath',
|
||||
return [
|
||||
ToStringToMethodCallRector::class => [
|
||||
'$methodNamesByType' => [
|
||||
ConfigCache::class => 'getPath',
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,13 +18,15 @@ final class UnsetAndIssetToMethodCallRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [UnsetAndIssetToMethodCallRector::class => [
|
||||
'$typeToMethodCalls' => [
|
||||
Container::class => [
|
||||
'isset' => 'hasService',
|
||||
'unset' => 'removeService',
|
||||
return [
|
||||
UnsetAndIssetToMethodCallRector::class => [
|
||||
'$typeToMethodCalls' => [
|
||||
Container::class => [
|
||||
'isset' => 'hasService',
|
||||
'unset' => 'removeService',
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,10 @@ final class FluentReplaceRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [FluentReplaceRector::class => [
|
||||
'$classesToDefluent' => [FluentInterfaceClass::class],
|
||||
]];
|
||||
return [
|
||||
FluentReplaceRector::class => [
|
||||
'$classesToDefluent' => [FluentInterfaceClass::class],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,12 @@ final class NormalToFluentRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [NormalToFluentRector::class => [
|
||||
'$fluentMethodsByType' => [
|
||||
FluentInterfaceClass::class => ['someFunction', 'otherFunction', 'joinThisAsWell'],
|
||||
return [
|
||||
NormalToFluentRector::class => [
|
||||
'$fluentMethodsByType' => [
|
||||
FluentInterfaceClass::class => ['someFunction', 'otherFunction', 'joinThisAsWell'],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,10 +18,14 @@ final class MethodCallToAnotherMethodCallWithArgumentsRectorTest extends Abstrac
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [MethodCallToAnotherMethodCallWithArgumentsRector::class => [
|
||||
'$oldMethodsToNewMethodsWithArgsByType' => [
|
||||
NetteServiceDefinition::class => ['setInject' => ['addTag', ['inject']]],
|
||||
return [
|
||||
MethodCallToAnotherMethodCallWithArgumentsRector::class => [
|
||||
'$oldMethodsToNewMethodsWithArgsByType' => [
|
||||
NetteServiceDefinition::class => [
|
||||
'setInject' => ['addTag', ['inject']],
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -24,19 +24,21 @@ final class RenameMethodCallRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [RenameMethodCallRector::class => [
|
||||
'$oldToNewMethodsByClass' => [
|
||||
Html::class => [
|
||||
'add' => 'addHtml',
|
||||
'addToArray' => [
|
||||
'name' => 'addHtmlArray',
|
||||
'array_key' => 'hi',
|
||||
return [
|
||||
RenameMethodCallRector::class => [
|
||||
'$oldToNewMethodsByClass' => [
|
||||
Html::class => [
|
||||
'add' => 'addHtml',
|
||||
'addToArray' => [
|
||||
'name' => 'addHtmlArray',
|
||||
'array_key' => 'hi',
|
||||
],
|
||||
],
|
||||
ClassMethodToBeSkipped::class => [
|
||||
'createHtml' => 'testHtml',
|
||||
],
|
||||
],
|
||||
ClassMethodToBeSkipped::class => [
|
||||
'createHtml' => 'testHtml',
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -29,25 +29,27 @@ final class RenameMethodRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [RenameMethodRector::class => [
|
||||
'$oldToNewMethodsByClass' => [
|
||||
AbstractType::class => [
|
||||
'setDefaultOptions' => 'configureOptions',
|
||||
],
|
||||
Html::class => [
|
||||
'add' => 'addHtml',
|
||||
'addToArray' => [
|
||||
'name' => 'addHtmlArray',
|
||||
'array_key' => 'hi',
|
||||
return [
|
||||
RenameMethodRector::class => [
|
||||
'$oldToNewMethodsByClass' => [
|
||||
AbstractType::class => [
|
||||
'setDefaultOptions' => 'configureOptions',
|
||||
],
|
||||
Html::class => [
|
||||
'add' => 'addHtml',
|
||||
'addToArray' => [
|
||||
'name' => 'addHtmlArray',
|
||||
'array_key' => 'hi',
|
||||
],
|
||||
],
|
||||
FormMacros::class => [
|
||||
'renderFormBegin' => ['Nette\Bridges\FormsLatte\Runtime', 'renderFormBegin'],
|
||||
],
|
||||
'*Presenter' => [
|
||||
'run' => '__invoke',
|
||||
],
|
||||
],
|
||||
FormMacros::class => [
|
||||
'renderFormBegin' => ['Nette\Bridges\FormsLatte\Runtime', 'renderFormBegin'],
|
||||
],
|
||||
'*Presenter' => [
|
||||
'run' => '__invoke',
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -19,11 +19,17 @@ final class RenameStaticMethodRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [RenameStaticMethodRector::class => [
|
||||
'$oldToNewMethodByClasses' => [
|
||||
Html::class => ['add' => 'addHtml'],
|
||||
FormMacros::class => ['renderFormBegin' => ['Nette\Bridges\FormsLatte\Runtime', 'renderFormBegin']],
|
||||
return [
|
||||
RenameStaticMethodRector::class => [
|
||||
'$oldToNewMethodByClasses' => [
|
||||
Html::class => [
|
||||
'add' => 'addHtml',
|
||||
],
|
||||
FormMacros::class => [
|
||||
'renderFormBegin' => ['Nette\Bridges\FormsLatte\Runtime', 'renderFormBegin'],
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -25,12 +25,14 @@ final class PseudoNamespaceToNamespaceRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [PseudoNamespaceToNamespaceRector::class => [
|
||||
'$namespacePrefixesWithExcludedClasses' => [
|
||||
// namespace prefix => excluded classes
|
||||
'PHPUnit_' => ['PHPUnit_Framework_MockObject_MockObject'],
|
||||
'ChangeMe_' => ['KeepMe_'],
|
||||
return [
|
||||
PseudoNamespaceToNamespaceRector::class => [
|
||||
'$namespacePrefixesWithExcludedClasses' => [
|
||||
// namespace prefix => excluded classes
|
||||
'PHPUnit_' => ['PHPUnit_Framework_MockObject_MockObject'],
|
||||
'ChangeMe_' => ['KeepMe_'],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,15 @@ final class RenameNamespaceRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [RenameNamespaceRector::class => [
|
||||
'$oldToNewNamespaces' => [
|
||||
'OldNamespace' => 'NewNamespace',
|
||||
'OldNamespaceWith\OldSplitNamespace' => 'NewNamespaceWith\NewSplitNamespace',
|
||||
'Old\Long\AnyNamespace' => 'Short\AnyNamespace',
|
||||
'PHPUnit_Framework_' => 'PHPUnit\Framework\\',
|
||||
return [
|
||||
RenameNamespaceRector::class => [
|
||||
'$oldToNewNamespaces' => [
|
||||
'OldNamespace' => 'NewNamespace',
|
||||
'OldNamespaceWith\OldSplitNamespace' => 'NewNamespaceWith\NewSplitNamespace',
|
||||
'Old\Long\AnyNamespace' => 'Short\AnyNamespace',
|
||||
'PHPUnit_Framework_' => 'PHPUnit\Framework\\',
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,12 @@ final class NewToStaticCallRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [NewToStaticCallRector::class => [
|
||||
'$typeToStaticCalls' => [
|
||||
FromNewClass::class => [IntoStaticClass::class, 'run'],
|
||||
return [
|
||||
NewToStaticCallRector::class => [
|
||||
'$typeToStaticCalls' => [
|
||||
FromNewClass::class => [IntoStaticClass::class, 'run'],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,23 +18,25 @@ final class PropertyToMethodRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [PropertyToMethodRector::class => [
|
||||
'$perClassPropertyToMethods' => [
|
||||
Translator::class => [
|
||||
'locale' => [
|
||||
'get' => 'getLocale',
|
||||
'set' => 'setLocale',
|
||||
return [
|
||||
PropertyToMethodRector::class => [
|
||||
'$perClassPropertyToMethods' => [
|
||||
Translator::class => [
|
||||
'locale' => [
|
||||
'get' => 'getLocale',
|
||||
'set' => 'setLocale',
|
||||
],
|
||||
],
|
||||
],
|
||||
'Rector\Tests\Rector\Property\PropertyToMethodRector\Fixture\SomeClassWithParameters' => [
|
||||
'parameter' => [
|
||||
'get' => [
|
||||
'method' => 'getConfig',
|
||||
'arguments' => ['parameter'],
|
||||
'Rector\Tests\Rector\Property\PropertyToMethodRector\Fixture\SomeClassWithParameters' => [
|
||||
'parameter' => [
|
||||
'get' => [
|
||||
'method' => 'getConfig',
|
||||
'arguments' => ['parameter'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,13 +18,15 @@ final class RenamePropertyRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [RenamePropertyRector::class => [
|
||||
'$oldToNewPropertyByTypes' => [
|
||||
ClassWithProperties::class => [
|
||||
'oldProperty' => 'newProperty',
|
||||
'anotherOldProperty' => 'anotherNewProperty',
|
||||
return [
|
||||
RenamePropertyRector::class => [
|
||||
'$oldToNewPropertyByTypes' => [
|
||||
ClassWithProperties::class => [
|
||||
'oldProperty' => 'newProperty',
|
||||
'anotherOldProperty' => 'anotherNewProperty',
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,10 +18,14 @@ final class StaticCallToFunctionRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [StaticCallToFunctionRector::class => [
|
||||
'$staticCallToFunctionByType' => [
|
||||
SomeOldStaticClass::class => ['render' => 'view'],
|
||||
return [
|
||||
StaticCallToFunctionRector::class => [
|
||||
'$staticCallToFunctionByType' => [
|
||||
SomeOldStaticClass::class => [
|
||||
'render' => 'view',
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -17,11 +17,13 @@ final class StringToClassConstantRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [StringToClassConstantRector::class => [
|
||||
'$stringsToClassConstants' => [
|
||||
'compiler.post_dump' => ['Yet\AnotherClass', 'CONSTANT'],
|
||||
'compiler.to_class' => ['Yet\AnotherClass', 'class'],
|
||||
return [
|
||||
StringToClassConstantRector::class => [
|
||||
'$stringsToClassConstants' => [
|
||||
'compiler.post_dump' => ['Yet\AnotherClass', 'CONSTANT'],
|
||||
'compiler.to_class' => ['Yet\AnotherClass', 'class'],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,21 @@ final class ParentTypehintedArgumentRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [ParentTypehintedArgumentRector::class => [
|
||||
'$typehintForArgumentByMethodAndClass' => [
|
||||
ParserInterface::class => ['parse' => ['code' => 'string']],
|
||||
ClassMetadataFactory::class => ['setEntityManager' => ['$em' => 'Doctrine\ORM\EntityManagerInterface']],
|
||||
return [
|
||||
ParentTypehintedArgumentRector::class => [
|
||||
'$typehintForArgumentByMethodAndClass' => [
|
||||
ParserInterface::class => [
|
||||
'parse' => [
|
||||
'code' => 'string',
|
||||
],
|
||||
],
|
||||
ClassMetadataFactory::class => [
|
||||
'setEntityManager' => [
|
||||
'$em' => 'Doctrine\ORM\EntityManagerInterface',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,15 +18,19 @@ final class ChangeConstantVisibilityRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [ChangeConstantVisibilityRector::class => [
|
||||
'$constantToVisibilityByClass' => [
|
||||
ParentObject::class => [
|
||||
'TO_BE_PUBLIC_CONSTANT' => 'public',
|
||||
'TO_BE_PROTECTED_CONSTANT' => 'protected',
|
||||
'TO_BE_PRIVATE_CONSTANT' => 'private',
|
||||
return [
|
||||
ChangeConstantVisibilityRector::class => [
|
||||
'$constantToVisibilityByClass' => [
|
||||
ParentObject::class => [
|
||||
'TO_BE_PUBLIC_CONSTANT' => 'public',
|
||||
'TO_BE_PROTECTED_CONSTANT' => 'protected',
|
||||
'TO_BE_PRIVATE_CONSTANT' => 'private',
|
||||
],
|
||||
'Rector\Tests\Rector\Visibility\ChangePropertyVisibilityRector\Source\AnotherClassWithInvalidConstants' => [
|
||||
'TO_BE_PRIVATE_CONSTANT' => 'private',
|
||||
],
|
||||
],
|
||||
'Rector\Tests\Rector\Visibility\ChangePropertyVisibilityRector\Source\AnotherClassWithInvalidConstants' => ['TO_BE_PRIVATE_CONSTANT' => 'private'],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,15 +18,17 @@ final class ChangeMethodVisibilityRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [ChangeMethodVisibilityRector::class => [
|
||||
'$methodToVisibilityByClass' => [
|
||||
ParentObject::class => [
|
||||
'toBePublicMethod' => 'public',
|
||||
'toBeProtectedMethod' => 'protected',
|
||||
'toBePrivateMethod' => 'private',
|
||||
'toBePublicStaticMethod' => 'public',
|
||||
return [
|
||||
ChangeMethodVisibilityRector::class => [
|
||||
'$methodToVisibilityByClass' => [
|
||||
ParentObject::class => [
|
||||
'toBePublicMethod' => 'public',
|
||||
'toBeProtectedMethod' => 'protected',
|
||||
'toBePrivateMethod' => 'private',
|
||||
'toBePublicStaticMethod' => 'public',
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -22,18 +22,20 @@ final class ChangePropertyVisibilityRectorTest extends AbstractRectorTestCase
|
||||
*/
|
||||
protected function getRectorsWithConfiguration(): array
|
||||
{
|
||||
return [ChangePropertyVisibilityRector::class => [
|
||||
'$propertyToVisibilityByClass' => [
|
||||
ParentObject::class => [
|
||||
'toBePublicProperty' => 'public',
|
||||
'toBeProtectedProperty' => 'protected',
|
||||
'toBePrivateProperty' => 'private',
|
||||
'toBePublicStaticProperty' => 'public',
|
||||
],
|
||||
'Rector\Tests\Rector\Visibility\ChangePropertyVisibilityRector\Fixture\NormalObject' => [
|
||||
'toBePublicStaticProperty' => 'public',
|
||||
return [
|
||||
ChangePropertyVisibilityRector::class => [
|
||||
'$propertyToVisibilityByClass' => [
|
||||
ParentObject::class => [
|
||||
'toBePublicProperty' => 'public',
|
||||
'toBeProtectedProperty' => 'protected',
|
||||
'toBePrivateProperty' => 'private',
|
||||
'toBePublicStaticProperty' => 'public',
|
||||
],
|
||||
'Rector\Tests\Rector\Visibility\ChangePropertyVisibilityRector\Fixture\NormalObject' => [
|
||||
'toBePublicStaticProperty' => 'public',
|
||||
],
|
||||
],
|
||||
],
|
||||
]];
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user