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:
Rector\Rector\Dynamic\AnnotationReplacerRector:
PHPUnit\Framework\TestCase:
scenario: test
arguments:
$classToAnnotationMap:
PHPUnit\Framework\TestCase:
scenario: test

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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