Skip to content

Commit

Permalink
minor #6141 Docs do not match functionality (Loupax)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xabbuh committed Jan 29, 2016
2 parents 0a5227d + 739e23a commit cc8e436
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cookbook/bundles/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ The ``config:dump-reference`` command dumps the default configuration of a
bundle in the console using the Yaml format.

As long as your bundle's configuration is located in the standard location
(``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 have
a constructor it will work automatically. If you
have something different, your ``Extension`` class must override the
:method:`Extension::getConfiguration() <Symfony\\Component\\HttpKernel\\DependencyInjection\\Extension::getConfiguration>`
method and return an instance of your ``Configuration``.
Expand Down

0 comments on commit cc8e436

Please sign in to comment.