Analyzes your Symfony project and tries to make it compatible with the new version of Symfony framework.
symfony-upgrade-fixer.phar file and store it somewhere on your computer.
You can run these commands to easily access
symfony-upgrade-fixer from anywhere on
$ sudo wget https://github.com/umpirsky/Symfony-Upgrade-Fixer/releases/download/v0.1.6/symfony-upgrade-fixer.phar -O /usr/local/bin/symfony-upgrade-fixer $ sudo chmod a+x /usr/local/bin/symfony-upgrade-fixer
Then, just run
$ composer require umpirsky/symfony-upgrade-fixer
$ composer global require umpirsky/symfony-upgrade-fixer
Make sure you have
~/.composer/vendor/bin in your
you're good to go:
$ export PATH="$PATH:$HOME/.composer/vendor/bin"
Don't forget to add this line in your
.bashrc file if you want to keep this change after reboot.
fix command tries to fix as much upgrade issues as possible on a given file or directory:
$ symfony-upgrade-fixer fix /path/to/dir $ symfony-upgrade-fixer fix /path/to/file
--dry-run option displays the files that need to be fixed but without actually modifying them:
$ symfony-upgrade-fixer fix /path/to/code --dry-run
--no-use-reorder option prevents the fixer from re-ordering USE statements:
$ symfony-upgrade-fixer fix /path/to/code --no-use-reorder
--fixers option allows to specify which fixers should be used:
$ symfony-upgrade-fixer fix /path/to/code --fixers=get_request,form_events,property_access
|form_configure_options||The method AbstractType::setDefaultOptions(OptionsResolverInterface $resolver) have been renamed to AbstractType::configureOptions(OptionsResolver $resolver).|
|form_events||The events PRE_BIND, BIND and POST_BIND were renamed to PRE_SUBMIT, SUBMIT and POST_SUBMIT.|
|form_getname_to_getblockprefix||The method FormTypeInterface::getName() was deprecated, you should now implement FormTypeInterface::getBlockPrefix() instead.|
|form_option_names||Options precision and virtual was renamed to scale and inherit_data.|
|form_parent_type||Returning type instances from FormTypeInterface::getParent() is deprecated, return the fully-qualified class name of the parent type class instead.|
|form_type_names||Instead of referencing types by name, you should reference them by their fully-qualified class name (FQCN) instead.|
|form_extension_get_extended_type||Instead of referencing extended types by name, you should reference them by their fully-qualified class name (FQCN) instead.|
|get_request||The getRequest method of the base controller class was removed, request object is injected in the action method instead.|
|inherit_data_aware_iterator||The class VirtualFormAwareIterator was renamed to InheritDataAwareIterator.|
|progress_bar||ProgressHelper has been removed in favor of ProgressBar.|
|property_access||Renamed PropertyAccess::getPropertyAccessor to PropertyAccess::createPropertyAccessor.|
Real Life Examples
It is tested against few cool Symfony projects:
The tool is based on PHP Coding Standards Fixer and the contributing process is very similar. I see no sense in re-doing it so far.
If you want to contribute to README, please don't edit
README.md directly - it is autogenerated. Edit
README.tpl instead and run:
$ symfony-upgrade-fixer readme > README.md