-
-
Notifications
You must be signed in to change notification settings - Fork 688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot declare class - Level symfony 34 throws an error on 2.8 Symfony Code #985
Comments
How did you install Rector? What exact command do you run? This might be due to conflicting version of Symfony. Rector uses Symfony 3.4/4.2, your app probably older. |
Installed via |
What exact Rector command do you run? |
./rector process {SYMFONY_PROJECT_FOLDER}/src --level symfony34 --dry-run |
This issues is quite common. It's caused by the fact Rector loads Symfony coce from your project and from itself - twice. The only solution in the future will be prefixed PHAR. It's being worked on in https://github.com/rectorphp/compiler |
Duplicated issue to better described: #177 |
There is a solution now: https://github.com/rectorphp/rector-prefixed |
@TomasVotruba I am using the latest prefixed version (0.7.2) in a Symfony 3.4 project and I am running the two sets 'php72' and 'symfony40'.
# rector.yaml
parameters:
auto_import_names: true
autoload_paths:
- 'src/zzz/DrunkenWizardBundle'
- 'src/zzz/OfficeOpenXmlBundle'
exclude_paths:
- '/src/zzz/OfficeOpenXmlBundle/Classes'
paths:
- 'src'
sets:
- 'php72'
- 'symfony40' Any idea why it is still happening? |
Could you provide demo link? |
rectorphp/rector-src@f6d0037 [TypeDeclaration] Skip nullable generic typed on ReturnTypeDeclarationRector (#985)
When I try to dry run with level symfony 3.4 on 2.8 code I get every time:
PHP v7.2.14
rector v0.3.37
PHP Fatal error: Cannot declare class Symfony\Component\HttpFoundation\ParameterBag, because the name is already in use in /var/www/html/adb_webapp/var/bootstrap.php.cache on line 6
The text was updated successfully, but these errors were encountered: