-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Docs do not match functionality #6141
Conversation
👍 |
(``YourBundle\DependencyInjection\Configuration``) and does not require | ||
arguments to be passed to the constructor it will work automatically. If you | ||
(``YourBundle\DependencyInjection\Configuration``) and does not extend | ||
its constructor it will work automatically. If you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"extend" sounds strange when we talk about methods imo. What about saying something like "and does have a constructor"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works either way, I just used extend
because this still works if the parent Configuration
class has a __construct method itself.
Still I agree that "does not have a constructor" makes the meaning very clear. Waiting for any other feedback before changing the PR :)
👍 for "does not have a constructor" |
Cannot understand why the CI test failed. Is there a way to re-run it without re-commiting? |
@Loupax don't worry about the CI test. That's an issue that is not related to this PR (and in fact, already fixed on the 2.3 branch). 👍 from me for merging this PR. Thanks for fixing the docs! |
Thank you @Loupax. |
This PR was submitted for the 3.0 branch but it was merged into the 2.3 branch instead (closes #6141). Discussion ---------- Docs do not match functionality | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 3 | Fixed tickets | None The Dump the configuration section specifies that one of the requirements that need to be met to automatically dump configuration is the constructor not requiring parameters. The code that handles this though does not match this description: ``` /** * {@inheritdoc} */ public function getConfiguration(array $config, ContainerBuilder $container) { $reflected = new \ReflectionClass($this); $namespace = $reflected->getNamespaceName(); $class = $namespace.'\\Configuration'; if (class_exists($class)) { $r = new \ReflectionClass($class); $container->addResource(new FileResource($r->getFileName())); // Notice here that it just checks if the __construct method exists, // the arguments are irrelevant if (!method_exists($class, '__construct')) { $configuration = new $class(); return $configuration; } } } ``` Commits ------- 739e23a Docs do not match functionality
The configuration section specifies that one of the requirements that need to be met to automatically dump configuration is the constructor not requiring parameters.
The code that handles this though does not match this description: