-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Remove obsolete feature detection #51620
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
Conversation
bc6deb7
to
dc35c9a
Compare
dc35c9a
to
f73384a
Compare
@@ -227,11 +217,6 @@ public function load(array $configs, ContainerBuilder $container) | |||
} | |||
|
|||
$loader->load('web.php'); | |||
|
|||
if (!class_exists(BackedEnumValueResolver::class)) { |
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.
Added to symfony/http-kernel with #44831 (6.1). FrameworkBundle requires v6.4+
@@ -775,11 +760,6 @@ private function registerFormConfiguration(array $config, ContainerBuilder $cont | |||
if (!ContainerBuilder::willBeAvailable('symfony/translation', Translator::class, ['symfony/framework-bundle', 'symfony/form'])) { | |||
$container->removeDefinition('form.type_extension.upload.validator'); | |||
} | |||
if (!method_exists(CachingFactoryDecorator::class, 'reset')) { |
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.
Method was added in #30597 (Symfony 4.2)
@@ -1219,10 +1199,6 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co | |||
->replaceArgument(0, $config['default_uri']); | |||
} | |||
|
|||
if (!class_exists(Psr4DirectoryLoader::class)) { |
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.
Added to symfony/routing with #47916 (6.2). FrameworkBundle requires v6.4+.
@@ -1688,10 +1664,6 @@ private function registerValidationConfiguration(array $config, ContainerBuilder | |||
if (!class_exists(ExpressionLanguage::class)) { | |||
$container->removeDefinition('validator.expression_language'); | |||
} | |||
|
|||
if (!class_exists(WhenValidator::class)) { |
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.
Added to symfony/validator with #42593 (6.2). FrameworkBundle requires v6.4+.
@@ -1911,7 +1883,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder | |||
$container->removeDefinition('serializer.encoder.yaml'); | |||
} | |||
|
|||
if (!class_exists(UnwrappingDenormalizer::class) || !$this->isInitializedConfigEnabled('property_access')) { |
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.
Class was added in #31390 (Symfony 5.1).
@@ -2370,10 +2336,6 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder | |||
|
|||
private function registerCacheConfiguration(array $config, ContainerBuilder $container): void | |||
{ | |||
if (!class_exists(DefaultMarshaller::class)) { |
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.
Class exists since #27645 (Symfony 4.2).
->setPublic($pool['public']) | ||
->addTag('cache.taggable', ['pool' => $name]) | ||
; | ||
|
||
if (method_exists(TagAwareAdapter::class, 'setLogger')) { |
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.
Method has been added in #40740 (Symfony 4.4).
@@ -2469,7 +2425,7 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con | |||
$container->setDefinition($name, $definition); | |||
} | |||
|
|||
if (method_exists(PropertyAccessor::class, 'createCache')) { |
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.
Method exists since #16838 (Symfony 3.2).
@@ -2514,20 +2470,16 @@ private function registerHttpClientConfiguration(array $config, ContainerBuilder | |||
$this->registerRetryableHttpClient($retryOptions, 'http_client', $container); | |||
} | |||
|
|||
if ($hasUriTemplate = class_exists(UriTemplateHttpClient::class)) { |
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.
Class was added to symfony/http-client with #49302 (6.3), FrameworkBundle requires 6.3+.
@@ -3021,10 +2971,6 @@ private function registerUidConfiguration(array $config, ContainerBuilder $conta | |||
$container->getDefinition('name_based_uuid.factory') | |||
->setArguments([$config['name_based_uuid_namespace']]); | |||
} | |||
|
|||
if (!class_exists(UidValueResolver::class)) { |
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.
Class was added to symfony/http-kernel with #44665 (6.1), FrameworkBundle requires 6.4+
Thank you @derrabus. |
This PR removes some feature detection logic from the
FrameworkExtension
class that I could identify as obsolete.I'll add some comments to the PR to elaborate why I think a piece of code can be removed.