[DI] Handle invalid bundle configuration class
This commit is contained in:
parent
817da643eb
commit
5ce90bd251
@ -23,6 +23,7 @@ DependencyInjection
|
|||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
* Deprecated the `TypedReference::canBeAutoregistered()` and `TypedReference::getRequiringClass()` methods.
|
* Deprecated the `TypedReference::canBeAutoregistered()` and `TypedReference::getRequiringClass()` methods.
|
||||||
|
* Deprecated support for auto-discovered extension configuration class which does not implement `ConfigurationInterface`.
|
||||||
|
|
||||||
EventDispatcher
|
EventDispatcher
|
||||||
---------------
|
---------------
|
||||||
|
@ -20,6 +20,7 @@ DependencyInjection
|
|||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
* Removed the `TypedReference::canBeAutoregistered()` and `TypedReference::getRequiringClass()` methods.
|
* Removed the `TypedReference::canBeAutoregistered()` and `TypedReference::getRequiringClass()` methods.
|
||||||
|
* Removed support for auto-discovered extension configuration class which does not implement `ConfigurationInterface`.
|
||||||
|
|
||||||
EventDispatcher
|
EventDispatcher
|
||||||
---------------
|
---------------
|
||||||
|
@ -9,6 +9,7 @@ CHANGELOG
|
|||||||
* added support for service's decorators autowiring
|
* added support for service's decorators autowiring
|
||||||
* deprecated the `TypedReference::canBeAutoregistered()` and `TypedReference::getRequiringClass()` methods
|
* deprecated the `TypedReference::canBeAutoregistered()` and `TypedReference::getRequiringClass()` methods
|
||||||
* environment variables are validated when used in extension configuration
|
* environment variables are validated when used in extension configuration
|
||||||
|
* deprecated support for auto-discovered extension configuration class which does not implement `ConfigurationInterface`
|
||||||
|
|
||||||
4.0.0
|
4.0.0
|
||||||
-----
|
-----
|
||||||
|
@ -82,11 +82,23 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn
|
|||||||
$class = get_class($this);
|
$class = get_class($this);
|
||||||
$class = substr_replace($class, '\Configuration', strrpos($class, '\\'));
|
$class = substr_replace($class, '\Configuration', strrpos($class, '\\'));
|
||||||
$class = $container->getReflectionClass($class);
|
$class = $container->getReflectionClass($class);
|
||||||
$constructor = $class ? $class->getConstructor() : null;
|
|
||||||
|
|
||||||
if ($class && (!$constructor || !$constructor->getNumberOfRequiredParameters())) {
|
if (!$class) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$class->implementsInterface(ConfigurationInterface::class)) {
|
||||||
|
@trigger_error(sprintf('Not implementing "%s" in the extension configuration class "%s" is deprecated since Symfony 4.1.', ConfigurationInterface::class, $class->getName()), E_USER_DEPRECATED);
|
||||||
|
//throw new LogicException(sprintf('The extension configuration class "%s" must implement "%s".', $class->getName(), ConfigurationInterface::class));
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!($constructor = $class->getConstructor()) || !$constructor->getNumberOfRequiredParameters()) {
|
||||||
return $class->newInstance();
|
return $class->newInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected function processConfiguration(ConfigurationInterface $configuration, array $configs)
|
final protected function processConfiguration(ConfigurationInterface $configuration, array $configs)
|
||||||
|
Reference in New Issue
Block a user