Skip to content

Commit fc720fc

Browse files
Merge branch '4.0'
* 4.0: [Form] Fixed ContextErrorException in FileType [DI] Fix handling of inlined definitions by ContainerBuilder [Security] remove unused variable [DI] Fix infinite loop when analyzing references [Lock][Process][FrameworkBundle] fix tests Display a nice error message if the form/serializer component is missing. [SecurityBundle] providerIds is undefined error when firewall provider is not specified [SecurityBundle] providerIds is undefined error when firewall provider is not specified [SecurityBundle] providerIds is undefined error when firewall provider is not specified Force phpunit-bridge update (bis) [Bridge/PhpUnit] Fix disabling global state preservation Incorrect dot on method loadChoices in upgrade doc
2 parents 378d539 + 12721e7 commit fc720fc

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ public function load(array $configs, ContainerBuilder $container)
137137
throw new LogicException('Translation support cannot be enabled as the Translation component is not installed.');
138138
}
139139

140-
if (!class_exists('Symfony\Component\Translation\Translator') && $this->isConfigEnabled($container, $config['validation'])) {
141-
throw new LogicException('Validation support cannot be enabled as the Translation component is not installed.');
142-
}
143-
144140
if (class_exists(Translator::class)) {
145141
$loader->load('identity_translator.xml');
146142
}
@@ -184,6 +180,10 @@ public function load(array $configs, ContainerBuilder $container)
184180
}
185181

186182
if ($this->isConfigEnabled($container, $config['form'])) {
183+
if (!class_exists('Symfony\Component\Form\Form')) {
184+
throw new LogicException('Form support cannot be enabled as the Form component is not installed.');
185+
}
186+
187187
$this->formConfigEnabled = true;
188188
$this->registerFormConfiguration($config, $container, $loader);
189189

@@ -231,6 +231,10 @@ public function load(array $configs, ContainerBuilder $container)
231231
$this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader);
232232

233233
if ($this->isConfigEnabled($container, $config['serializer'])) {
234+
if (!class_exists('Symfony\Component\Serializer\Serializer')) {
235+
throw new LogicException('Serializer support cannot be enabled as the Serializer component is not installed.');
236+
}
237+
234238
$this->registerSerializerConfiguration($config['serializer'], $container, $loader);
235239
}
236240

@@ -923,6 +927,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
923927
return 2 === substr_count($file->getBasename(), '.') && preg_match('/\.\w+$/', $file->getBasename());
924928
})
925929
->in($dirs)
930+
->sortByName()
926931
;
927932

928933
foreach ($finder as $file) {
@@ -1032,7 +1037,7 @@ private function registerValidatorMapping(ContainerBuilder $container, array $co
10321037

10331038
private function registerMappingFilesFromDir($dir, callable $fileRecorder)
10341039
{
1035-
foreach (Finder::create()->followLinks()->files()->in($dir)->name('/\.(xml|ya?ml)$/') as $file) {
1040+
foreach (Finder::create()->followLinks()->files()->in($dir)->name('/\.(xml|ya?ml)$/')->sortByName() as $file) {
10361041
$fileRecorder($file->getExtension(), $file->getRealPath());
10371042
}
10381043
}

0 commit comments

Comments
 (0)