├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── README.tpl ├── bin └── symfony-upgrade-fixer ├── box.json ├── build └── .gitkeep ├── composer.json ├── composer.lock ├── phpunit.xml.dist ├── src └── Symfony │ └── Upgrade │ ├── Console │ ├── Application.php │ └── Command │ │ ├── FixCommand.php │ │ └── ReadmeCommand.php │ ├── Fixer.php │ └── Fixer │ ├── AbstractFixer.php │ ├── FormConfigureOptionsFixer.php │ ├── FormEventsFixer.php │ ├── FormExtensionFixer.php │ ├── FormExtensionGetExtendedTypeFixer.php │ ├── FormGetnameToGetblockprefixFixer.php │ ├── FormOptionNamesFixer.php │ ├── FormParentTypeFixer.php │ ├── FormTypeFixer.php │ ├── FormTypeNamesFixer.php │ ├── GetRequestFixer.php │ ├── InheritDataAwareIteratorFixer.php │ ├── Iterator │ └── FixerIterator.php │ ├── ProgressBarFixer.php │ ├── PropertyAccessFixer.php │ ├── RenameClassFixer.php │ └── RenameFixer.php └── tests └── Symfony └── Upgrade ├── Fixtures └── Fixer │ ├── fixme.php │ ├── form-configure-options │ ├── case1-input.php │ ├── case1-output.php │ ├── case2-input.php │ └── case2-output.php │ ├── form-events │ ├── case1-input.php │ ├── case1-output.php │ ├── case2-input.php │ ├── case2-output.php │ ├── case3-input.php │ └── case3-output.php │ ├── form-extension-get-extended-type │ ├── case1-input.php │ └── case1-output.php │ ├── form-getname-to-getblockprefix │ ├── case1-input.php │ └── case1-output.php │ ├── form-option-names │ ├── case1-input.php │ ├── case1-output.php │ ├── case2-input.php │ └── case2-output.php │ ├── form-parent-type │ ├── case1-input.php │ ├── case1-output.php │ ├── case2-input.php │ └── case2-output.php │ ├── form-type-names │ ├── case1-input.php │ ├── case1-output-php54.php │ ├── case1-output-php55+.php │ ├── case2-input.php │ ├── case2-output-php54.php │ └── case2-output-php55+.php │ ├── get-request │ ├── case1-input.php │ ├── case1-output.php │ ├── case2-input.php │ ├── case2-output.php │ ├── case3-input.php │ └── case3-output.php │ ├── inherit-data-aware-iterator │ ├── case1-input.php │ └── case1-output.php │ ├── progress-bar │ ├── case1-input.php │ ├── case1-output.php │ ├── case2-input.php │ └── case2-output.php │ └── property-access │ ├── case1-input.php │ └── case1-output.php └── Test ├── Fixer ├── AbstractFixerTestBase.php ├── FormConfigureOptionsFixerTest.php ├── FormEventsFixerTest.php ├── FormExtensionGetExtendedTypeFixerTest.php ├── FormGetnameToGetblockprefixFixerTest.php ├── FormOptionNamesFixerTest.php ├── FormParentTypeFixerTest.php ├── FormTypeNamesFixerTest.php ├── GetRequestFixerTest.php ├── InheritDataAwareIteratorFixerTest.php ├── ProgressBarFixerTest.php └── PropertyAccessFixerTest.php └── FixerTest.php /.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /build/ 3 | /phpunit.xml 4 | /vendor/ 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | sudo: false 4 | 5 | php: 6 | - 5.4 7 | - 5.5 8 | - 5.6 9 | - 7.0 10 | - 7.1 11 | - hhvm 12 | 13 | before_script: 14 | - composer install --dev 15 | 16 | script: 17 | - ./vendor/bin/phpunit 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Saša Stamenković 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 |

6 |

7 | symfony upgrade fixer • 8 | twig gettext extractor • 9 | wisdom • 10 | centipede • 11 | permissions handler • 12 | extraload • 13 | gravatar • 14 | locurro • 15 | country list • 16 | transliterator 17 |

18 | 19 | # Symfony Upgrade Fixer [![Build Status](https://travis-ci.org/umpirsky/Symfony-Upgrade-Fixer.svg)](https://travis-ci.org/umpirsky/Symfony-Upgrade-Fixer) 20 | 21 | Analyzes your Symfony project and tries to make it compatible with the new version of Symfony framework. 22 | 23 | ## Installation 24 | 25 | ### Manual 26 | 27 | #### Local 28 | 29 | Download the ``symfony-upgrade-fixer.phar`` file and store it somewhere on your computer. 30 | 31 | #### Global 32 | 33 | You can run these commands to easily access ``symfony-upgrade-fixer`` from anywhere on 34 | your system: 35 | 36 | ```bash 37 | $ 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 38 | $ sudo chmod a+x /usr/local/bin/symfony-upgrade-fixer 39 | ``` 40 | Then, just run ``symfony-upgrade-fixer``. 41 | 42 | ### Composer 43 | 44 | #### Local 45 | 46 | ```bash 47 | $ composer require umpirsky/symfony-upgrade-fixer 48 | ``` 49 | 50 | #### Global 51 | 52 | ```bash 53 | $ composer global require umpirsky/symfony-upgrade-fixer 54 | ``` 55 | 56 | Make sure you have ``~/.composer/vendor/bin`` in your ``PATH`` and 57 | you're good to go: 58 | 59 | ```bash 60 | $ export PATH="$PATH:$HOME/.composer/vendor/bin" 61 | ``` 62 | Don't forget to add this line in your `.bashrc` file if you want to keep this change after reboot. 63 | 64 | ## Usage 65 | 66 | The ``fix`` command tries to fix as much upgrade issues as possible on a given file or directory: 67 | 68 | ```bash 69 | $ symfony-upgrade-fixer fix /path/to/dir 70 | $ symfony-upgrade-fixer fix /path/to/file 71 | ``` 72 | 73 | The ``--dry-run`` option displays the files that need to be fixed but without actually modifying them: 74 | 75 | ```bash 76 | $ symfony-upgrade-fixer fix /path/to/code --dry-run 77 | ``` 78 | 79 | The ``--no-use-reorder`` option prevents the fixer from re-ordering USE statements: 80 | 81 | ```bash 82 | $ symfony-upgrade-fixer fix /path/to/code --no-use-reorder 83 | ``` 84 | 85 | The ``--fixers`` option allows to specify which fixers should be used: 86 | ```bash 87 | $ symfony-upgrade-fixer fix /path/to/code --fixers=get_request,form_events,property_access 88 | ``` 89 | 90 | ## Fixers available 91 | 92 | | Name | Description | 93 | | ---- | ----------- | 94 | | form_configure_options | The method AbstractType::setDefaultOptions(OptionsResolverInterface $resolver) have been renamed to AbstractType::configureOptions(OptionsResolver $resolver). | 95 | | form_events | The events PRE_BIND, BIND and POST_BIND were renamed to PRE_SUBMIT, SUBMIT and POST_SUBMIT. | 96 | | form_getname_to_getblockprefix | The method FormTypeInterface::getName() was deprecated, you should now implement FormTypeInterface::getBlockPrefix() instead. | 97 | | form_option_names | Options precision and virtual was renamed to scale and inherit_data. | 98 | | form_parent_type | Returning type instances from FormTypeInterface::getParent() is deprecated, return the fully-qualified class name of the parent type class instead. | 99 | | form_type_names | Instead of referencing types by name, you should reference them by their fully-qualified class name (FQCN) instead. | 100 | | form_extension_get_extended_type | Instead of referencing extended types by name, you should reference them by their fully-qualified class name (FQCN) instead. | 101 | | get_request | The getRequest method of the base controller class was removed, request object is injected in the action method instead. | 102 | | inherit_data_aware_iterator | The class VirtualFormAwareIterator was renamed to InheritDataAwareIterator. | 103 | | progress_bar | ProgressHelper has been removed in favor of ProgressBar. | 104 | | property_access | Renamed PropertyAccess::getPropertyAccessor to PropertyAccess::createPropertyAccessor. | 105 | 106 | ## Real Life Examples 107 | 108 | It is tested against few cool Symfony projects: 109 | 110 | * [Sylius](https://github.com/Sylius/Sylius/pull/3571) 111 | * [OroPlatform](https://github.com/orocrm/platform/pull/345) 112 | * [Akeneo PIM](https://github.com/akeneo/pim-community-dev/pull/3571) 113 | 114 | ## Contribute 115 | 116 | The tool is based on PHP Coding Standards Fixer and the [contributing process](https://github.com/FriendsOfPhp/php-cs-fixer/blob/master/CONTRIBUTING.md) is very similar. I see no sense in re-doing it so far. 117 | 118 | If you want to contribute to README, please don't edit `README.md` directly - it is autogenerated. Edit `README.tpl` instead and run: 119 | ```bash 120 | $ symfony-upgrade-fixer readme > README.md 121 | ``` 122 | -------------------------------------------------------------------------------- /README.tpl: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 |

6 |

7 | symfony upgrade fixer • 8 | twig gettext extractor • 9 | wisdom • 10 | centipede • 11 | permissions handler • 12 | extraload • 13 | gravatar • 14 | locurro • 15 | country list • 16 | transliterator 17 |

18 | 19 | # Symfony Upgrade Fixer [![Build Status](https://travis-ci.org/umpirsky/Symfony-Upgrade-Fixer.svg)](https://travis-ci.org/umpirsky/Symfony-Upgrade-Fixer) 20 | 21 | Analyzes your Symfony project and tries to make it compatible with the new version of Symfony framework. 22 | 23 | ## Installation 24 | 25 | ### Manual 26 | 27 | #### Local 28 | 29 | Download the ``symfony-upgrade-fixer.phar`` file and store it somewhere on your computer. 30 | 31 | #### Global 32 | 33 | You can run these commands to easily access ``symfony-upgrade-fixer`` from anywhere on 34 | your system: 35 | 36 | ```bash 37 | $ sudo wget https://github.com/umpirsky/Symfony-Upgrade-Fixer/releases/download/v%s/symfony-upgrade-fixer.phar -O /usr/local/bin/symfony-upgrade-fixer 38 | $ sudo chmod a+x /usr/local/bin/symfony-upgrade-fixer 39 | ``` 40 | Then, just run ``symfony-upgrade-fixer``. 41 | 42 | ### Composer 43 | 44 | #### Local 45 | 46 | ```bash 47 | $ composer require umpirsky/symfony-upgrade-fixer 48 | ``` 49 | 50 | #### Global 51 | 52 | ```bash 53 | $ composer global require umpirsky/symfony-upgrade-fixer 54 | ``` 55 | 56 | Make sure you have ``~/.composer/vendor/bin`` in your ``PATH`` and 57 | you're good to go: 58 | 59 | ```bash 60 | $ export PATH="$PATH:$HOME/.composer/vendor/bin" 61 | ``` 62 | Don't forget to add this line in your `.bashrc` file if you want to keep this change after reboot. 63 | 64 | ## Usage 65 | 66 | The ``fix`` command tries to fix as much upgrade issues as possible on a given file or directory: 67 | 68 | ```bash 69 | $ symfony-upgrade-fixer fix /path/to/dir 70 | $ symfony-upgrade-fixer fix /path/to/file 71 | ``` 72 | 73 | The ``--dry-run`` option displays the files that need to be fixed but without actually modifying them: 74 | 75 | ```bash 76 | $ symfony-upgrade-fixer fix /path/to/code --dry-run 77 | ``` 78 | 79 | The ``--no-use-reorder`` option prevents the fixer from re-ordering USE statements: 80 | 81 | ```bash 82 | $ symfony-upgrade-fixer fix /path/to/code --no-use-reorder 83 | ``` 84 | 85 | ## Fixers available 86 | 87 | | Name | Description | 88 | | ---- | ----------- |%s 89 | 90 | ## Real Life Examples 91 | 92 | It is tested against few cool Symfony projects: 93 | 94 | * [Sylius](https://github.com/Sylius/Sylius/pull/3571) 95 | * [OroPlatform](https://github.com/orocrm/platform/pull/345) 96 | * [Akeneo PIM](https://github.com/akeneo/pim-community-dev/pull/3571) 97 | 98 | ## Contribute 99 | 100 | The tool is based on PHP Coding Standards Fixer and the [contributing process](https://github.com/FriendsOfPhp/php-cs-fixer/blob/master/CONTRIBUTING.md) is very similar. I see no sense in re-doing it so far. 101 | 102 | If you want to contribute to README, please don't edit `README.md` directly - it is autogenerated. Edit `README.tpl` instead and run: 103 | ```bash 104 | $ symfony-upgrade-fixer readme > README.md 105 | ``` 106 | -------------------------------------------------------------------------------- /bin/symfony-upgrade-fixer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 21 | -------------------------------------------------------------------------------- /box.json: -------------------------------------------------------------------------------- 1 | { 2 | "directories": ["src"], 3 | "finder": [ 4 | { 5 | "name": "*.php", 6 | "exclude": [ 7 | ".gitignore", 8 | ".md", 9 | "phpunit", 10 | "Tester", 11 | "Tests", 12 | "tests", 13 | "yaml" 14 | ], 15 | "in": "vendor" 16 | } 17 | ], 18 | "compactors": [ 19 | "Herrera\\Box\\Compactor\\Json", 20 | "Herrera\\Box\\Compactor\\Php" 21 | ], 22 | "compression": "GZ", 23 | "main": "bin/symfony-upgrade-fixer", 24 | "output": "build/symfony-upgrade-fixer.phar", 25 | "stub": true, 26 | "chmod": "0755" 27 | } 28 | 29 | -------------------------------------------------------------------------------- /build/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/umpirsky/Symfony-Upgrade-Fixer/df97834d8ed0687d97a56c3e753db87a581ab2ce/build/.gitkeep -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "umpirsky/symfony-upgrade-fixer", 3 | "type": "application", 4 | "description": "Analyzes your Symfony project and tries to make it compatible with the new version of Symfony framework.", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Saša Stamenković", 9 | "email": "umpirsky@gmail.com" 10 | } 11 | ], 12 | "require": { 13 | "php": ">=5.4", 14 | "friendsofphp/php-cs-fixer": "1.10.*" 15 | }, 16 | "require-dev": { 17 | "phpunit/phpunit": "^4.8" 18 | }, 19 | "autoload": { 20 | "psr-4": { 21 | "Symfony\\Upgrade\\": "src/Symfony/Upgrade/" 22 | } 23 | }, 24 | "autoload-dev": { 25 | "psr-4": { 26 | "Symfony\\Upgrade\\Test\\": "tests/Symfony/Upgrade/Test/" 27 | } 28 | }, 29 | "extra": { 30 | "branch-alias": { 31 | "dev-master": "0.1-dev" 32 | } 33 | }, 34 | "bin": ["bin/symfony-upgrade-fixer"] 35 | } 36 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "615ef53d10ed9be1230a91c4991cd0fb", 8 | "packages": [ 9 | { 10 | "name": "friendsofphp/php-cs-fixer", 11 | "version": "v1.10.3", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", 15 | "reference": "5b446eb5d6cafeff20736de6468eba380a9ff64e" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/5b446eb5d6cafeff20736de6468eba380a9ff64e", 20 | "reference": "5b446eb5d6cafeff20736de6468eba380a9ff64e", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "ext-tokenizer": "*", 25 | "php": ">=5.3.6", 26 | "sebastian/diff": "~1.1", 27 | "symfony/console": "~2.3", 28 | "symfony/event-dispatcher": "~2.1", 29 | "symfony/filesystem": "~2.1", 30 | "symfony/finder": "~2.1", 31 | "symfony/process": "~2.3", 32 | "symfony/stopwatch": "~2.5" 33 | }, 34 | "require-dev": { 35 | "satooshi/php-coveralls": "0.7.*@dev" 36 | }, 37 | "bin": [ 38 | "php-cs-fixer" 39 | ], 40 | "type": "application", 41 | "autoload": { 42 | "psr-4": { 43 | "Symfony\\CS\\": "Symfony/CS/" 44 | } 45 | }, 46 | "notification-url": "https://packagist.org/downloads/", 47 | "license": [ 48 | "MIT" 49 | ], 50 | "authors": [ 51 | { 52 | "name": "Dariusz Rumiński", 53 | "email": "dariusz.ruminski@gmail.com" 54 | }, 55 | { 56 | "name": "Fabien Potencier", 57 | "email": "fabien@symfony.com" 58 | } 59 | ], 60 | "description": "A tool to automatically fix PHP code style", 61 | "time": "2015-11-30T20:15:33+00:00" 62 | }, 63 | { 64 | "name": "psr/log", 65 | "version": "1.0.2", 66 | "source": { 67 | "type": "git", 68 | "url": "https://github.com/php-fig/log.git", 69 | "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" 70 | }, 71 | "dist": { 72 | "type": "zip", 73 | "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", 74 | "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", 75 | "shasum": "" 76 | }, 77 | "require": { 78 | "php": ">=5.3.0" 79 | }, 80 | "type": "library", 81 | "extra": { 82 | "branch-alias": { 83 | "dev-master": "1.0.x-dev" 84 | } 85 | }, 86 | "autoload": { 87 | "psr-4": { 88 | "Psr\\Log\\": "Psr/Log/" 89 | } 90 | }, 91 | "notification-url": "https://packagist.org/downloads/", 92 | "license": [ 93 | "MIT" 94 | ], 95 | "authors": [ 96 | { 97 | "name": "PHP-FIG", 98 | "homepage": "http://www.php-fig.org/" 99 | } 100 | ], 101 | "description": "Common interface for logging libraries", 102 | "homepage": "https://github.com/php-fig/log", 103 | "keywords": [ 104 | "log", 105 | "psr", 106 | "psr-3" 107 | ], 108 | "time": "2016-10-10T12:19:37+00:00" 109 | }, 110 | { 111 | "name": "sebastian/diff", 112 | "version": "1.4.3", 113 | "source": { 114 | "type": "git", 115 | "url": "https://github.com/sebastianbergmann/diff.git", 116 | "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" 117 | }, 118 | "dist": { 119 | "type": "zip", 120 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", 121 | "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", 122 | "shasum": "" 123 | }, 124 | "require": { 125 | "php": "^5.3.3 || ^7.0" 126 | }, 127 | "require-dev": { 128 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" 129 | }, 130 | "type": "library", 131 | "extra": { 132 | "branch-alias": { 133 | "dev-master": "1.4-dev" 134 | } 135 | }, 136 | "autoload": { 137 | "classmap": [ 138 | "src/" 139 | ] 140 | }, 141 | "notification-url": "https://packagist.org/downloads/", 142 | "license": [ 143 | "BSD-3-Clause" 144 | ], 145 | "authors": [ 146 | { 147 | "name": "Kore Nordmann", 148 | "email": "mail@kore-nordmann.de" 149 | }, 150 | { 151 | "name": "Sebastian Bergmann", 152 | "email": "sebastian@phpunit.de" 153 | } 154 | ], 155 | "description": "Diff implementation", 156 | "homepage": "https://github.com/sebastianbergmann/diff", 157 | "keywords": [ 158 | "diff" 159 | ], 160 | "time": "2017-05-22T07:24:03+00:00" 161 | }, 162 | { 163 | "name": "symfony/console", 164 | "version": "v2.8.28", 165 | "source": { 166 | "type": "git", 167 | "url": "https://github.com/symfony/console.git", 168 | "reference": "f81549d2c5fdee8d711c9ab3c7e7362353ea5853" 169 | }, 170 | "dist": { 171 | "type": "zip", 172 | "url": "https://api.github.com/repos/symfony/console/zipball/f81549d2c5fdee8d711c9ab3c7e7362353ea5853", 173 | "reference": "f81549d2c5fdee8d711c9ab3c7e7362353ea5853", 174 | "shasum": "" 175 | }, 176 | "require": { 177 | "php": ">=5.3.9", 178 | "symfony/debug": "^2.7.2|~3.0.0", 179 | "symfony/polyfill-mbstring": "~1.0" 180 | }, 181 | "require-dev": { 182 | "psr/log": "~1.0", 183 | "symfony/event-dispatcher": "~2.1|~3.0.0", 184 | "symfony/process": "~2.1|~3.0.0" 185 | }, 186 | "suggest": { 187 | "psr/log": "For using the console logger", 188 | "symfony/event-dispatcher": "", 189 | "symfony/process": "" 190 | }, 191 | "type": "library", 192 | "extra": { 193 | "branch-alias": { 194 | "dev-master": "2.8-dev" 195 | } 196 | }, 197 | "autoload": { 198 | "psr-4": { 199 | "Symfony\\Component\\Console\\": "" 200 | }, 201 | "exclude-from-classmap": [ 202 | "/Tests/" 203 | ] 204 | }, 205 | "notification-url": "https://packagist.org/downloads/", 206 | "license": [ 207 | "MIT" 208 | ], 209 | "authors": [ 210 | { 211 | "name": "Fabien Potencier", 212 | "email": "fabien@symfony.com" 213 | }, 214 | { 215 | "name": "Symfony Community", 216 | "homepage": "https://symfony.com/contributors" 217 | } 218 | ], 219 | "description": "Symfony Console Component", 220 | "homepage": "https://symfony.com", 221 | "time": "2017-10-01T21:00:16+00:00" 222 | }, 223 | { 224 | "name": "symfony/debug", 225 | "version": "v2.8.28", 226 | "source": { 227 | "type": "git", 228 | "url": "https://github.com/symfony/debug.git", 229 | "reference": "eaaec993ca5e8067e204b2ee653cdd142961f33e" 230 | }, 231 | "dist": { 232 | "type": "zip", 233 | "url": "https://api.github.com/repos/symfony/debug/zipball/eaaec993ca5e8067e204b2ee653cdd142961f33e", 234 | "reference": "eaaec993ca5e8067e204b2ee653cdd142961f33e", 235 | "shasum": "" 236 | }, 237 | "require": { 238 | "php": ">=5.3.9", 239 | "psr/log": "~1.0" 240 | }, 241 | "conflict": { 242 | "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" 243 | }, 244 | "require-dev": { 245 | "symfony/class-loader": "~2.2|~3.0.0", 246 | "symfony/http-kernel": "~2.3.24|~2.5.9|^2.6.2|~3.0.0" 247 | }, 248 | "type": "library", 249 | "extra": { 250 | "branch-alias": { 251 | "dev-master": "2.8-dev" 252 | } 253 | }, 254 | "autoload": { 255 | "psr-4": { 256 | "Symfony\\Component\\Debug\\": "" 257 | }, 258 | "exclude-from-classmap": [ 259 | "/Tests/" 260 | ] 261 | }, 262 | "notification-url": "https://packagist.org/downloads/", 263 | "license": [ 264 | "MIT" 265 | ], 266 | "authors": [ 267 | { 268 | "name": "Fabien Potencier", 269 | "email": "fabien@symfony.com" 270 | }, 271 | { 272 | "name": "Symfony Community", 273 | "homepage": "https://symfony.com/contributors" 274 | } 275 | ], 276 | "description": "Symfony Debug Component", 277 | "homepage": "https://symfony.com", 278 | "time": "2017-10-01T21:00:16+00:00" 279 | }, 280 | { 281 | "name": "symfony/event-dispatcher", 282 | "version": "v2.8.28", 283 | "source": { 284 | "type": "git", 285 | "url": "https://github.com/symfony/event-dispatcher.git", 286 | "reference": "7fe089232554357efb8d4af65ce209fc6e5a2186" 287 | }, 288 | "dist": { 289 | "type": "zip", 290 | "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7fe089232554357efb8d4af65ce209fc6e5a2186", 291 | "reference": "7fe089232554357efb8d4af65ce209fc6e5a2186", 292 | "shasum": "" 293 | }, 294 | "require": { 295 | "php": ">=5.3.9" 296 | }, 297 | "require-dev": { 298 | "psr/log": "~1.0", 299 | "symfony/config": "^2.0.5|~3.0.0", 300 | "symfony/dependency-injection": "~2.6|~3.0.0", 301 | "symfony/expression-language": "~2.6|~3.0.0", 302 | "symfony/stopwatch": "~2.3|~3.0.0" 303 | }, 304 | "suggest": { 305 | "symfony/dependency-injection": "", 306 | "symfony/http-kernel": "" 307 | }, 308 | "type": "library", 309 | "extra": { 310 | "branch-alias": { 311 | "dev-master": "2.8-dev" 312 | } 313 | }, 314 | "autoload": { 315 | "psr-4": { 316 | "Symfony\\Component\\EventDispatcher\\": "" 317 | }, 318 | "exclude-from-classmap": [ 319 | "/Tests/" 320 | ] 321 | }, 322 | "notification-url": "https://packagist.org/downloads/", 323 | "license": [ 324 | "MIT" 325 | ], 326 | "authors": [ 327 | { 328 | "name": "Fabien Potencier", 329 | "email": "fabien@symfony.com" 330 | }, 331 | { 332 | "name": "Symfony Community", 333 | "homepage": "https://symfony.com/contributors" 334 | } 335 | ], 336 | "description": "Symfony EventDispatcher Component", 337 | "homepage": "https://symfony.com", 338 | "time": "2017-10-01T21:00:16+00:00" 339 | }, 340 | { 341 | "name": "symfony/filesystem", 342 | "version": "v2.8.28", 343 | "source": { 344 | "type": "git", 345 | "url": "https://github.com/symfony/filesystem.git", 346 | "reference": "5e3af878f144089faddd4060a48cadae4fc44dee" 347 | }, 348 | "dist": { 349 | "type": "zip", 350 | "url": "https://api.github.com/repos/symfony/filesystem/zipball/5e3af878f144089faddd4060a48cadae4fc44dee", 351 | "reference": "5e3af878f144089faddd4060a48cadae4fc44dee", 352 | "shasum": "" 353 | }, 354 | "require": { 355 | "php": ">=5.3.9" 356 | }, 357 | "type": "library", 358 | "extra": { 359 | "branch-alias": { 360 | "dev-master": "2.8-dev" 361 | } 362 | }, 363 | "autoload": { 364 | "psr-4": { 365 | "Symfony\\Component\\Filesystem\\": "" 366 | }, 367 | "exclude-from-classmap": [ 368 | "/Tests/" 369 | ] 370 | }, 371 | "notification-url": "https://packagist.org/downloads/", 372 | "license": [ 373 | "MIT" 374 | ], 375 | "authors": [ 376 | { 377 | "name": "Fabien Potencier", 378 | "email": "fabien@symfony.com" 379 | }, 380 | { 381 | "name": "Symfony Community", 382 | "homepage": "https://symfony.com/contributors" 383 | } 384 | ], 385 | "description": "Symfony Filesystem Component", 386 | "homepage": "https://symfony.com", 387 | "time": "2017-10-02T08:46:46+00:00" 388 | }, 389 | { 390 | "name": "symfony/finder", 391 | "version": "v2.8.28", 392 | "source": { 393 | "type": "git", 394 | "url": "https://github.com/symfony/finder.git", 395 | "reference": "a945724b201f74d543e356f6059c930bb8d10c92" 396 | }, 397 | "dist": { 398 | "type": "zip", 399 | "url": "https://api.github.com/repos/symfony/finder/zipball/a945724b201f74d543e356f6059c930bb8d10c92", 400 | "reference": "a945724b201f74d543e356f6059c930bb8d10c92", 401 | "shasum": "" 402 | }, 403 | "require": { 404 | "php": ">=5.3.9" 405 | }, 406 | "type": "library", 407 | "extra": { 408 | "branch-alias": { 409 | "dev-master": "2.8-dev" 410 | } 411 | }, 412 | "autoload": { 413 | "psr-4": { 414 | "Symfony\\Component\\Finder\\": "" 415 | }, 416 | "exclude-from-classmap": [ 417 | "/Tests/" 418 | ] 419 | }, 420 | "notification-url": "https://packagist.org/downloads/", 421 | "license": [ 422 | "MIT" 423 | ], 424 | "authors": [ 425 | { 426 | "name": "Fabien Potencier", 427 | "email": "fabien@symfony.com" 428 | }, 429 | { 430 | "name": "Symfony Community", 431 | "homepage": "https://symfony.com/contributors" 432 | } 433 | ], 434 | "description": "Symfony Finder Component", 435 | "homepage": "https://symfony.com", 436 | "time": "2017-10-01T21:00:16+00:00" 437 | }, 438 | { 439 | "name": "symfony/polyfill-mbstring", 440 | "version": "v1.6.0", 441 | "source": { 442 | "type": "git", 443 | "url": "https://github.com/symfony/polyfill-mbstring.git", 444 | "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" 445 | }, 446 | "dist": { 447 | "type": "zip", 448 | "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", 449 | "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", 450 | "shasum": "" 451 | }, 452 | "require": { 453 | "php": ">=5.3.3" 454 | }, 455 | "suggest": { 456 | "ext-mbstring": "For best performance" 457 | }, 458 | "type": "library", 459 | "extra": { 460 | "branch-alias": { 461 | "dev-master": "1.6-dev" 462 | } 463 | }, 464 | "autoload": { 465 | "psr-4": { 466 | "Symfony\\Polyfill\\Mbstring\\": "" 467 | }, 468 | "files": [ 469 | "bootstrap.php" 470 | ] 471 | }, 472 | "notification-url": "https://packagist.org/downloads/", 473 | "license": [ 474 | "MIT" 475 | ], 476 | "authors": [ 477 | { 478 | "name": "Nicolas Grekas", 479 | "email": "p@tchwork.com" 480 | }, 481 | { 482 | "name": "Symfony Community", 483 | "homepage": "https://symfony.com/contributors" 484 | } 485 | ], 486 | "description": "Symfony polyfill for the Mbstring extension", 487 | "homepage": "https://symfony.com", 488 | "keywords": [ 489 | "compatibility", 490 | "mbstring", 491 | "polyfill", 492 | "portable", 493 | "shim" 494 | ], 495 | "time": "2017-10-11T12:05:26+00:00" 496 | }, 497 | { 498 | "name": "symfony/process", 499 | "version": "v2.8.28", 500 | "source": { 501 | "type": "git", 502 | "url": "https://github.com/symfony/process.git", 503 | "reference": "26c9fb02bf06bd6b90f661a5bd17e510810d0176" 504 | }, 505 | "dist": { 506 | "type": "zip", 507 | "url": "https://api.github.com/repos/symfony/process/zipball/26c9fb02bf06bd6b90f661a5bd17e510810d0176", 508 | "reference": "26c9fb02bf06bd6b90f661a5bd17e510810d0176", 509 | "shasum": "" 510 | }, 511 | "require": { 512 | "php": ">=5.3.9" 513 | }, 514 | "type": "library", 515 | "extra": { 516 | "branch-alias": { 517 | "dev-master": "2.8-dev" 518 | } 519 | }, 520 | "autoload": { 521 | "psr-4": { 522 | "Symfony\\Component\\Process\\": "" 523 | }, 524 | "exclude-from-classmap": [ 525 | "/Tests/" 526 | ] 527 | }, 528 | "notification-url": "https://packagist.org/downloads/", 529 | "license": [ 530 | "MIT" 531 | ], 532 | "authors": [ 533 | { 534 | "name": "Fabien Potencier", 535 | "email": "fabien@symfony.com" 536 | }, 537 | { 538 | "name": "Symfony Community", 539 | "homepage": "https://symfony.com/contributors" 540 | } 541 | ], 542 | "description": "Symfony Process Component", 543 | "homepage": "https://symfony.com", 544 | "time": "2017-10-01T21:00:16+00:00" 545 | }, 546 | { 547 | "name": "symfony/stopwatch", 548 | "version": "v2.8.28", 549 | "source": { 550 | "type": "git", 551 | "url": "https://github.com/symfony/stopwatch.git", 552 | "reference": "28ee62ea4736431ca817cdaebcb005663e9cd1cb" 553 | }, 554 | "dist": { 555 | "type": "zip", 556 | "url": "https://api.github.com/repos/symfony/stopwatch/zipball/28ee62ea4736431ca817cdaebcb005663e9cd1cb", 557 | "reference": "28ee62ea4736431ca817cdaebcb005663e9cd1cb", 558 | "shasum": "" 559 | }, 560 | "require": { 561 | "php": ">=5.3.9" 562 | }, 563 | "type": "library", 564 | "extra": { 565 | "branch-alias": { 566 | "dev-master": "2.8-dev" 567 | } 568 | }, 569 | "autoload": { 570 | "psr-4": { 571 | "Symfony\\Component\\Stopwatch\\": "" 572 | }, 573 | "exclude-from-classmap": [ 574 | "/Tests/" 575 | ] 576 | }, 577 | "notification-url": "https://packagist.org/downloads/", 578 | "license": [ 579 | "MIT" 580 | ], 581 | "authors": [ 582 | { 583 | "name": "Fabien Potencier", 584 | "email": "fabien@symfony.com" 585 | }, 586 | { 587 | "name": "Symfony Community", 588 | "homepage": "https://symfony.com/contributors" 589 | } 590 | ], 591 | "description": "Symfony Stopwatch Component", 592 | "homepage": "https://symfony.com", 593 | "time": "2017-10-01T21:00:16+00:00" 594 | } 595 | ], 596 | "packages-dev": [ 597 | { 598 | "name": "doctrine/instantiator", 599 | "version": "1.0.5", 600 | "source": { 601 | "type": "git", 602 | "url": "https://github.com/doctrine/instantiator.git", 603 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" 604 | }, 605 | "dist": { 606 | "type": "zip", 607 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", 608 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", 609 | "shasum": "" 610 | }, 611 | "require": { 612 | "php": ">=5.3,<8.0-DEV" 613 | }, 614 | "require-dev": { 615 | "athletic/athletic": "~0.1.8", 616 | "ext-pdo": "*", 617 | "ext-phar": "*", 618 | "phpunit/phpunit": "~4.0", 619 | "squizlabs/php_codesniffer": "~2.0" 620 | }, 621 | "type": "library", 622 | "extra": { 623 | "branch-alias": { 624 | "dev-master": "1.0.x-dev" 625 | } 626 | }, 627 | "autoload": { 628 | "psr-4": { 629 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 630 | } 631 | }, 632 | "notification-url": "https://packagist.org/downloads/", 633 | "license": [ 634 | "MIT" 635 | ], 636 | "authors": [ 637 | { 638 | "name": "Marco Pivetta", 639 | "email": "ocramius@gmail.com", 640 | "homepage": "http://ocramius.github.com/" 641 | } 642 | ], 643 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 644 | "homepage": "https://github.com/doctrine/instantiator", 645 | "keywords": [ 646 | "constructor", 647 | "instantiate" 648 | ], 649 | "time": "2015-06-14T21:17:01+00:00" 650 | }, 651 | { 652 | "name": "phpdocumentor/reflection-docblock", 653 | "version": "2.0.5", 654 | "source": { 655 | "type": "git", 656 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", 657 | "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b" 658 | }, 659 | "dist": { 660 | "type": "zip", 661 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b", 662 | "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b", 663 | "shasum": "" 664 | }, 665 | "require": { 666 | "php": ">=5.3.3" 667 | }, 668 | "require-dev": { 669 | "phpunit/phpunit": "~4.0" 670 | }, 671 | "suggest": { 672 | "dflydev/markdown": "~1.0", 673 | "erusev/parsedown": "~1.0" 674 | }, 675 | "type": "library", 676 | "extra": { 677 | "branch-alias": { 678 | "dev-master": "2.0.x-dev" 679 | } 680 | }, 681 | "autoload": { 682 | "psr-0": { 683 | "phpDocumentor": [ 684 | "src/" 685 | ] 686 | } 687 | }, 688 | "notification-url": "https://packagist.org/downloads/", 689 | "license": [ 690 | "MIT" 691 | ], 692 | "authors": [ 693 | { 694 | "name": "Mike van Riel", 695 | "email": "mike.vanriel@naenius.com" 696 | } 697 | ], 698 | "time": "2016-01-25T08:17:30+00:00" 699 | }, 700 | { 701 | "name": "phpspec/prophecy", 702 | "version": "v1.7.2", 703 | "source": { 704 | "type": "git", 705 | "url": "https://github.com/phpspec/prophecy.git", 706 | "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" 707 | }, 708 | "dist": { 709 | "type": "zip", 710 | "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", 711 | "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", 712 | "shasum": "" 713 | }, 714 | "require": { 715 | "doctrine/instantiator": "^1.0.2", 716 | "php": "^5.3|^7.0", 717 | "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", 718 | "sebastian/comparator": "^1.1|^2.0", 719 | "sebastian/recursion-context": "^1.0|^2.0|^3.0" 720 | }, 721 | "require-dev": { 722 | "phpspec/phpspec": "^2.5|^3.2", 723 | "phpunit/phpunit": "^4.8 || ^5.6.5" 724 | }, 725 | "type": "library", 726 | "extra": { 727 | "branch-alias": { 728 | "dev-master": "1.7.x-dev" 729 | } 730 | }, 731 | "autoload": { 732 | "psr-0": { 733 | "Prophecy\\": "src/" 734 | } 735 | }, 736 | "notification-url": "https://packagist.org/downloads/", 737 | "license": [ 738 | "MIT" 739 | ], 740 | "authors": [ 741 | { 742 | "name": "Konstantin Kudryashov", 743 | "email": "ever.zet@gmail.com", 744 | "homepage": "http://everzet.com" 745 | }, 746 | { 747 | "name": "Marcello Duarte", 748 | "email": "marcello.duarte@gmail.com" 749 | } 750 | ], 751 | "description": "Highly opinionated mocking framework for PHP 5.3+", 752 | "homepage": "https://github.com/phpspec/prophecy", 753 | "keywords": [ 754 | "Double", 755 | "Dummy", 756 | "fake", 757 | "mock", 758 | "spy", 759 | "stub" 760 | ], 761 | "time": "2017-09-04T11:05:03+00:00" 762 | }, 763 | { 764 | "name": "phpunit/php-code-coverage", 765 | "version": "2.2.4", 766 | "source": { 767 | "type": "git", 768 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 769 | "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" 770 | }, 771 | "dist": { 772 | "type": "zip", 773 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", 774 | "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", 775 | "shasum": "" 776 | }, 777 | "require": { 778 | "php": ">=5.3.3", 779 | "phpunit/php-file-iterator": "~1.3", 780 | "phpunit/php-text-template": "~1.2", 781 | "phpunit/php-token-stream": "~1.3", 782 | "sebastian/environment": "^1.3.2", 783 | "sebastian/version": "~1.0" 784 | }, 785 | "require-dev": { 786 | "ext-xdebug": ">=2.1.4", 787 | "phpunit/phpunit": "~4" 788 | }, 789 | "suggest": { 790 | "ext-dom": "*", 791 | "ext-xdebug": ">=2.2.1", 792 | "ext-xmlwriter": "*" 793 | }, 794 | "type": "library", 795 | "extra": { 796 | "branch-alias": { 797 | "dev-master": "2.2.x-dev" 798 | } 799 | }, 800 | "autoload": { 801 | "classmap": [ 802 | "src/" 803 | ] 804 | }, 805 | "notification-url": "https://packagist.org/downloads/", 806 | "license": [ 807 | "BSD-3-Clause" 808 | ], 809 | "authors": [ 810 | { 811 | "name": "Sebastian Bergmann", 812 | "email": "sb@sebastian-bergmann.de", 813 | "role": "lead" 814 | } 815 | ], 816 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 817 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 818 | "keywords": [ 819 | "coverage", 820 | "testing", 821 | "xunit" 822 | ], 823 | "time": "2015-10-06T15:47:00+00:00" 824 | }, 825 | { 826 | "name": "phpunit/php-file-iterator", 827 | "version": "1.4.2", 828 | "source": { 829 | "type": "git", 830 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 831 | "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" 832 | }, 833 | "dist": { 834 | "type": "zip", 835 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", 836 | "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", 837 | "shasum": "" 838 | }, 839 | "require": { 840 | "php": ">=5.3.3" 841 | }, 842 | "type": "library", 843 | "extra": { 844 | "branch-alias": { 845 | "dev-master": "1.4.x-dev" 846 | } 847 | }, 848 | "autoload": { 849 | "classmap": [ 850 | "src/" 851 | ] 852 | }, 853 | "notification-url": "https://packagist.org/downloads/", 854 | "license": [ 855 | "BSD-3-Clause" 856 | ], 857 | "authors": [ 858 | { 859 | "name": "Sebastian Bergmann", 860 | "email": "sb@sebastian-bergmann.de", 861 | "role": "lead" 862 | } 863 | ], 864 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 865 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 866 | "keywords": [ 867 | "filesystem", 868 | "iterator" 869 | ], 870 | "time": "2016-10-03T07:40:28+00:00" 871 | }, 872 | { 873 | "name": "phpunit/php-text-template", 874 | "version": "1.2.1", 875 | "source": { 876 | "type": "git", 877 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 878 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" 879 | }, 880 | "dist": { 881 | "type": "zip", 882 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 883 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 884 | "shasum": "" 885 | }, 886 | "require": { 887 | "php": ">=5.3.3" 888 | }, 889 | "type": "library", 890 | "autoload": { 891 | "classmap": [ 892 | "src/" 893 | ] 894 | }, 895 | "notification-url": "https://packagist.org/downloads/", 896 | "license": [ 897 | "BSD-3-Clause" 898 | ], 899 | "authors": [ 900 | { 901 | "name": "Sebastian Bergmann", 902 | "email": "sebastian@phpunit.de", 903 | "role": "lead" 904 | } 905 | ], 906 | "description": "Simple template engine.", 907 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 908 | "keywords": [ 909 | "template" 910 | ], 911 | "time": "2015-06-21T13:50:34+00:00" 912 | }, 913 | { 914 | "name": "phpunit/php-timer", 915 | "version": "1.0.9", 916 | "source": { 917 | "type": "git", 918 | "url": "https://github.com/sebastianbergmann/php-timer.git", 919 | "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" 920 | }, 921 | "dist": { 922 | "type": "zip", 923 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", 924 | "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", 925 | "shasum": "" 926 | }, 927 | "require": { 928 | "php": "^5.3.3 || ^7.0" 929 | }, 930 | "require-dev": { 931 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" 932 | }, 933 | "type": "library", 934 | "extra": { 935 | "branch-alias": { 936 | "dev-master": "1.0-dev" 937 | } 938 | }, 939 | "autoload": { 940 | "classmap": [ 941 | "src/" 942 | ] 943 | }, 944 | "notification-url": "https://packagist.org/downloads/", 945 | "license": [ 946 | "BSD-3-Clause" 947 | ], 948 | "authors": [ 949 | { 950 | "name": "Sebastian Bergmann", 951 | "email": "sb@sebastian-bergmann.de", 952 | "role": "lead" 953 | } 954 | ], 955 | "description": "Utility class for timing", 956 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 957 | "keywords": [ 958 | "timer" 959 | ], 960 | "time": "2017-02-26T11:10:40+00:00" 961 | }, 962 | { 963 | "name": "phpunit/php-token-stream", 964 | "version": "1.4.11", 965 | "source": { 966 | "type": "git", 967 | "url": "https://github.com/sebastianbergmann/php-token-stream.git", 968 | "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" 969 | }, 970 | "dist": { 971 | "type": "zip", 972 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", 973 | "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", 974 | "shasum": "" 975 | }, 976 | "require": { 977 | "ext-tokenizer": "*", 978 | "php": ">=5.3.3" 979 | }, 980 | "require-dev": { 981 | "phpunit/phpunit": "~4.2" 982 | }, 983 | "type": "library", 984 | "extra": { 985 | "branch-alias": { 986 | "dev-master": "1.4-dev" 987 | } 988 | }, 989 | "autoload": { 990 | "classmap": [ 991 | "src/" 992 | ] 993 | }, 994 | "notification-url": "https://packagist.org/downloads/", 995 | "license": [ 996 | "BSD-3-Clause" 997 | ], 998 | "authors": [ 999 | { 1000 | "name": "Sebastian Bergmann", 1001 | "email": "sebastian@phpunit.de" 1002 | } 1003 | ], 1004 | "description": "Wrapper around PHP's tokenizer extension.", 1005 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/", 1006 | "keywords": [ 1007 | "tokenizer" 1008 | ], 1009 | "time": "2017-02-27T10:12:30+00:00" 1010 | }, 1011 | { 1012 | "name": "phpunit/phpunit", 1013 | "version": "4.8.36", 1014 | "source": { 1015 | "type": "git", 1016 | "url": "https://github.com/sebastianbergmann/phpunit.git", 1017 | "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" 1018 | }, 1019 | "dist": { 1020 | "type": "zip", 1021 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", 1022 | "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", 1023 | "shasum": "" 1024 | }, 1025 | "require": { 1026 | "ext-dom": "*", 1027 | "ext-json": "*", 1028 | "ext-pcre": "*", 1029 | "ext-reflection": "*", 1030 | "ext-spl": "*", 1031 | "php": ">=5.3.3", 1032 | "phpspec/prophecy": "^1.3.1", 1033 | "phpunit/php-code-coverage": "~2.1", 1034 | "phpunit/php-file-iterator": "~1.4", 1035 | "phpunit/php-text-template": "~1.2", 1036 | "phpunit/php-timer": "^1.0.6", 1037 | "phpunit/phpunit-mock-objects": "~2.3", 1038 | "sebastian/comparator": "~1.2.2", 1039 | "sebastian/diff": "~1.2", 1040 | "sebastian/environment": "~1.3", 1041 | "sebastian/exporter": "~1.2", 1042 | "sebastian/global-state": "~1.0", 1043 | "sebastian/version": "~1.0", 1044 | "symfony/yaml": "~2.1|~3.0" 1045 | }, 1046 | "suggest": { 1047 | "phpunit/php-invoker": "~1.1" 1048 | }, 1049 | "bin": [ 1050 | "phpunit" 1051 | ], 1052 | "type": "library", 1053 | "extra": { 1054 | "branch-alias": { 1055 | "dev-master": "4.8.x-dev" 1056 | } 1057 | }, 1058 | "autoload": { 1059 | "classmap": [ 1060 | "src/" 1061 | ] 1062 | }, 1063 | "notification-url": "https://packagist.org/downloads/", 1064 | "license": [ 1065 | "BSD-3-Clause" 1066 | ], 1067 | "authors": [ 1068 | { 1069 | "name": "Sebastian Bergmann", 1070 | "email": "sebastian@phpunit.de", 1071 | "role": "lead" 1072 | } 1073 | ], 1074 | "description": "The PHP Unit Testing framework.", 1075 | "homepage": "https://phpunit.de/", 1076 | "keywords": [ 1077 | "phpunit", 1078 | "testing", 1079 | "xunit" 1080 | ], 1081 | "time": "2017-06-21T08:07:12+00:00" 1082 | }, 1083 | { 1084 | "name": "phpunit/phpunit-mock-objects", 1085 | "version": "2.3.8", 1086 | "source": { 1087 | "type": "git", 1088 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 1089 | "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" 1090 | }, 1091 | "dist": { 1092 | "type": "zip", 1093 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", 1094 | "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", 1095 | "shasum": "" 1096 | }, 1097 | "require": { 1098 | "doctrine/instantiator": "^1.0.2", 1099 | "php": ">=5.3.3", 1100 | "phpunit/php-text-template": "~1.2", 1101 | "sebastian/exporter": "~1.2" 1102 | }, 1103 | "require-dev": { 1104 | "phpunit/phpunit": "~4.4" 1105 | }, 1106 | "suggest": { 1107 | "ext-soap": "*" 1108 | }, 1109 | "type": "library", 1110 | "extra": { 1111 | "branch-alias": { 1112 | "dev-master": "2.3.x-dev" 1113 | } 1114 | }, 1115 | "autoload": { 1116 | "classmap": [ 1117 | "src/" 1118 | ] 1119 | }, 1120 | "notification-url": "https://packagist.org/downloads/", 1121 | "license": [ 1122 | "BSD-3-Clause" 1123 | ], 1124 | "authors": [ 1125 | { 1126 | "name": "Sebastian Bergmann", 1127 | "email": "sb@sebastian-bergmann.de", 1128 | "role": "lead" 1129 | } 1130 | ], 1131 | "description": "Mock Object library for PHPUnit", 1132 | "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", 1133 | "keywords": [ 1134 | "mock", 1135 | "xunit" 1136 | ], 1137 | "time": "2015-10-02T06:51:40+00:00" 1138 | }, 1139 | { 1140 | "name": "sebastian/comparator", 1141 | "version": "1.2.4", 1142 | "source": { 1143 | "type": "git", 1144 | "url": "https://github.com/sebastianbergmann/comparator.git", 1145 | "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" 1146 | }, 1147 | "dist": { 1148 | "type": "zip", 1149 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", 1150 | "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", 1151 | "shasum": "" 1152 | }, 1153 | "require": { 1154 | "php": ">=5.3.3", 1155 | "sebastian/diff": "~1.2", 1156 | "sebastian/exporter": "~1.2 || ~2.0" 1157 | }, 1158 | "require-dev": { 1159 | "phpunit/phpunit": "~4.4" 1160 | }, 1161 | "type": "library", 1162 | "extra": { 1163 | "branch-alias": { 1164 | "dev-master": "1.2.x-dev" 1165 | } 1166 | }, 1167 | "autoload": { 1168 | "classmap": [ 1169 | "src/" 1170 | ] 1171 | }, 1172 | "notification-url": "https://packagist.org/downloads/", 1173 | "license": [ 1174 | "BSD-3-Clause" 1175 | ], 1176 | "authors": [ 1177 | { 1178 | "name": "Jeff Welch", 1179 | "email": "whatthejeff@gmail.com" 1180 | }, 1181 | { 1182 | "name": "Volker Dusch", 1183 | "email": "github@wallbash.com" 1184 | }, 1185 | { 1186 | "name": "Bernhard Schussek", 1187 | "email": "bschussek@2bepublished.at" 1188 | }, 1189 | { 1190 | "name": "Sebastian Bergmann", 1191 | "email": "sebastian@phpunit.de" 1192 | } 1193 | ], 1194 | "description": "Provides the functionality to compare PHP values for equality", 1195 | "homepage": "http://www.github.com/sebastianbergmann/comparator", 1196 | "keywords": [ 1197 | "comparator", 1198 | "compare", 1199 | "equality" 1200 | ], 1201 | "time": "2017-01-29T09:50:25+00:00" 1202 | }, 1203 | { 1204 | "name": "sebastian/environment", 1205 | "version": "1.3.8", 1206 | "source": { 1207 | "type": "git", 1208 | "url": "https://github.com/sebastianbergmann/environment.git", 1209 | "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" 1210 | }, 1211 | "dist": { 1212 | "type": "zip", 1213 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", 1214 | "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", 1215 | "shasum": "" 1216 | }, 1217 | "require": { 1218 | "php": "^5.3.3 || ^7.0" 1219 | }, 1220 | "require-dev": { 1221 | "phpunit/phpunit": "^4.8 || ^5.0" 1222 | }, 1223 | "type": "library", 1224 | "extra": { 1225 | "branch-alias": { 1226 | "dev-master": "1.3.x-dev" 1227 | } 1228 | }, 1229 | "autoload": { 1230 | "classmap": [ 1231 | "src/" 1232 | ] 1233 | }, 1234 | "notification-url": "https://packagist.org/downloads/", 1235 | "license": [ 1236 | "BSD-3-Clause" 1237 | ], 1238 | "authors": [ 1239 | { 1240 | "name": "Sebastian Bergmann", 1241 | "email": "sebastian@phpunit.de" 1242 | } 1243 | ], 1244 | "description": "Provides functionality to handle HHVM/PHP environments", 1245 | "homepage": "http://www.github.com/sebastianbergmann/environment", 1246 | "keywords": [ 1247 | "Xdebug", 1248 | "environment", 1249 | "hhvm" 1250 | ], 1251 | "time": "2016-08-18T05:49:44+00:00" 1252 | }, 1253 | { 1254 | "name": "sebastian/exporter", 1255 | "version": "1.2.2", 1256 | "source": { 1257 | "type": "git", 1258 | "url": "https://github.com/sebastianbergmann/exporter.git", 1259 | "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" 1260 | }, 1261 | "dist": { 1262 | "type": "zip", 1263 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", 1264 | "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", 1265 | "shasum": "" 1266 | }, 1267 | "require": { 1268 | "php": ">=5.3.3", 1269 | "sebastian/recursion-context": "~1.0" 1270 | }, 1271 | "require-dev": { 1272 | "ext-mbstring": "*", 1273 | "phpunit/phpunit": "~4.4" 1274 | }, 1275 | "type": "library", 1276 | "extra": { 1277 | "branch-alias": { 1278 | "dev-master": "1.3.x-dev" 1279 | } 1280 | }, 1281 | "autoload": { 1282 | "classmap": [ 1283 | "src/" 1284 | ] 1285 | }, 1286 | "notification-url": "https://packagist.org/downloads/", 1287 | "license": [ 1288 | "BSD-3-Clause" 1289 | ], 1290 | "authors": [ 1291 | { 1292 | "name": "Jeff Welch", 1293 | "email": "whatthejeff@gmail.com" 1294 | }, 1295 | { 1296 | "name": "Volker Dusch", 1297 | "email": "github@wallbash.com" 1298 | }, 1299 | { 1300 | "name": "Bernhard Schussek", 1301 | "email": "bschussek@2bepublished.at" 1302 | }, 1303 | { 1304 | "name": "Sebastian Bergmann", 1305 | "email": "sebastian@phpunit.de" 1306 | }, 1307 | { 1308 | "name": "Adam Harvey", 1309 | "email": "aharvey@php.net" 1310 | } 1311 | ], 1312 | "description": "Provides the functionality to export PHP variables for visualization", 1313 | "homepage": "http://www.github.com/sebastianbergmann/exporter", 1314 | "keywords": [ 1315 | "export", 1316 | "exporter" 1317 | ], 1318 | "time": "2016-06-17T09:04:28+00:00" 1319 | }, 1320 | { 1321 | "name": "sebastian/global-state", 1322 | "version": "1.1.1", 1323 | "source": { 1324 | "type": "git", 1325 | "url": "https://github.com/sebastianbergmann/global-state.git", 1326 | "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" 1327 | }, 1328 | "dist": { 1329 | "type": "zip", 1330 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", 1331 | "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", 1332 | "shasum": "" 1333 | }, 1334 | "require": { 1335 | "php": ">=5.3.3" 1336 | }, 1337 | "require-dev": { 1338 | "phpunit/phpunit": "~4.2" 1339 | }, 1340 | "suggest": { 1341 | "ext-uopz": "*" 1342 | }, 1343 | "type": "library", 1344 | "extra": { 1345 | "branch-alias": { 1346 | "dev-master": "1.0-dev" 1347 | } 1348 | }, 1349 | "autoload": { 1350 | "classmap": [ 1351 | "src/" 1352 | ] 1353 | }, 1354 | "notification-url": "https://packagist.org/downloads/", 1355 | "license": [ 1356 | "BSD-3-Clause" 1357 | ], 1358 | "authors": [ 1359 | { 1360 | "name": "Sebastian Bergmann", 1361 | "email": "sebastian@phpunit.de" 1362 | } 1363 | ], 1364 | "description": "Snapshotting of global state", 1365 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 1366 | "keywords": [ 1367 | "global state" 1368 | ], 1369 | "time": "2015-10-12T03:26:01+00:00" 1370 | }, 1371 | { 1372 | "name": "sebastian/recursion-context", 1373 | "version": "1.0.5", 1374 | "source": { 1375 | "type": "git", 1376 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 1377 | "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" 1378 | }, 1379 | "dist": { 1380 | "type": "zip", 1381 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", 1382 | "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", 1383 | "shasum": "" 1384 | }, 1385 | "require": { 1386 | "php": ">=5.3.3" 1387 | }, 1388 | "require-dev": { 1389 | "phpunit/phpunit": "~4.4" 1390 | }, 1391 | "type": "library", 1392 | "extra": { 1393 | "branch-alias": { 1394 | "dev-master": "1.0.x-dev" 1395 | } 1396 | }, 1397 | "autoload": { 1398 | "classmap": [ 1399 | "src/" 1400 | ] 1401 | }, 1402 | "notification-url": "https://packagist.org/downloads/", 1403 | "license": [ 1404 | "BSD-3-Clause" 1405 | ], 1406 | "authors": [ 1407 | { 1408 | "name": "Jeff Welch", 1409 | "email": "whatthejeff@gmail.com" 1410 | }, 1411 | { 1412 | "name": "Sebastian Bergmann", 1413 | "email": "sebastian@phpunit.de" 1414 | }, 1415 | { 1416 | "name": "Adam Harvey", 1417 | "email": "aharvey@php.net" 1418 | } 1419 | ], 1420 | "description": "Provides functionality to recursively process PHP variables", 1421 | "homepage": "http://www.github.com/sebastianbergmann/recursion-context", 1422 | "time": "2016-10-03T07:41:43+00:00" 1423 | }, 1424 | { 1425 | "name": "sebastian/version", 1426 | "version": "1.0.6", 1427 | "source": { 1428 | "type": "git", 1429 | "url": "https://github.com/sebastianbergmann/version.git", 1430 | "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" 1431 | }, 1432 | "dist": { 1433 | "type": "zip", 1434 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", 1435 | "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", 1436 | "shasum": "" 1437 | }, 1438 | "type": "library", 1439 | "autoload": { 1440 | "classmap": [ 1441 | "src/" 1442 | ] 1443 | }, 1444 | "notification-url": "https://packagist.org/downloads/", 1445 | "license": [ 1446 | "BSD-3-Clause" 1447 | ], 1448 | "authors": [ 1449 | { 1450 | "name": "Sebastian Bergmann", 1451 | "email": "sebastian@phpunit.de", 1452 | "role": "lead" 1453 | } 1454 | ], 1455 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1456 | "homepage": "https://github.com/sebastianbergmann/version", 1457 | "time": "2015-06-21T13:59:46+00:00" 1458 | }, 1459 | { 1460 | "name": "symfony/yaml", 1461 | "version": "v2.8.28", 1462 | "source": { 1463 | "type": "git", 1464 | "url": "https://github.com/symfony/yaml.git", 1465 | "reference": "842fb6df22180244b4c65935ce1a88d324e5ff9e" 1466 | }, 1467 | "dist": { 1468 | "type": "zip", 1469 | "url": "https://api.github.com/repos/symfony/yaml/zipball/842fb6df22180244b4c65935ce1a88d324e5ff9e", 1470 | "reference": "842fb6df22180244b4c65935ce1a88d324e5ff9e", 1471 | "shasum": "" 1472 | }, 1473 | "require": { 1474 | "php": ">=5.3.9" 1475 | }, 1476 | "type": "library", 1477 | "extra": { 1478 | "branch-alias": { 1479 | "dev-master": "2.8-dev" 1480 | } 1481 | }, 1482 | "autoload": { 1483 | "psr-4": { 1484 | "Symfony\\Component\\Yaml\\": "" 1485 | }, 1486 | "exclude-from-classmap": [ 1487 | "/Tests/" 1488 | ] 1489 | }, 1490 | "notification-url": "https://packagist.org/downloads/", 1491 | "license": [ 1492 | "MIT" 1493 | ], 1494 | "authors": [ 1495 | { 1496 | "name": "Fabien Potencier", 1497 | "email": "fabien@symfony.com" 1498 | }, 1499 | { 1500 | "name": "Symfony Community", 1501 | "homepage": "https://symfony.com/contributors" 1502 | } 1503 | ], 1504 | "description": "Symfony Yaml Component", 1505 | "homepage": "https://symfony.com", 1506 | "time": "2017-10-05T14:38:30+00:00" 1507 | } 1508 | ], 1509 | "aliases": [], 1510 | "minimum-stability": "stable", 1511 | "stability-flags": [], 1512 | "prefer-stable": false, 1513 | "prefer-lowest": false, 1514 | "platform": { 1515 | "php": ">=5.4" 1516 | }, 1517 | "platform-dev": [] 1518 | } 1519 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | tests 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Console/Application.php: -------------------------------------------------------------------------------- 1 | add(new Command\FixCommand()); 15 | $this->add(new Command\ReadmeCommand()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Console/Command/FixCommand.php: -------------------------------------------------------------------------------- 1 | setName('fix') 22 | ->setDefinition( 23 | [ 24 | new InputArgument('path', InputArgument::REQUIRED), 25 | new InputOption('dry-run', '', InputOption::VALUE_NONE, 'Only shows which files would have been modified'), 26 | new InputOption('no-use-reorder', '', InputOption::VALUE_NONE, 'Dot not reorder USE statements alphabetically'), 27 | new InputOption('fixers', '', InputOption::VALUE_REQUIRED, 'Use only specified fixers (separated by comma)'), 28 | ] 29 | ) 30 | ->setDescription('Fixes a directory or a file') 31 | ; 32 | } 33 | 34 | protected function execute(InputInterface $input, OutputInterface $output) 35 | { 36 | $errorsManager = new ErrorsManager(); 37 | $stopwatch = new Stopwatch(); 38 | 39 | $fixer = new Fixer( 40 | $this->getFinder($input->getArgument('path')), 41 | $errorsManager, 42 | $stopwatch 43 | ); 44 | 45 | if ($fixers = $input->getOption('fixers')) { 46 | $fixersList = explode(',', $fixers); 47 | $fixersList = array_map('trim', $fixersList); 48 | $fixer->registerBuiltInFixers($fixersList); 49 | } else { 50 | $fixer->registerAllBuiltInFixers(); 51 | } 52 | 53 | 54 | if (! $input->getOption('no-use-reorder')) { 55 | $fixer->addFixer(new OrderedUseFixer()); 56 | } 57 | 58 | $stopwatch->start('fixFiles'); 59 | 60 | $changed = $fixer->fix( 61 | $input->getOption('dry-run') 62 | ); 63 | 64 | $stopwatch->stop('fixFiles'); 65 | 66 | $verbosity = $output->getVerbosity(); 67 | 68 | $i = 1; 69 | 70 | foreach ($changed as $file => $fixResult) { 71 | $output->write(sprintf('%4d) %s', $i++, $file)); 72 | 73 | if (OutputInterface::VERBOSITY_VERBOSE <= $verbosity) { 74 | $output->write(sprintf(' (%s)', implode(', ', $fixResult))); 75 | } 76 | 77 | $output->writeln(''); 78 | } 79 | 80 | if (OutputInterface::VERBOSITY_DEBUG <= $verbosity) { 81 | $output->writeln('Fixing time per file:'); 82 | 83 | foreach ($stopwatch->getSectionEvents('fixFile') as $file => $event) { 84 | if ('__section__' === $file) { 85 | continue; 86 | } 87 | 88 | $output->writeln(sprintf('[%.3f s] %s', $event->getDuration() / 1000, $file)); 89 | } 90 | 91 | $output->writeln(''); 92 | } 93 | 94 | $fixEvent = $stopwatch->getEvent('fixFiles'); 95 | $output->writeln(sprintf('Fixed all files in %.3f seconds, %.3f MB memory used', $fixEvent->getDuration() / 1000, $fixEvent->getMemory() / 1024 / 1024)); 96 | 97 | if (!$errorsManager->isEmpty()) { 98 | $output->writeLn(''); 99 | $output->writeLn('Files that were not fixed due to internal error:'); 100 | 101 | foreach ($errorsManager->getErrors() as $i => $error) { 102 | $output->writeLn(sprintf('%4d) %s', $i + 1, $error['filepath'])); 103 | } 104 | } 105 | 106 | return empty($changed) ? 0 : 1; 107 | } 108 | 109 | private function getFinder($path) 110 | { 111 | if (is_file($path)) { 112 | return new \ArrayIterator([new \SplFileInfo($path)]); 113 | } 114 | 115 | $finder = new DefaultFinder(); 116 | $finder->setDir($path); 117 | 118 | return $finder; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Console/Command/ReadmeCommand.php: -------------------------------------------------------------------------------- 1 | setName('readme') 17 | ->setDescription('Generates the README content') 18 | ; 19 | } 20 | 21 | protected function execute(InputInterface $input, OutputInterface $output) 22 | { 23 | $fixersContent = ''; 24 | foreach (new FixerIterator() as $fixer) { 25 | $fixersContent .= PHP_EOL.sprintf('| %s | %s |', $fixer->getName(), $fixer->getDescription()); 26 | } 27 | 28 | $output->write(sprintf( 29 | file_get_contents(__DIR__.'/../../../../../README.tpl'), 30 | Fixer::VERSION, 31 | $fixersContent 32 | )); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer.php: -------------------------------------------------------------------------------- 1 | finder = $finder; 29 | $this->errorsManager = $errorsManager; 30 | $this->stopwatch = $stopwatch; 31 | } 32 | 33 | public function registerAllBuiltInFixers() 34 | { 35 | /** @var AbstractFixer $fixer */ 36 | foreach (new FixerIterator() as $fixer) { 37 | $this->addFixer($fixer); 38 | } 39 | } 40 | 41 | public function registerBuiltInFixers(array $fixerNameList) 42 | { 43 | /** @var AbstractFixer $fixer */ 44 | foreach (new FixerIterator() as $fixer) { 45 | if (in_array($fixer->getName(), $fixerNameList, true)) { 46 | $this->addFixer($fixer); 47 | } 48 | } 49 | } 50 | 51 | public function addFixer(FixerInterface $fixer) 52 | { 53 | $this->fixers[] = $fixer; 54 | } 55 | 56 | public function getFixers() 57 | { 58 | return $this->fixers; 59 | } 60 | 61 | public function fix($dryRun = false) 62 | { 63 | $changed = []; 64 | 65 | if ($this->stopwatch) { 66 | $this->stopwatch->openSection(); 67 | } 68 | 69 | foreach ($this->finder as $file) { 70 | if ($file->isDir() || $file->isLink()) { 71 | continue; 72 | } 73 | 74 | if ($this->stopwatch) { 75 | $this->stopwatch->start($this->getFileRelativePathname($file)); 76 | } 77 | 78 | if ($fixInfo = $this->fixFile($file, $dryRun)) { 79 | $changed[$this->getFileRelativePathname($file)] = $fixInfo; 80 | } 81 | 82 | if ($this->stopwatch) { 83 | $this->stopwatch->stop($this->getFileRelativePathname($file)); 84 | } 85 | } 86 | 87 | if ($this->stopwatch) { 88 | $this->stopwatch->stopSection('fixFile'); 89 | } 90 | 91 | return $changed; 92 | } 93 | 94 | private function fixFile(\SplFileInfo $file, $dryRun) 95 | { 96 | $new = $old = file_get_contents($file->getRealpath()); 97 | 98 | $appliedFixers = []; 99 | 100 | Tokens::clearCache(); 101 | 102 | try { 103 | foreach ($this->fixers as $fixer) { 104 | if (!$fixer->supports($file)) { 105 | continue; 106 | } 107 | 108 | $newest = $fixer->fix($file, $new); 109 | if ($newest !== $new) { 110 | $appliedFixers[] = $fixer->getName(); 111 | } 112 | $new = $newest; 113 | } 114 | } catch (\Exception $e) { 115 | if ($this->errorsManager) { 116 | $this->errorsManager->report(ErrorsManager::ERROR_TYPE_EXCEPTION, $this->getFileRelativePathname($file), $e->__toString()); 117 | } 118 | 119 | return; 120 | } 121 | 122 | if ($new !== $old) { 123 | if (!$dryRun) { 124 | file_put_contents($file->getRealpath(), $new); 125 | } 126 | } 127 | 128 | return $appliedFixers; 129 | } 130 | 131 | private function getFileRelativePathname(\SplFileInfo $file) 132 | { 133 | if ($file instanceof FinderSplFileInfo) { 134 | return $file->getRelativePathname(); 135 | } 136 | 137 | return $file->getPathname(); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/AbstractFixer.php: -------------------------------------------------------------------------------- 1 | getUseStatements($tokens, $fqcn); 14 | } 15 | 16 | protected function getUseStatements(Tokens $tokens, array $fqcn) 17 | { 18 | $sequence = [[T_USE]]; 19 | 20 | foreach ($fqcn as $component) { 21 | $sequence = array_merge( 22 | $sequence, 23 | [[T_STRING, $component], [T_NS_SEPARATOR]] 24 | ); 25 | } 26 | 27 | $sequence[count($sequence) - 1] = ';'; 28 | 29 | return $tokens->findSequence($sequence); 30 | } 31 | 32 | protected function renameUseStatements(Tokens $tokens, array $oldFqcn, $newClassName) 33 | { 34 | $matchedTokens = $this->getUseStatements($tokens, $oldFqcn); 35 | if (null === $matchedTokens) { 36 | return false; 37 | } 38 | 39 | $matchedTokensIndexes = array_keys($matchedTokens); 40 | 41 | $classNameToken = $matchedTokens[$matchedTokensIndexes[count($matchedTokensIndexes) - 2]]; 42 | $classNameToken->setContent($newClassName); 43 | 44 | return true; 45 | } 46 | 47 | protected function addUseStatement(Tokens $tokens, array $fqcn, $alias = null) 48 | { 49 | if ($this->hasUseStatements($tokens, $fqcn)) { 50 | return; 51 | } 52 | 53 | $importUseIndexes = $tokens->getImportUseIndexes(); 54 | if (!isset($importUseIndexes[0])) { 55 | return; 56 | } 57 | 58 | $fqcnTokens = []; 59 | foreach ($fqcn as $fqcnComponent) { 60 | $fqcnTokens[] = new Token([T_STRING, $fqcnComponent]); 61 | $fqcnTokens[] = new Token([T_NS_SEPARATOR, '\\']); 62 | } 63 | array_pop($fqcnTokens); 64 | 65 | if ($alias) { 66 | $fqcnTokens[] = new Token([T_WHITESPACE, ' ']); 67 | $fqcnTokens[] = new Token([T_AS, 'as']); 68 | $fqcnTokens[] = new Token([T_WHITESPACE, ' ']); 69 | $fqcnTokens[] = new Token([T_STRING, $alias]); 70 | } 71 | 72 | $tokens->insertAt( 73 | $importUseIndexes[0], 74 | array_merge( 75 | [ 76 | new Token([T_USE, 'use']), 77 | new Token([T_WHITESPACE, ' ']), 78 | ], 79 | $fqcnTokens, 80 | [ 81 | new Token(';'), 82 | new Token([T_WHITESPACE, PHP_EOL]), 83 | ] 84 | ) 85 | ); 86 | } 87 | 88 | protected function extendsClass(Tokens $tokens, array $fqcn) 89 | { 90 | if (!$this->hasUseStatements($tokens, $fqcn)) { 91 | return false; 92 | } 93 | 94 | return $tokens->findSequence([ 95 | [T_CLASS], 96 | [T_STRING], 97 | [T_EXTENDS], 98 | [T_STRING, array_pop($fqcn)], 99 | ]); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/FormConfigureOptionsFixer.php: -------------------------------------------------------------------------------- 1 | isFormType($tokens) && null !== $this->matchSetDefaultOptionsMethod($tokens)) { 14 | $this->fixConfigureOptions($tokens); 15 | $this->fixUseStatements($tokens); 16 | } 17 | 18 | return $tokens->generateCode(); 19 | } 20 | 21 | public function getDescription() 22 | { 23 | return 'The method AbstractType::setDefaultOptions(OptionsResolverInterface $resolver) have been renamed to AbstractType::configureOptions(OptionsResolver $resolver).'; 24 | } 25 | 26 | private function matchSetDefaultOptionsMethod(Tokens $tokens) 27 | { 28 | return $tokens->findSequence([ 29 | [T_PUBLIC, 'public'], 30 | [T_FUNCTION], 31 | [T_STRING, 'setDefaultOptions'], 32 | '(', 33 | ]); 34 | } 35 | 36 | private function fixConfigureOptions(Tokens $tokens) 37 | { 38 | $matchedTokens = $this->matchSetDefaultOptionsMethod($tokens); 39 | if (null === $matchedTokens) { 40 | return; 41 | } 42 | 43 | $matchedIndexes = array_keys($matchedTokens); 44 | $matchedIndex = $matchedIndexes[count($matchedIndexes) - 2]; 45 | $matchedTokens[$matchedIndex]->override([T_STRING, 'configureOptions']); 46 | 47 | $typeHint = $tokens[$tokens->getNextMeaningfulToken(end($matchedIndexes))]; 48 | 49 | if (!$typeHint->isGivenKind(T_STRING) || $typeHint->getContent() !== 'OptionsResolverInterface') { 50 | return; 51 | } 52 | 53 | $typeHint->setContent('OptionsResolver'); 54 | } 55 | 56 | private function fixUseStatements(Tokens $tokens) 57 | { 58 | $classIndexes = array_keys($tokens->findGivenKind(T_CLASS)); 59 | 60 | if ($tokens->findSequence([[T_STRING, 'OptionsResolverInterface']], array_pop($classIndexes))) { 61 | return $this->addUseStatement($tokens, ['Symfony', 'Component', 'OptionsResolver', 'OptionsResolver']); 62 | } 63 | 64 | $this->renameUseStatements($tokens, ['Symfony', 'Component', 'OptionsResolver', 'OptionsResolverInterface'], 'OptionsResolver'); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/FormEventsFixer.php: -------------------------------------------------------------------------------- 1 | hasUseStatements( 14 | $tokens, 15 | ['Symfony', 'Component', 'Form', 'FormEvents'] 16 | ); 17 | 18 | if ($used) { 19 | $this->renameConstants($tokens, 'FormEvents', 'PRE_BIND', 'PRE_SUBMIT'); 20 | $this->renameConstants($tokens, 'FormEvents', 'BIND', 'SUBMIT'); 21 | $this->renameConstants($tokens, 'FormEvents', 'POST_BIND', 'POST_SUBMIT'); 22 | } 23 | 24 | return $tokens->generateCode(); 25 | } 26 | 27 | public function getDescription() 28 | { 29 | return 'The events PRE_BIND, BIND and POST_BIND were renamed to PRE_SUBMIT, SUBMIT and POST_SUBMIT.'; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/FormExtensionFixer.php: -------------------------------------------------------------------------------- 1 | extendsClass($tokens, ['Symfony', 'Component', 'Form', 'AbstractTypeExtension']); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/FormExtensionGetExtendedTypeFixer.php: -------------------------------------------------------------------------------- 1 | isFormType($tokens)) { 18 | foreach ($this->types as $type) { 19 | if (null === $this->matchGetExtendedType($tokens, $type)) { 20 | continue; 21 | } 22 | 23 | $this->addTypeUse($tokens, $type); 24 | $this->fixGetExtendedTypeMethod($tokens, $type); 25 | } 26 | } 27 | 28 | return $tokens->generateCode(); 29 | } 30 | 31 | /** 32 | * @param Tokens $tokens 33 | * @param string $name 34 | * @return Token[]|null 35 | */ 36 | private function matchGetExtendedType(Tokens $tokens, $name) 37 | { 38 | return $tokens->findSequence([ 39 | [T_PUBLIC, 'public'], 40 | [T_FUNCTION], 41 | [T_STRING, 'getExtendedType'], 42 | '(', 43 | ')', 44 | '{', 45 | [T_RETURN], 46 | [T_CONSTANT_ENCAPSED_STRING, sprintf("'%s'", strtolower($name))], 47 | ';', 48 | '}', 49 | ]); 50 | } 51 | 52 | /** 53 | * @param Tokens $tokens 54 | * @param string $name 55 | */ 56 | private function fixGetExtendedTypeMethod(Tokens $tokens, $name) 57 | { 58 | $matchedTokens = $this->matchGetExtendedType($tokens, $name); 59 | if (null === $matchedTokens) { 60 | return; 61 | } 62 | 63 | $matchedIndexes = array_keys($matchedTokens); 64 | 65 | $matchedIndex = $matchedIndexes[count($matchedIndexes) - 3]; 66 | 67 | $tokens->insertAt( 68 | $matchedIndex, 69 | [ 70 | new Token([T_STRING, $name.'Type']), 71 | new Token([T_DOUBLE_COLON, '::']), 72 | ] 73 | ); 74 | $matchedTokens[$matchedIndex]->override([CT_CLASS_CONSTANT, 'class']); 75 | 76 | $this->fixGetExtendedTypeMethod($tokens, $name); 77 | } 78 | 79 | /** 80 | * {@inheritdoc} 81 | */ 82 | public function getDescription() 83 | { 84 | return 'Type extension must return the fully-qualified class name of the extended type from FormTypeExtensionInterface::getExtendedType() now.'; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/FormGetnameToGetblockprefixFixer.php: -------------------------------------------------------------------------------- 1 | isFormType($tokens)) { 17 | $this->fixGetNameMethod($tokens); 18 | } 19 | 20 | return $tokens->generateCode(); 21 | } 22 | 23 | private function hasBlockPrefix(Tokens $tokens) 24 | { 25 | return count($tokens->findSequence([ 26 | [T_PUBLIC, 'public'], 27 | [T_FUNCTION], 28 | [T_STRING, 'getBlockPrefix'], 29 | '(', 30 | ')', 31 | ])) > 0; 32 | } 33 | 34 | private function matchGetNameMethod(Tokens $tokens) 35 | { 36 | return $tokens->findSequence([ 37 | [T_PUBLIC, 'public'], 38 | [T_FUNCTION], 39 | [T_STRING, 'getName'], 40 | '(', 41 | ')', 42 | ]); 43 | } 44 | 45 | private function fixGetNameMethod(Tokens $tokens) 46 | { 47 | $matchedTokens = $this->matchGetNameMethod($tokens); 48 | if (null === $matchedTokens || $this->hasBlockPrefix($tokens)) { 49 | return; 50 | } 51 | 52 | $matchedIndexes = array_keys($matchedTokens); 53 | $matchedIndex = $matchedIndexes[count($matchedIndexes) - 3]; 54 | $matchedTokens[$matchedIndex]->setContent('getBlockPrefix'); 55 | } 56 | 57 | /** 58 | * {@inheritdoc} 59 | */ 60 | public function getDescription() 61 | { 62 | return 'The method FormTypeInterface::getName() was deprecated, you should now implement FormTypeInterface::getBlockPrefix() instead.'; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/FormOptionNamesFixer.php: -------------------------------------------------------------------------------- 1 | isFormType($tokens)) { 14 | $fieldNameTokenSets = [ 15 | [[T_CONSTANT_ENCAPSED_STRING]], 16 | [[T_STRING], [T_DOUBLE_COLON], [CT_CLASS_CONSTANT]], 17 | ]; 18 | 19 | foreach ($fieldNameTokenSets as $fieldNameTokens) { 20 | $fieldNames = [ 21 | 'precision' => 'scale', 22 | 'virtual' => 'inherit_data', 23 | ]; 24 | 25 | foreach ($fieldNames as $oldName => $newName) { 26 | $this->fixOptionNames($tokens, $fieldNameTokens, $oldName, $newName); 27 | } 28 | } 29 | } 30 | 31 | return $tokens->generateCode(); 32 | } 33 | 34 | public function getDescription() 35 | { 36 | return 'Options precision and virtual was renamed to scale and inherit_data.'; 37 | } 38 | 39 | private function fixOptionNames(Tokens $tokens, $fieldNameTokens, $oldName, $newName, $start = 0) 40 | { 41 | $matchedTokens = $tokens->findSequence(array_merge( 42 | [ 43 | [T_OBJECT_OPERATOR], 44 | [T_STRING, 'add'], 45 | '(', 46 | [T_CONSTANT_ENCAPSED_STRING], 47 | ',', 48 | ], 49 | $fieldNameTokens, 50 | [','] 51 | ), $start); 52 | 53 | if (null === $matchedTokens) { 54 | return; 55 | } 56 | 57 | $matchedTokenIndexes = array_keys($matchedTokens); 58 | $isArray = $tokens->isArray( 59 | $index = $tokens->getNextMeaningfulToken(end($matchedTokenIndexes)) 60 | ); 61 | 62 | if (!$isArray) { 63 | return; 64 | } 65 | 66 | do { 67 | $index = $tokens->getNextMeaningfulToken($index); 68 | $token = $tokens[$index]; 69 | 70 | if (!$token->isGivenKind(T_CONSTANT_ENCAPSED_STRING)) { 71 | continue; 72 | } 73 | 74 | if ("'$oldName'" === $token->getContent()) { 75 | $token->setContent("'$newName'"); 76 | } 77 | } while (!in_array($token->getContent(), [')', ']'])); 78 | 79 | $this->fixOptionNames($tokens, $fieldNameTokens, $oldName, $newName, $index); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/FormParentTypeFixer.php: -------------------------------------------------------------------------------- 1 | isFormType($tokens)) { 15 | $className = $this->getCurrentTypeClass($tokens); 16 | foreach ($this->types as $type) { 17 | if (null === $this->matchGetParentMethod($tokens, $type)) { 18 | continue; 19 | } 20 | 21 | $alias = $this->getTypeClassAlias($type, $className); 22 | $this->addTypeUse($tokens, $type, $alias); 23 | $this->fixParentTypes($tokens, $type, $alias); 24 | } 25 | } 26 | 27 | return $tokens->generateCode(); 28 | } 29 | 30 | public function getDescription() 31 | { 32 | return 'Returning type instances from FormTypeInterface::getParent() is deprecated, return the fully-qualified class name of the parent type class instead.'; 33 | } 34 | 35 | private function matchGetParentMethod(Tokens $tokens, $name) 36 | { 37 | return $tokens->findSequence([ 38 | [T_PUBLIC, 'public'], 39 | [T_FUNCTION], 40 | [T_STRING, 'getParent'], 41 | '(', 42 | ')', 43 | '{', 44 | [T_RETURN], 45 | [T_CONSTANT_ENCAPSED_STRING, sprintf("'%s'", strtolower($name))], 46 | ';', 47 | '}', 48 | ]); 49 | } 50 | 51 | private function fixParentTypes(Tokens $tokens, $name, $alias) 52 | { 53 | $matchedTokens = $this->matchGetParentMethod($tokens, $name); 54 | if (null === $matchedTokens) { 55 | return; 56 | } 57 | 58 | $matchedIndexes = array_keys($matchedTokens); 59 | 60 | $matchedIndex = $matchedIndexes[count($matchedIndexes) - 3]; 61 | 62 | $tokens->insertAt( 63 | $matchedIndex, 64 | [ 65 | new Token([T_STRING, $alias ? $alias : $name.'Type']), 66 | new Token([T_DOUBLE_COLON, '::']), 67 | ] 68 | ); 69 | $matchedTokens[$matchedIndex]->override([CT_CLASS_CONSTANT, 'class']); 70 | 71 | $this->fixParentTypes($tokens, $name, $alias); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/FormTypeFixer.php: -------------------------------------------------------------------------------- 1 | extendsClass($tokens, ['Symfony', 'Component', 'Form', 'AbstractType']); 49 | } 50 | 51 | protected function getCurrentTypeClass(Tokens $tokens) 52 | { 53 | $tokens = $this->extendsClass($tokens, ['Symfony', 'Component', 'Form', 'AbstractType']); 54 | 55 | $classMet = false; 56 | /** @var Token $token */ 57 | foreach ($tokens as $token) { 58 | if (!$classMet) { 59 | $classMet = $token->getId() === T_CLASS; 60 | continue; 61 | } 62 | 63 | if (!$token->isEmpty()) { 64 | return $token->getContent(); 65 | } 66 | } 67 | 68 | return null; 69 | } 70 | 71 | protected function addTypeUse(Tokens $tokens, $name, $alias = null) 72 | { 73 | $this->addUseStatement( 74 | $tokens, 75 | ['Symfony', 'Component', 'Form', 'Extension', 'Core', 'Type', $this->getTypeName($name)], 76 | $alias 77 | ); 78 | } 79 | 80 | protected function getTypeName($name) 81 | { 82 | return ucfirst($name).'Type'; 83 | } 84 | 85 | protected function getTypeClassAlias($type, $currentClassName) 86 | { 87 | $typeClass = $this->getTypeName($type); 88 | if ($typeClass === $currentClassName) { 89 | return self::PREFIX_SYMFONY_TYPE.$typeClass; 90 | } 91 | 92 | return null; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/FormTypeNamesFixer.php: -------------------------------------------------------------------------------- 1 | isFormType($tokens)) { 15 | $className = $this->getCurrentTypeClass($tokens); 16 | foreach ($this->types as $type) { 17 | if (null === $this->matchTypeName($tokens, $type)) { 18 | continue; 19 | } 20 | 21 | if (PHP_VERSION_ID < 50500) { 22 | $this->fixTypeNamesLegacy($tokens, $type); 23 | } else { 24 | $alias = $this->getTypeClassAlias($type, $className); 25 | $this->addTypeUse($tokens, $type, $alias); 26 | $this->fixTypeNames($tokens, $type, $alias); 27 | } 28 | } 29 | } 30 | 31 | return $tokens->generateCode(); 32 | } 33 | 34 | public function getDescription() 35 | { 36 | return 'Instead of referencing types by name, you should reference them by their fully-qualified class name (FQCN) instead.'; 37 | } 38 | 39 | private function matchTypeName(Tokens $tokens, $name) 40 | { 41 | return $tokens->findSequence([ 42 | [T_OBJECT_OPERATOR], 43 | [T_STRING, 'add'], 44 | '(', 45 | [T_CONSTANT_ENCAPSED_STRING], 46 | ',', 47 | [T_CONSTANT_ENCAPSED_STRING, sprintf("'%s'", strtolower($name))], 48 | ]); 49 | } 50 | 51 | private function fixTypeNames(Tokens $tokens, $name, $alias) 52 | { 53 | $matchedTokens = $this->matchTypeName($tokens, $name); 54 | if (null === $matchedTokens) { 55 | return; 56 | } 57 | 58 | $matchedIndexes = array_keys($matchedTokens); 59 | 60 | $matchedIndex = $matchedIndexes[count($matchedIndexes) - 1]; 61 | 62 | $tokens->insertAt( 63 | $matchedIndex, 64 | [ 65 | new Token([T_STRING, $alias ? $alias : $name.'Type']), 66 | new Token([T_DOUBLE_COLON, '::']), 67 | ] 68 | ); 69 | $matchedTokens[$matchedIndex]->override([CT_CLASS_CONSTANT, 'class']); 70 | 71 | $this->fixTypeNames($tokens, $name, $alias); 72 | } 73 | 74 | private function fixTypeNamesLegacy(Tokens $tokens, $name) 75 | { 76 | $matchedTokens = $this->matchTypeName($tokens, $name); 77 | if (null === $matchedTokens) { 78 | return; 79 | } 80 | 81 | $matchedIndexes = array_keys($matchedTokens); 82 | 83 | $matchedIndex = $matchedIndexes[count($matchedIndexes) - 1]; 84 | 85 | $matchedTokens[$matchedIndex]->setContent('\'Symfony\\Component\\Form\\Extension\\Core\\Type\\'.$name.'Type\''); 86 | 87 | $this->fixTypeNamesLegacy($tokens, $name); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/GetRequestFixer.php: -------------------------------------------------------------------------------- 1 | isController($tokens)) { 17 | $this->fixGetRequests($tokens); 18 | } 19 | 20 | return $tokens->generateCode(); 21 | } 22 | 23 | public function getDescription() 24 | { 25 | return 'The getRequest method of the base controller class was removed, request object is injected in the action method instead.'; 26 | } 27 | 28 | private function isController(Tokens $tokens) 29 | { 30 | return $this->extendsClass($tokens, ['Symfony', 'Bundle', 'FrameworkBundle', 'Controller', 'Controller']); 31 | } 32 | 33 | private function fixGetRequests(Tokens $tokens) 34 | { 35 | $todo = []; 36 | 37 | foreach ($this->getClassyElementsIndexed($tokens) as $i => $element) { 38 | if ('method' === $element['type']) { 39 | if ($this->fixActionParameters($tokens, $element['index'])) { 40 | $todo[] = $i; 41 | } 42 | } 43 | } 44 | 45 | foreach ($this->getClassyElementsIndexed($tokens) as $i => $element) { 46 | if (in_array($i, $todo)) { 47 | $this->fixActionBody($tokens, $element['index']); 48 | } 49 | } 50 | } 51 | 52 | private function getClassyElementsIndexed(Tokens $tokens) 53 | { 54 | $elements = []; 55 | 56 | foreach ($tokens->getClassyElements() as $index => $element) { 57 | $element['index'] = $index; 58 | $elements[] = $element; 59 | } 60 | 61 | return $elements; 62 | } 63 | 64 | private function fixActionParameters(Tokens $tokens, $index) 65 | { 66 | if (!$this->isAction($tokens, $index)) { 67 | return; 68 | } 69 | 70 | $parenthesisIndexes = $this->getActionParenthesisIndexes($tokens, $index); 71 | if ($this->hasRequestParameterSequence($tokens, $parenthesisIndexes[0], $parenthesisIndexes[1])) { 72 | return; 73 | } 74 | 75 | $curlyBraceIndexes = $this->getActionCurlyBraceIndexes($tokens, $index); 76 | if (!$this->hasGetRequestSequence($tokens, $curlyBraceIndexes[0], $curlyBraceIndexes[1])) { 77 | return; 78 | } 79 | 80 | if (null === $requestVariableName = $this->getRequestVariableName($tokens, $curlyBraceIndexes[0], $curlyBraceIndexes[1])) { 81 | $requestVariableName = $this->requestVariableName; 82 | } 83 | 84 | $insertAt = $tokens->getNextMeaningfulToken($parenthesisIndexes[0]); 85 | 86 | $tokens->insertAt( 87 | $insertAt, 88 | array_merge( 89 | [ 90 | new Token([T_STRING, 'Request']), 91 | new Token([T_WHITESPACE, ' ']), 92 | new Token([T_VARIABLE, $requestVariableName]), 93 | ], 94 | $parenthesisIndexes[1] - $parenthesisIndexes[0] > 1 ? [new Token(','), new Token([T_WHITESPACE, ' '])] : [] 95 | ) 96 | ); 97 | 98 | $this->addUseStatement( 99 | $tokens, 100 | ['Symfony', 'Component', 'HttpFoundation', 'Request'] 101 | ); 102 | 103 | return true; 104 | } 105 | 106 | private function fixActionBody(Tokens $tokens, $index) 107 | { 108 | $curlyBraceIndexes = $this->getActionCurlyBraceIndexes($tokens, $index); 109 | if (!$this->hasGetRequestSequence($tokens, $curlyBraceIndexes[0], $curlyBraceIndexes[1])) { 110 | return; 111 | } 112 | 113 | $clearFrom = $tmp = $this->getRequestVariableTokenIndex($tokens, $curlyBraceIndexes[0], $curlyBraceIndexes[1]); 114 | $getRequestSequenceTokens = $this->getGetRequestSequence($tokens, $curlyBraceIndexes[0], $curlyBraceIndexes[1]); 115 | $keys = array_keys($getRequestSequenceTokens); 116 | $clearTo = array_pop($keys); 117 | $clearTo = $tokens->getNextMeaningfulToken($clearTo); 118 | if ($tokens[$clearTo]->equals(';')) { 119 | $tokens->clearRange($clearFrom, $clearTo); 120 | $tokens->removeTrailingWhitespace($clearTo); 121 | 122 | return; 123 | } 124 | 125 | $replace = true; 126 | foreach ($getRequestSequenceTokens as $key => $getRequestSequenceToken) { 127 | if ($replace) { 128 | $getRequestSequenceToken->override([T_VARIABLE, $this->requestVariableName]); 129 | 130 | $replace = false; 131 | continue; 132 | } 133 | 134 | $tokens[$key]->clear(); 135 | } 136 | } 137 | 138 | private function isAction(Tokens $tokens, $index) 139 | { 140 | $actionNameToken = $tokens[$tokens->getNextMeaningfulToken($index)]; 141 | 142 | if (!$actionNameToken->isGivenKind(T_STRING)) { 143 | return false; 144 | } 145 | if (substr($actionNameToken->getContent(), -6) !== 'Action') { 146 | return false; 147 | } 148 | 149 | return true; 150 | } 151 | 152 | private function getActionParenthesisIndexes(Tokens $tokens, $index) 153 | { 154 | $openIndex = $tokens->getNextMeaningfulToken($tokens->getNextMeaningfulToken($index)); 155 | $closeIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $openIndex); 156 | 157 | return [$openIndex, $closeIndex]; 158 | } 159 | 160 | private function getActionCurlyBraceIndexes(Tokens $tokens, $index) 161 | { 162 | $openIndex = $tokens->getNextMeaningfulToken( 163 | $this->getActionParenthesisIndexes($tokens, $index)[1] 164 | ); 165 | $closeIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $openIndex); 166 | 167 | return [$openIndex, $closeIndex]; 168 | } 169 | 170 | private function hasRequestParameterSequence(Tokens $tokens, $start, $end) 171 | { 172 | return null !== $tokens->findSequence([ 173 | [T_STRING, 'Request'], 174 | [T_VARIABLE], 175 | ], $start, $end); 176 | } 177 | 178 | private function hasGetRequestSequence(Tokens $tokens, $start, $end) 179 | { 180 | return null !== $this->getGetRequestSequence($tokens, $start, $end); 181 | } 182 | 183 | private function getGetRequestSequence(Tokens $tokens, $start, $end) 184 | { 185 | return $tokens->findSequence([ 186 | [T_VARIABLE, '$this'], 187 | [T_OBJECT_OPERATOR], 188 | [T_STRING, 'getRequest'], 189 | '(', 190 | ')', 191 | ], $start, $end); 192 | } 193 | 194 | private function getRequestVariableName(Tokens $tokens, $start, $end) 195 | { 196 | $requestVariableTokenIndex = $this->getRequestVariableTokenIndex($tokens, $start, $end); 197 | if (null === $requestVariableTokenIndex) { 198 | return; 199 | } 200 | 201 | $requestVariableToken = $tokens[$requestVariableTokenIndex]; 202 | if (!$requestVariableToken->isGivenKind(T_VARIABLE)) { 203 | return; 204 | } 205 | 206 | return $requestVariableToken->getContent(); 207 | } 208 | 209 | private function getRequestVariableTokenIndex(Tokens $tokens, $start, $end) 210 | { 211 | $getRequestSequence = $this->getGetRequestSequence($tokens, $start, $end); 212 | 213 | $getRequestSequenceKeys = array_keys($getRequestSequence); 214 | $getRequestSequenceStartIndex = $getRequestSequenceKeys[0]; 215 | 216 | if (';' !== $tokens[$tokens->getNextMeaningfulToken(array_pop($getRequestSequenceKeys))]->getContent()) { 217 | return; 218 | } 219 | 220 | $assignTokenIndex = $tokens->getPrevMeaningfulToken($getRequestSequenceStartIndex); 221 | if ('=' !== $tokens[$assignTokenIndex]->getContent()) { 222 | return; 223 | } 224 | 225 | return $tokens->getPrevMeaningfulToken($assignTokenIndex); 226 | } 227 | } 228 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/InheritDataAwareIteratorFixer.php: -------------------------------------------------------------------------------- 1 | rename( 10 | $content, 11 | ['Symfony', 'Component', 'Form', 'Util', 'VirtualFormAwareIterator'], 12 | 'InheritDataAwareIterator' 13 | ); 14 | } 15 | 16 | public function getDescription() 17 | { 18 | return 'The class VirtualFormAwareIterator was renamed to InheritDataAwareIterator.'; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/Iterator/FixerIterator.php: -------------------------------------------------------------------------------- 1 | files()->in(__DIR__.'/..')->sortByName()->depth(0) as $file) { 14 | $class = 'Symfony\\Upgrade\\Fixer\\'.$file->getBasename('.php'); 15 | 16 | if ((new \ReflectionClass($class))->isAbstract()) { 17 | continue; 18 | } 19 | 20 | $this->fixers[] = new $class(); 21 | } 22 | } 23 | 24 | public function getIterator() 25 | { 26 | return new \ArrayIterator($this->fixers); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/ProgressBarFixer.php: -------------------------------------------------------------------------------- 1 | rename( 10 | $content, 11 | ['Symfony', 'Component', 'Console', 'Helper', 'ProgressHelper'], 12 | 'ProgressBar' 13 | ); 14 | } 15 | 16 | public function getDescription() 17 | { 18 | return 'ProgressHelper has been removed in favor of ProgressBar.'; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/PropertyAccessFixer.php: -------------------------------------------------------------------------------- 1 | hasUseStatements( 14 | $tokens, 15 | ['Symfony', 'Component', 'PropertyAccess', 'PropertyAccess'] 16 | ); 17 | 18 | if ($used) { 19 | $this->renameMethodCalls($tokens, 'PropertyAccess', 'getPropertyAccessor', 'createPropertyAccessor'); 20 | } 21 | 22 | return $tokens->generateCode(); 23 | } 24 | 25 | public function getDescription() 26 | { 27 | return 'Renamed PropertyAccess::getPropertyAccessor to PropertyAccess::createPropertyAccessor.'; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/RenameClassFixer.php: -------------------------------------------------------------------------------- 1 | renameUseStatements( 14 | $tokens, 15 | $oldFqcn, 16 | $newClassName 17 | ); 18 | 19 | if ($used) { 20 | $this->renameNewStatements($tokens, array_pop($oldFqcn), $newClassName); 21 | } 22 | 23 | return $tokens->generateCode(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Symfony/Upgrade/Fixer/RenameFixer.php: -------------------------------------------------------------------------------- 1 | findSequence([ 12 | [T_NEW], 13 | [T_STRING, $old], 14 | ]); 15 | 16 | if (null === $matchedTokens) { 17 | return; 18 | } 19 | 20 | $matchedIndexes = array_keys($matchedTokens); 21 | 22 | $matchedTokens[$matchedIndexes[count($matchedIndexes) - 1]] 23 | ->setContent($new) 24 | ; 25 | 26 | $this->renameNewStatements($tokens, $old, $new); 27 | } 28 | 29 | protected function renameMethodCalls(Tokens $tokens, $className, $old, $new) 30 | { 31 | $matchedTokens = $tokens->findSequence([ 32 | [T_STRING, $className], 33 | [T_DOUBLE_COLON], 34 | [T_STRING, $old], 35 | '(', 36 | ')', 37 | ]); 38 | 39 | if (null === $matchedTokens) { 40 | return; 41 | } 42 | 43 | $matchedTokensIndexes = array_keys($matchedTokens); 44 | 45 | $matchedTokens[$matchedTokensIndexes[count($matchedTokensIndexes) - 3]] 46 | ->setContent($new) 47 | ; 48 | 49 | $this->renameMethodCalls($tokens, $className, $old, $new); 50 | } 51 | 52 | protected function renameConstants(Tokens $tokens, $className, $old, $new) 53 | { 54 | $matchedTokens = $tokens->findSequence([ 55 | [T_STRING, $className], 56 | [T_DOUBLE_COLON], 57 | [T_STRING, $old], 58 | ]); 59 | 60 | if (null === $matchedTokens) { 61 | return; 62 | } 63 | 64 | $matchedTokensIndexes = array_keys($matchedTokens); 65 | 66 | $matchedTokens[$matchedTokensIndexes[count($matchedTokensIndexes) - 1]] 67 | ->setContent($new) 68 | ; 69 | 70 | $this->renameConstants($tokens, $className, $old, $new); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/fixme.php: -------------------------------------------------------------------------------- 1 | setDefaults([ 13 | 'by_reference' => false, 14 | ]); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-configure-options/case1-output.php: -------------------------------------------------------------------------------- 1 | setDefaults([ 13 | 'by_reference' => false, 14 | ]); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-configure-options/case2-input.php: -------------------------------------------------------------------------------- 1 | setDefaults([ 14 | 'by_reference' => false, 15 | ]); 16 | 17 | $this->setConverterNormalizer($resolver); 18 | } 19 | 20 | protected function setConverterNormalizer(OptionsResolverInterface $resolver) 21 | { 22 | $resolver->setNormalizers([ 23 | 'converter' => function (Options $options, $value) use ($searchRegistry) { 24 | return $searchRegistry->getSearchHandler($options['autocomplete_alias']); 25 | } 26 | ]); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-configure-options/case2-output.php: -------------------------------------------------------------------------------- 1 | setDefaults([ 15 | 'by_reference' => false, 16 | ]); 17 | 18 | $this->setConverterNormalizer($resolver); 19 | } 20 | 21 | protected function setConverterNormalizer(OptionsResolverInterface $resolver) 22 | { 23 | $resolver->setNormalizers([ 24 | 'converter' => function (Options $options, $value) use ($searchRegistry) { 25 | return $searchRegistry->getSearchHandler($options['autocomplete_alias']); 26 | } 27 | ]); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-events/case1-input.php: -------------------------------------------------------------------------------- 1 | addEventListener(FormEvents::PRE_BIND, function (FormEvent $event) { 7 | // ... 8 | }); 9 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-events/case1-output.php: -------------------------------------------------------------------------------- 1 | addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) { 7 | // ... 8 | }); 9 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-events/case2-input.php: -------------------------------------------------------------------------------- 1 | addEventListener(FormEvents::BIND, function (FormEvent $event) { 7 | // ... 8 | }); 9 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-events/case2-output.php: -------------------------------------------------------------------------------- 1 | addEventListener(FormEvents::SUBMIT, function (FormEvent $event) { 7 | // ... 8 | }); 9 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-events/case3-input.php: -------------------------------------------------------------------------------- 1 | addEventListener(FormEvents::POST_BIND, function (FormEvent $event) { 7 | // ... 8 | }); 9 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-events/case3-output.php: -------------------------------------------------------------------------------- 1 | addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { 7 | // ... 8 | }); 9 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-extension-get-extended-type/case1-input.php: -------------------------------------------------------------------------------- 1 | add('name', 'text', array('label' => 'form.name')) 14 | ->add('price1', 'text', array( 15 | 'label' => 'form.price1', 16 | 'precision' => 3, 17 | )) 18 | ->add('price2', 'text', array( 19 | 'precision' => 3, 20 | )) 21 | ->add('discount', 'integer', [ 22 | 'label' => 'form.email', 23 | 'virtual' => true, 24 | ]) 25 | ->add('password', 'password') 26 | ; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-option-names/case1-output.php: -------------------------------------------------------------------------------- 1 | add('name', 'text', array('label' => 'form.name')) 14 | ->add('price1', 'text', array( 15 | 'label' => 'form.price1', 16 | 'scale' => 3, 17 | )) 18 | ->add('price2', 'text', array( 19 | 'scale' => 3, 20 | )) 21 | ->add('discount', 'integer', [ 22 | 'label' => 'form.email', 23 | 'inherit_data' => true, 24 | ]) 25 | ->add('password', 'password') 26 | ; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-option-names/case2-input.php: -------------------------------------------------------------------------------- 1 | add('name', TextType::class, array('label' => 'form.name')) 17 | ->add('price1', 'text', array( 18 | 'label' => 'form.price1', 19 | 'precision' => 3, 20 | )) 21 | ->add('price2', TextType::class, array( 22 | 'precision' => 3, 23 | )) 24 | ->add('discount', IntegerType::class, [ 25 | 'label' => 'form.email', 26 | 'virtual' => true, 27 | ]) 28 | ->add('password', PasswordType::class) 29 | ; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-option-names/case2-output.php: -------------------------------------------------------------------------------- 1 | add('name', TextType::class, array('label' => 'form.name')) 17 | ->add('price1', 'text', array( 18 | 'label' => 'form.price1', 19 | 'scale' => 3, 20 | )) 21 | ->add('price2', TextType::class, array( 22 | 'scale' => 3, 23 | )) 24 | ->add('discount', IntegerType::class, [ 25 | 'label' => 'form.email', 26 | 'inherit_data' => true, 27 | ]) 28 | ->add('password', PasswordType::class) 29 | ; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-parent-type/case1-input.php: -------------------------------------------------------------------------------- 1 | add('username', 'text', array('label' => 'form.username')) 14 | ->add('email', 'email', array('label' => 'form.email')) 15 | ->add('password', 'password') 16 | ; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-type-names/case1-output-php54.php: -------------------------------------------------------------------------------- 1 | add('username', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('label' => 'form.username')) 14 | ->add('email', 'Symfony\Component\Form\Extension\Core\Type\EmailType', array('label' => 'form.email')) 15 | ->add('password', 'Symfony\Component\Form\Extension\Core\Type\PasswordType') 16 | ; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-type-names/case1-output-php55+.php: -------------------------------------------------------------------------------- 1 | add('username', TextType::class, array('label' => 'form.username')) 17 | ->add('email', EmailType::class, array('label' => 'form.email')) 18 | ->add('password', PasswordType::class) 19 | ; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-type-names/case2-input.php: -------------------------------------------------------------------------------- 1 | add('content', 'text') 14 | ; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-type-names/case2-output-php54.php: -------------------------------------------------------------------------------- 1 | add('content', 'Symfony\Component\Form\Extension\Core\Type\TextType') 14 | ; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/form-type-names/case2-output-php55+.php: -------------------------------------------------------------------------------- 1 | add('content', SymfonyTextType::class) 15 | ; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/get-request/case1-input.php: -------------------------------------------------------------------------------- 1 | getRequest(); 12 | // ... 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/get-request/case1-output.php: -------------------------------------------------------------------------------- 1 | getRequest(); 12 | // ... 13 | } 14 | 15 | private function helperMethod() 16 | { 17 | // ... 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/get-request/case2-output.php: -------------------------------------------------------------------------------- 1 | getRequest()->request->get('username'); 12 | // ... 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/get-request/case3-output.php: -------------------------------------------------------------------------------- 1 | request->get('username'); 13 | // ... 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/inherit-data-aware-iterator/case1-input.php: -------------------------------------------------------------------------------- 1 | start(); 10 | 11 | $i = 0; 12 | while ($i++ < 50) { 13 | // ... do some work 14 | 15 | // advance the progress bar 1 unit 16 | $progress->advance(); 17 | 18 | // you can also advance the progress bar by more than 1 unit 19 | // $progress->advance(3); 20 | } 21 | 22 | // ensure that the progress bar is at 100% 23 | $progress->finish(); 24 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/progress-bar/case1-output.php: -------------------------------------------------------------------------------- 1 | start(); 10 | 11 | $i = 0; 12 | while ($i++ < 50) { 13 | // ... do some work 14 | 15 | // advance the progress bar 1 unit 16 | $progress->advance(); 17 | 18 | // you can also advance the progress bar by more than 1 unit 19 | // $progress->advance(3); 20 | } 21 | 22 | // ensure that the progress bar is at 100% 23 | $progress->finish(); 24 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Fixtures/Fixer/progress-bar/case2-input.php: -------------------------------------------------------------------------------- 1 | getShortName())) 22 | ); 23 | 24 | $expectedFile = $this->getTestFile($dir.'/'.$expectedFilename); 25 | $inputFile = $inputFilename ? $this->getTestFile($dir.'/'.$inputFilename) : null; 26 | 27 | return [ 28 | file_get_contents($expectedFile->getRealpath()), 29 | $inputFile ? file_get_contents($inputFile->getRealpath()) : null, 30 | $inputFile ?: $expectedFile, 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Test/Fixer/FormConfigureOptionsFixerTest.php: -------------------------------------------------------------------------------- 1 | makeTest($expected, $input, $file); 13 | } 14 | 15 | public function provideExamples() 16 | { 17 | return [ 18 | $this->prepareTestCase('case1-output.php', 'case1-input.php'), 19 | $this->prepareTestCase('case2-output.php', 'case2-input.php'), 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Test/Fixer/FormEventsFixerTest.php: -------------------------------------------------------------------------------- 1 | makeTest($expected, $input, $file); 13 | } 14 | 15 | public function provideExamples() 16 | { 17 | return [ 18 | $this->prepareTestCase('case1-output.php', 'case1-input.php'), 19 | $this->prepareTestCase('case2-output.php', 'case2-input.php'), 20 | $this->prepareTestCase('case3-output.php', 'case3-input.php'), 21 | ]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Test/Fixer/FormExtensionGetExtendedTypeFixerTest.php: -------------------------------------------------------------------------------- 1 | makeTest($expected, $input, $file); 13 | } 14 | 15 | public function provideExamples() 16 | { 17 | return [ 18 | $this->prepareTestCase('case1-output.php', 'case1-input.php'), 19 | ]; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Test/Fixer/FormGetnameToGetblockprefixFixerTest.php: -------------------------------------------------------------------------------- 1 | makeTest($expected, $input, $file); 13 | } 14 | 15 | public function provideExamples() 16 | { 17 | return [ 18 | $this->prepareTestCase('case1-output.php', 'case1-input.php'), 19 | ]; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Test/Fixer/FormOptionNamesFixerTest.php: -------------------------------------------------------------------------------- 1 | makeTest($expected, $input, $file); 13 | } 14 | 15 | public function provideExamples() 16 | { 17 | return [ 18 | $this->prepareTestCase('case1-output.php', 'case1-input.php'), 19 | $this->prepareTestCase('case2-output.php', 'case2-input.php'), 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Test/Fixer/FormParentTypeFixerTest.php: -------------------------------------------------------------------------------- 1 | makeTest($expected, $input, $file); 13 | } 14 | 15 | public function provideExamples() 16 | { 17 | return [ 18 | $this->prepareTestCase('case1-output.php', 'case1-input.php'), 19 | $this->prepareTestCase('case2-output.php', 'case2-input.php'), 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Test/Fixer/FormTypeNamesFixerTest.php: -------------------------------------------------------------------------------- 1 | makeTest($expected, $input, $file); 13 | } 14 | 15 | public function provideExamples() 16 | { 17 | return [ 18 | $this->prepareTestCase($this->getCaseOutputFileName(1), 'case1-input.php'), 19 | $this->prepareTestCase($this->getCaseOutputFileName(2), 'case2-input.php'), 20 | ]; 21 | } 22 | 23 | /** 24 | * @param int $caseNumber 25 | * @return string 26 | */ 27 | private function getCaseOutputFileName($caseNumber) 28 | { 29 | return sprintf('case%d-output-php%s.php', $caseNumber, PHP_VERSION_ID > 50500 ? '55+' : '54'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Test/Fixer/GetRequestFixerTest.php: -------------------------------------------------------------------------------- 1 | makeTest($expected, $input, $file); 13 | } 14 | 15 | public function provideExamples() 16 | { 17 | return [ 18 | $this->prepareTestCase('case1-output.php', 'case1-input.php'), 19 | $this->prepareTestCase('case2-output.php', 'case2-input.php'), 20 | $this->prepareTestCase('case3-output.php', 'case3-input.php'), 21 | ]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Test/Fixer/InheritDataAwareIteratorFixerTest.php: -------------------------------------------------------------------------------- 1 | makeTest($expected, $input, $file); 13 | } 14 | 15 | public function provideExamples() 16 | { 17 | return [ 18 | $this->prepareTestCase('case1-output.php', 'case1-input.php'), 19 | ]; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Test/Fixer/ProgressBarFixerTest.php: -------------------------------------------------------------------------------- 1 | makeTest($expected, $input, $file); 13 | } 14 | 15 | public function provideExamples() 16 | { 17 | return [ 18 | $this->prepareTestCase('case1-output.php', 'case1-input.php'), 19 | $this->prepareTestCase('case2-output.php', 'case2-input.php'), 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Test/Fixer/PropertyAccessFixerTest.php: -------------------------------------------------------------------------------- 1 | makeTest($expected, $input, $file); 13 | } 14 | 15 | public function provideExamples() 16 | { 17 | return [ 18 | $this->prepareTestCase('case1-output.php', 'case1-input.php'), 19 | ]; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Symfony/Upgrade/Test/FixerTest.php: -------------------------------------------------------------------------------- 1 | assertCount(0, $fixer->getFixers()); 19 | $fixer->registerAllBuiltInFixers(); 20 | $this->assertGreaterThan(0, count($fixer->getFixers())); 21 | } 22 | 23 | /** 24 | * @dataProvider provideFixer 25 | */ 26 | public function testThatCanAddAndGetFixers(Fixer $fixer) 27 | { 28 | $f1 = $this->getMock('Symfony\CS\FixerInterface'); 29 | $f2 = $this->getMock('Symfony\CS\FixerInterface'); 30 | $fixer->addFixer($f1); 31 | $fixer->addFixer($f2); 32 | 33 | $this->assertTrue(in_array($f1, $fixer->getFixers(), true)); 34 | $this->assertTrue(in_array($f2, $fixer->getFixers(), true)); 35 | } 36 | 37 | /** 38 | * @dataProvider provideFixer 39 | */ 40 | public function testThatFixSuccessfully(Fixer $fixer) 41 | { 42 | $fixer->addFixer(new ProgressBarFixer()); 43 | $fixer->addFixer(new PropertyAccessFixer()); 44 | 45 | $changed = $fixer->fix(true); 46 | 47 | $this->assertCount(1, $changed); 48 | $this->assertCount(2, $changed[$this->getPath()]); 49 | } 50 | 51 | /** 52 | * @dataProvider provideFixersDescriptionConsistencyCases 53 | */ 54 | public function testFixersDescriptionConsistency(FixerInterface $fixer) 55 | { 56 | $this->assertRegExp('/^[A-Z@].*\.$/', $fixer->getDescription(), 'Description must start with capital letter or an @ and end with dot.'); 57 | } 58 | 59 | public function provideFixer() 60 | { 61 | return [ 62 | [new Fixer(new \ArrayIterator([new \SplFileInfo($this->getPath())]))], 63 | ]; 64 | } 65 | 66 | public function provideFixersDescriptionConsistencyCases() 67 | { 68 | $fixer = new Fixer(new \ArrayIterator([new StdinFileInfo()])); 69 | $fixer->registerAllBuiltInFixers(); 70 | $fixers = $fixer->getFixers(); 71 | $cases = []; 72 | 73 | foreach ($fixers as $fixer) { 74 | $cases[] = [$fixer]; 75 | } 76 | 77 | return $cases; 78 | } 79 | 80 | private function getPath() 81 | { 82 | return __DIR__.'/../Fixtures/Fixer/fixme.php'; 83 | } 84 | } 85 | --------------------------------------------------------------------------------