DynamicRector tests: add arguments

This commit is contained in:
TomasVotruba 2018-03-03 09:51:42 +01:00
parent 5ecd2e4d5c
commit 53e3e68231
11 changed files with 75 additions and 63 deletions

View File

@ -1,4 +1,6 @@
services: services:
Rector\Rector\Dynamic\AnnotationReplacerRector: Rector\Rector\Dynamic\AnnotationReplacerRector:
PHPUnit\Framework\TestCase: arguments:
scenario: test $classToAnnotationMap:
PHPUnit\Framework\TestCase:
scenario: test

View File

@ -1,33 +1,34 @@
services: services:
Rector\Rector\Dynamic\ArgumentReplacerRector: Rector\Rector\Dynamic\ArgumentReplacerRector:
# added default value $argumentChangesByMethodAndType:
- # added default value
class: 'Symfony\Component\DependencyInjection\ContainerBuilder' -
method: 'compile' class: 'Symfony\Component\DependencyInjection\ContainerBuilder'
type: 'changed' method: 'compile'
position: 0 type: 'changed'
default_value: false position: 0
default_value: false
# added default value # added default value
- -
class: 'Symfony\Component\DependencyInjection\ContainerBuilder' class: 'Symfony\Component\DependencyInjection\ContainerBuilder'
method: 'addCompilerPass' method: 'addCompilerPass'
type: 'changed' type: 'changed'
position: 2 position: 2
default_value: 0 default_value: 0
# remove argument # remove argument
- -
class: 'Doctrine\ORM\Persisters\Entity\AbstractEntityInheritancePersister' class: 'Doctrine\ORM\Persisters\Entity\AbstractEntityInheritancePersister'
method: 'getSelectJoinColumnSQL' method: 'getSelectJoinColumnSQL'
position: 4 position: 4
type: 'removed' type: 'removed'
# replace default value # replace default value
- -
class: 'Symfony\Component\DependencyInjection\Definition' class: 'Symfony\Component\DependencyInjection\Definition'
method: 'setScope' method: 'setScope'
position: 0 position: 0
type: 'replace_default_value' type: 'replace_default_value'
replace_map: replace_map:
'Symfony\Component\DependencyInjection\ContainerBuilder::SCOPE_PROTOTYPE': false 'Symfony\Component\DependencyInjection\ContainerBuilder::SCOPE_PROTOTYPE': false

View File

@ -1,6 +1,7 @@
services: services:
Rector\Rector\Dynamic\ClassConstantReplacerRector: Rector\Rector\Dynamic\ClassConstantReplacerRector:
'Symfony\Component\Form\FormEvents': $oldToNewConstantsByClass:
'PRE_BIND': 'PRE_SUBMIT' 'Symfony\Component\Form\FormEvents':
'BIND': 'SUBMIT' 'PRE_BIND': 'PRE_SUBMIT'
'POST_BIND': 'POST_SUBMIT' 'BIND': 'SUBMIT'
'POST_BIND': 'POST_SUBMIT'

View File

@ -1,5 +1,6 @@
services: services:
Rector\Rector\Dynamic\ClassReplacerRector: Rector\Rector\Dynamic\ClassReplacerRector:
OldClass: NewClass $oldToNewClasses:
'PhpParser\BuilderAbstract': 'PhpParser\Builder' OldClass: NewClass
'Twig_Extension': 'Twig\Extension\AbstractExtension' 'PhpParser\BuilderAbstract': 'PhpParser\Builder'
'Twig_Extension': 'Twig\Extension\AbstractExtension'

View File

@ -1,8 +1,9 @@
services: services:
Rector\Rector\Dynamic\MethodNameReplacerRector: Rector\Rector\Dynamic\MethodNameReplacerRector:
'Symfony\Component\Form\AbstractType': $perClassOldToNewMethods:
'setDefaultOptions': 'configureOptions' 'Symfony\Component\Form\AbstractType':
'Nette\Utils\Html': 'setDefaultOptions': 'configureOptions'
'add': 'addHtml' 'Nette\Utils\Html':
'Nette\Bridges\FormsLatte\FormMacros': 'add': 'addHtml'
'renderFormBegin': ['Nette\Bridges\FormsLatte\Runtime', 'renderFormBegin'] 'Nette\Bridges\FormsLatte\FormMacros':
'renderFormBegin': ['Nette\Bridges\FormsLatte\Runtime', 'renderFormBegin']

View File

@ -1,6 +1,7 @@
services: services:
Rector\Rector\Dynamic\NamespaceReplacerRector: Rector\Rector\Dynamic\NamespaceReplacerRector:
'OldNamespace': 'NewNamespace' $oldToNewNamespaces:
'OldNamespaceWith\OldSplitNamespace': 'NewNamespaceWith\NewSplitNamespace' 'OldNamespace': 'NewNamespace'
'Old\Long\AnyNamespace': 'Short\AnyNamespace' 'OldNamespaceWith\OldSplitNamespace': 'NewNamespaceWith\NewSplitNamespace'
'PHPUnit_Framework_': 'PHPUnit\Framework\' 'Old\Long\AnyNamespace': 'Short\AnyNamespace'
'PHPUnit_Framework_': 'PHPUnit\Framework\'

View File

@ -1,8 +1,9 @@
services: services:
Rector\Rector\Dynamic\ParentTypehintedArgumentRector: Rector\Rector\Dynamic\ParentTypehintedArgumentRector:
'PhpParser\Parser': $typehintForArgumentByMethodAndClass:
'parse': 'PhpParser\Parser':
'code': 'string' 'parse':
'Doctrine\ORM\Mapping\ClassMetadataFactory': 'code': 'string'
'setEntityManager': 'Doctrine\ORM\Mapping\ClassMetadataFactory':
'em': 'Doctrine\ORM\EntityManagerInterface' 'setEntityManager':
'em': 'Doctrine\ORM\EntityManagerInterface'

View File

@ -1,4 +1,5 @@
services: services:
Rector\Rector\Dynamic\PropertyNameReplacerRector: Rector\Rector\Dynamic\PropertyNameReplacerRector:
'SomeClass': $perClassOldToNewProperties:
'oldProperty': 'newProperty' 'SomeClass':
'oldProperty': 'newProperty'

View File

@ -1,6 +1,7 @@
services: services:
Rector\Rector\Dynamic\PropertyToMethodRector: Rector\Rector\Dynamic\PropertyToMethodRector:
'Translator': $perClassOldToNewProperties:
'locale': 'Translator':
'get': 'getLocale' 'locale':
'set': 'setLocale' 'get': 'getLocale'
'set': 'setLocale'

View File

@ -1,5 +1,6 @@
services: services:
Rector\Rector\Dynamic\PseudoNamespaceToNamespaceRector: Rector\Rector\Dynamic\PseudoNamespaceToNamespaceRector:
- 'PHPUnit_' $configuration:
# exclude this class - 'PHPUnit_'
- '!PHPUnit_Framework_MockObject_MockObject' # exclude this class
- '!PHPUnit_Framework_MockObject_MockObject'

View File

@ -1,3 +1,4 @@
services: services:
Rector\Rector\Dynamic\ValueObjectRemoverRector: Rector\Rector\Dynamic\ValueObjectRemoverRector:
'SomeNamespace\SomeValueObject': 'string' $valueObjectsToSimpleTypes:
'SomeNamespace\SomeValueObject': 'string'