-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Cannot declare class ...\DefinitionDecorator, because the name is already in use #21369
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
Comments
Isn't it because of the |
@wouterj How can I reproduce this issue? |
@wouterj Is this issue still relevant? I checked out the bundle and the test suite runs fine on my side. |
I've faced this issue today with |
The problem occures when doing like |
@scaytrase: Could you provide a reproducer?
IIRC, the idea was to trigger the autoload of BTW, I tried on symfony-demo with |
@ogizanagi I'll try to make one |
@ogizanagi https://github.com/scaytrase/symfony-21369 Here it is. I cannot make a travis build for you (they have some issues ATM), but you can manually switch to |
Stacktrace is following
|
https://travis-ci.org/scaytrase/symfony-21369/builds/229627906 Here is the travis. sf@3.1 build are failed for another reason (looks like phpunit 6 incompatibility) 3.3@dev failed for reason above |
@scaytrase : Thanks a lot for your help and for the reproducer. It seems the Status: reviewed |
Locally applying your patch to vendor makes test pass. You have a travis build, so I think there is nothing more I can confirm. Thank you |
…ause the name is already in use (ogizanagi) This PR was merged into the 3.3-dev branch. Discussion ---------- [DI] Fix Cannot declare class ...\DefinitionDecorator, because the name is already in use | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #21369 | License | MIT | Doc PR | N/A The `return` trick doesn't seem to work, and php is still trying to declare the `DefinitionDecorator` class, which causes the "Cannot declare class ...\DefinitionDecorator, because the name is already in use" error because of the `class_alias` previously declared in `ChildDefinition.php`. This never happens as soon as the `ChildDefinition` class is used first, as the alias will take hand, but their are some situations, like in some unit test cases it can happen apparently, because `DefinitionDecorator` is used first. Commits ------- 530849e [DI] Fix Cannot declare class ...\DefinitionDecorator, because the name is already in use
Uh oh!
There was an error while loading. Please reload this page.
When using
DefinitionDecorator
in a unit test, the error above will be triggered. Seems like the renaming is not done properly.Test output
The text was updated successfully, but these errors were encountered: