Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

derrabus
Copy link
Member

Q A
Branch? 6.4
Bug fix? no
New feature? no
Deprecations? no
Tickets N/A
License MIT
Doc PR N/A

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.

@derrabus derrabus force-pushed the remove/fwb-detections branch from dc35c9a to f73384a Compare September 10, 2023 18:50
@@ -227,11 +217,6 @@ public function load(array $configs, ContainerBuilder $container)
}

$loader->load('web.php');

if (!class_exists(BackedEnumValueResolver::class)) {
Copy link
Member Author

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')) {
Copy link
Member Author

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)) {
Copy link
Member Author

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)) {
Copy link
Member Author

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')) {
Copy link
Member Author

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)) {
Copy link
Member Author

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')) {
Copy link
Member Author

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')) {
Copy link
Member Author

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)) {
Copy link
Member Author

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)) {
Copy link
Member Author

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+

@nicolas-grekas
Copy link
Member

Thank you @derrabus.

@nicolas-grekas nicolas-grekas merged commit 8d2b79e into symfony:6.4 Sep 11, 2023
@derrabus derrabus deleted the remove/fwb-detections branch September 11, 2023 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants