Skip to content
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

[DI][autowiring] throw exception when many services use the same class. #16642

Merged
merged 1 commit into from Nov 30, 2015

Conversation

aitboudad
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets #16639
Tests pass? yes
License MIT

@weaverryan
Copy link
Member

@dunglas can you help review this. I can't quite follow the logic, but it might be late :)

@dunglas
Copy link
Member

dunglas commented Nov 24, 2015

👍 looks good to me but it's late so I can be wrong :-)

if (isset($this->types[$typeHint->name])) {
$value = new Reference($this->types[$typeHint->name]);
} elseif (isset($this->serviceTypes[$typeHint->name]) && isset($this->notGuessableTypes[$typeHint->name])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this isset($this->notGuessableTypes[$typeHint->name])) and not the opposite !isset($this->notGuessableTypes[$typeHint->name]))?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I slightly simplified the code now, if the type is in notGuessableTypes we should throw an exception.

@weaverryan
Copy link
Member

@dunglas can you look at this in more detail? It's a really simple patch right now (@aitboudad reworked it), but it won't get merged until/unless we can give it a for-sure ok.

@dunglas
Copy link
Member

dunglas commented Nov 30, 2015

👍 nice work @aitboudad!

@fabpot
Copy link
Member

fabpot commented Nov 30, 2015

Thank you @aitboudad.

@fabpot fabpot merged commit a21a016 into symfony:2.8 Nov 30, 2015
fabpot added a commit that referenced this pull request Nov 30, 2015
…e same class. (aitboudad)

This PR was merged into the 2.8 branch.

Discussion
----------

[DI][autowiring] throw exception when many services use the same class.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets  | #16639
| Tests pass?   | yes
| License       | MIT

Commits
-------

a21a016 [DI][autowiring] throw exception when many services use the same class.
@aitboudad aitboudad deleted the issue_16639 branch November 30, 2015 07:51
This was referenced Nov 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants