Skip to content

Commit

Permalink
add many Symfony 3.0 rectors [ref #122]
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Nov 1, 2017
1 parent 722b059 commit f453bf7
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ Just follow 3 rules:
We would be happy to merge your feature then.


### How to use on PHP < 7.1
### How to use on PHP < 7.1 on Incompatible Composer Dependencies

You must have separated environment with PHP 7.1 (for example in Docker container). When you have it then run following command:

Expand Down
106 changes: 106 additions & 0 deletions src/config/level/symfony/symfony30.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,133 @@
# resources:
# - https://github.com/symfony/symfony/blob/master/UPGRADE-3.0.md

# todo - rest from:
# - https://github.com/symfony/symfony/blob/master/UPGRADE-3.0.md#process

rectors:
Rector\Rector\Contrib\Symfony\HttpKernel\GetRequestRector: ~
Rector\Rector\Contrib\Symfony\Form\FormTypeGetParentRector: ~
Rector\Rector\Contrib\Symfony\Form\OptionNameRector: ~

# dynamic

Rector\Rector\Dynamic\ClassConstantReplacerRector:
# form
'Symfony\Component\Form\FormEvents':
'PRE_BIND': 'PRE_SUBMIT'
'BIND': 'SUBMIT'
'POST_BIND': 'POST_SUBMIT'
'Symfony\Component\Form\Extension\Core\DataTransformer':
'ROUND_HALFEVEN': 'ROUND_HALF_EVEN'
'ROUND_HALFUP': 'ROUND_HALF_UP'
'ROUND_HALFDOWN': 'ROUND_HALF_DOWN'

Rector\Rector\Dynamic\MethodNameReplacerRector:
# dependency injection
'Symfony\Component\ClassLoader\UniversalClassLoader\UniversalClassLoader':
'registerNamespaces': ['Symfony\Component\ClassLoader\ClassLoader', 'addPrefixes']
'registerPrefixes': ['Symfony\Component\ClassLoader\ClassLoader', 'addPrefixes']
'registerNamespace': ['Symfony\Component\ClassLoader\ClassLoader', 'addPrefix']
'registerPrefix': ['Symfony\Component\ClassLoader\ClassLoader', 'addPrefix']
'getNamespaces': ['Symfony\Component\ClassLoader\ClassLoader', 'getPrefixes']
'getNamespaceFallbacks': ['Symfony\Component\ClassLoader\ClassLoader', 'getFallbackDirs']
'getPrefixFallbacks': ['Symfony\Component\ClassLoader\ClassLoader', 'getFallbackDirs']

# form
'Symfony\Component\Form\AbstractType':
'getName': 'getBlockPrefix'
'setDefaultOptions': 'configureOptions'
'Symfony\Component\Form\FormTypeInterface':
'getName': 'getBlockPrefix'
'setDefaultOptions': 'configureOptions'
'Symfony\Component\Form\ResolvedFormTypeInterface':
'getName': 'getBlockPrefix'
Symfony\Component\Form\AbstractTypeExtension:
'setDefaultOptions': 'configureOptions'
Symfony\Component\Form\Form:
'bind': 'submit'
'isBound': 'isSubmitted'

# http kernel
'Symfony\Component\HttpKernel\Log\LoggerInterface':
'emerg': ['Psr\Log\LoggerInterface', 'emergency']
'crit': ['Psr\Log\LoggerInterface', 'critical']
'err': ['Psr\Log\LoggerInterface', 'error']
'warn': ['Psr\Log\LoggerInterface', 'warning']
'Symfony\Bridge\Monolog\Logger':
'emerg': ['Psr\Log\LoggerInterface', 'emergency']
'crit': ['Psr\Log\LoggerInterface', 'critical']
'err': ['Psr\Log\LoggerInterface', 'error']
'warn': ['Psr\Log\LoggerInterface', 'warning']
'Symfony\Component\HttpKernel\Log\NullLogger':
'emerg': ['Psr\Log\LoggerInterface', 'emergency']
'crit': ['Psr\Log\LoggerInterface', 'critical']
'err': ['Psr\Log\LoggerInterface', 'error']
'warn': ['Psr\Log\LoggerInterface', 'warning']

# property access
Symfony\Component\PropertyAccess\PropertyAccess:
'getPropertyAccessor': 'createPropertyAccessor'

# serialazer
'Symfony\Component\Serializer\Exception\Exception': 'Symfony\Component\Serializer\Exception\ExceptionInterface'

# translator
'Symfony\Component\Translation\Dumper\FileDumper':
'format': 'formatCatalogue'
'Symfony\Component\Translation\Translator':
# @todo: verify
'getMessages': ['Symfony\Component\Translation\TranslatorBagInterface': 'getCatalogue']

# validator
'Symfony\Component\Validator\ConstraintViolationInterface':
'getMessageParameters': 'getParameters'
'getMessagePluralization': 'getPlural'
'Symfony\Component\Validator\ConstraintViolation':
'getMessageParameters': 'getParameters'
'getMessagePluralization': 'getPlural'

Rector\Rector\Dynamic\ClassReplacerRector:
# 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'

# event disptacher
'Symfony\Component\HttpKernel\DependencyInjection\RegisterListenersPass': 'Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass'

# security
'Symfony\Component\Security\Core\Authorization\Voter\AbstractVoter': 'Symfony\Component\Security\Core\Authorization\Voter\Voter'

# 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'

0 comments on commit f453bf7

Please sign in to comment.