🌐 AI搜索 & 代理 主页
Skip to content

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

$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+

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)

->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+.

$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+.

$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).


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).

->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).

$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).

$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+.

->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