bug #35039 [DI] skip looking for config class when the extension class is anonymous (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[DI] skip looking for config class when the extension class is anonymous

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34613
| License       | MIT
| Doc PR        | -

Commits
-------

1c7eda4649 [DI] skip looking for config class when the extension class is anonymous
This commit is contained in:
Nicolas Grekas 2019-12-19 16:52:25 +01:00
commit 135c6f7d9d

View File

@ -80,6 +80,11 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn
public function getConfiguration(array $config, ContainerBuilder $container)
{
$class = \get_class($this);
if (false !== strpos($class, "\0")) {
return null; // ignore anonymous classes
}
$class = substr_replace($class, '\Configuration', strrpos($class, '\\'));
$class = $container->getReflectionClass($class);
$constructor = $class ? $class->getConstructor() : null;