Skip to content

[DependencyInjection] Fix FactoryReturnTypePass position in PassConfig #20263

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

Merged
merged 1 commit into from
Oct 21, 2016

Conversation

hason
Copy link
Contributor

@hason hason commented Oct 21, 2016

Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #19161, #19191
License MIT
Doc PR

} else {
$this->assertEquals('Please add the class to service "factory" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $e->getMessage());
}
}
Copy link
Member

Choose a reason for hiding this comment

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

this test will not fail if no RuntimeException is thrown, and there is no assertion in this case

if (method_exists(\ReflectionMethod::class, 'getReturnType')) {
$this->fail('The FactoryReturnTypePass should set the class to service "factory".');
} else {
$this->assertEquals('Please add the class to service "factory" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $e->getMessage());
Copy link
Member

Choose a reason for hiding this comment

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

rather than this, use ->setExpectedException() instead (only on PHP 5) and don't catch the exception. It will avoid the need to fail manually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your tip.

@fabpot
Copy link
Member

fabpot commented Oct 21, 2016

Thank you @hason.

@fabpot fabpot merged commit dfb5cc3 into symfony:master Oct 21, 2016
fabpot added a commit that referenced this pull request Oct 21, 2016
…n PassConfig (hason)

This PR was merged into the 3.2-dev branch.

Discussion
----------

[DependencyInjection] Fix FactoryReturnTypePass position in PassConfig

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19161, #19191
| License       | MIT
| Doc PR        |

Commits
-------

dfb5cc3 [DependencyInjection] Fix FactoryReturnTypePass position in PassConfig
@hason hason deleted the factory branch October 22, 2016 11:19
@fabpot fabpot mentioned this pull request Oct 27, 2016
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.

4 participants