-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[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
|
|
||
| $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+
| 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)
| ->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+.
| $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+.
| $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).
|
|
||
| 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).
| ->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).
| $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).
| $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+.
| ->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
FrameworkExtensionclass 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.