Skip to content

Commit

Permalink
Merge branch '7.0' into 7.1
Browse files Browse the repository at this point in the history
* 7.0:
  [HttpClient][Mailer] Revert "Let curl handle transfer encoding", use HTTP/1.1 for Mailgun
  Reviewed Catalan missing translations
  [AssetMapper] Upgrade importmap polyfill
  Fix typo: synchronous -> synchronously
  [Serializer] Check if exception message in test is correct
  Ibexa is sponsoring Symfony 5.4, thanks to them! \o/
  [VarDumper] Fix `FFICaster` test to be platform-adaptable
  [String] Add `alias` case to `EnglishInflector`
  [FrameworkBundle] Throw runtime exception when trying to use asset-mapper while http-client is disabled
  [SecurityBundle] Remove unused memory users’ `name` attribute from the XSD
  [VarExporter] generate __doUnserialize() method in ProxyHelper::generateLazyProxy()
  Double check if pcntl function exists
  Add additional headers in Scaleway bridge
  [VarDumper] Fix FFI caster test
  [DependencyInjection] Add test coverage for `AutowireCallable::buildDefinition()`
  • Loading branch information
nicolas-grekas committed Jun 28, 2024
2 parents 35d085d + 122109f commit 54a84f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions DependencyInjection/FrameworkExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public function load(array $configs, ContainerBuilder $container): void
throw new LogicException('AssetMapper support cannot be enabled as the AssetMapper component is not installed. Try running "composer require symfony/asset-mapper".');
}

$this->registerAssetMapperConfiguration($config['asset_mapper'], $container, $loader, $this->readConfigEnabled('assets', $container, $config['assets']));
$this->registerAssetMapperConfiguration($config['asset_mapper'], $container, $loader, $this->readConfigEnabled('assets', $container, $config['assets']), $this->readConfigEnabled('http_client', $container, $config['http_client']));
} else {
$container->removeDefinition('cache.asset_mapper');
}
Expand Down Expand Up @@ -1291,12 +1291,14 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co
}
}

private function registerAssetMapperConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader, bool $assetEnabled): void
private function registerAssetMapperConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader, bool $assetEnabled, bool $httpClientEnabled): void
{
$loader->load('asset_mapper.php');

if (!$assetEnabled) {
$container->removeDefinition('asset_mapper.asset_package');
if (!$httpClientEnabled) {
$container->register('asset_mapper.http_client', HttpClientInterface::class)
->addTag('container.error')
->addError('You cannot use the AssetMapper integration since the HttpClient component is not enabled. Try enabling the "framework.http_client" config option.');
}

$paths = $config['paths'];
Expand Down
8 changes: 5 additions & 3 deletions Resources/config/asset_mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
])
->alias(AssetMapperInterface::class, 'asset_mapper')

->alias('asset_mapper.http_client', 'http_client')

->set('asset_mapper.mapped_asset_factory', MappedAssetFactory::class)
->args([
service('asset_mapper.public_assets_path_resolver'),
Expand Down Expand Up @@ -197,7 +199,7 @@
])

->set('asset_mapper.importmap.resolver', JsDelivrEsmResolver::class)
->args([service('http_client')])
->args([service('asset_mapper.http_client')])

->set('asset_mapper.importmap.renderer', ImportMapRenderer::class)
->args([
Expand All @@ -212,12 +214,12 @@
->set('asset_mapper.importmap.auditor', ImportMapAuditor::class)
->args([
service('asset_mapper.importmap.config_reader'),
service('http_client'),
service('asset_mapper.http_client'),
])
->set('asset_mapper.importmap.update_checker', ImportMapUpdateChecker::class)
->args([
service('asset_mapper.importmap.config_reader'),
service('http_client'),
service('asset_mapper.http_client'),
])

->set('asset_mapper.importmap.command.require', ImportMapRequireCommand::class)
Expand Down

0 comments on commit 54a84f4

Please sign in to comment.