Skip to content

Commit f909b27

Browse files
Merge branch '5.2' into 5.x
* 5.2: merge translation parameters with value configured for parent form scan directories for translations sequentially Fix kafka tests Fix "provide" declarations Provide implemented packages of replaced dependencies Always autoload string functions on symfony/symfony
2 parents 87bb283 + 8314733 commit f909b27

File tree

4 files changed

+32
-17
lines changed

4 files changed

+32
-17
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,24 +1228,26 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
12281228
// Register translation resources
12291229
if ($dirs) {
12301230
$files = [];
1231-
$finder = Finder::create()
1232-
->followLinks()
1233-
->files()
1234-
->filter(function (\SplFileInfo $file) {
1235-
return 2 <= substr_count($file->getBasename(), '.') && preg_match('/\.\w+$/', $file->getBasename());
1236-
})
1237-
->in($dirs)
1238-
->sortByName()
1239-
;
12401231

1241-
foreach ($finder as $file) {
1242-
$fileNameParts = explode('.', basename($file));
1243-
$locale = $fileNameParts[\count($fileNameParts) - 2];
1244-
if (!isset($files[$locale])) {
1245-
$files[$locale] = [];
1246-
}
1232+
foreach ($dirs as $dir) {
1233+
$finder = Finder::create()
1234+
->followLinks()
1235+
->files()
1236+
->filter(function (\SplFileInfo $file) {
1237+
return 2 <= substr_count($file->getBasename(), '.') && preg_match('/\.\w+$/', $file->getBasename());
1238+
})
1239+
->in($dir)
1240+
->sortByName()
1241+
;
1242+
foreach ($finder as $file) {
1243+
$fileNameParts = explode('.', basename($file));
1244+
$locale = $fileNameParts[\count($fileNameParts) - 2];
1245+
if (!isset($files[$locale])) {
1246+
$files[$locale] = [];
1247+
}
12471248

1248-
$files[$locale][] = (string) $file;
1249+
$files[$locale][] = (string) $file;
1250+
}
12491251
}
12501252

12511253
$projectDir = $container->getParameter('kernel.project_dir');

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,19 @@ public function testTranslator()
859859
$files,
860860
'->registerTranslatorConfiguration() finds translation resources with dots in domain'
861861
);
862+
$this->assertContains(strtr(__DIR__.'/translations/security.en.yaml', '/', \DIRECTORY_SEPARATOR), $files);
863+
864+
$positionOverridingTranslationFile = array_search(strtr(realpath(__DIR__.'/translations/security.en.yaml'), '/', \DIRECTORY_SEPARATOR), $files);
865+
866+
if (false !== $positionCoreTranslationFile = array_search(strtr(realpath(__DIR__.'/../../../../Component/Security/Core/Resources/translations/security.en.xlf'), '/', \DIRECTORY_SEPARATOR), $files)) {
867+
$this->assertContains(strtr(realpath(__DIR__.'/../../../../Component/Security/Core/Resources/translations/security.en.xlf'), '/', \DIRECTORY_SEPARATOR), $files);
868+
} else {
869+
$this->assertContains(strtr(realpath(__DIR__.'/../../vendor/symfony/security-core/Resources/translations/security.en.xlf'), '/', \DIRECTORY_SEPARATOR), $files);
870+
871+
$positionCoreTranslationFile = array_search(strtr(realpath(__DIR__.'/../../vendor/symfony/security-core/Resources/translations/security.en.xlf'), '/', \DIRECTORY_SEPARATOR), $files);
872+
}
873+
874+
$this->assertGreaterThan($positionCoreTranslationFile, $positionOverridingTranslationFile);
862875

863876
$calls = $container->getDefinition('translator.default')->getMethodCalls();
864877
$this->assertEquals(['fr'], $calls[1][1][0]);

Tests/DependencyInjection/translations/security.en.yaml

Whitespace-only changes.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"symfony/messenger": "^5.2",
5252
"symfony/mime": "^4.4|^5.0",
5353
"symfony/process": "^4.4|^5.0",
54-
"symfony/security-bundle": "^5.1",
54+
"symfony/security-bundle": "^5.2",
5555
"symfony/serializer": "^5.2",
5656
"symfony/stopwatch": "^4.4|^5.0",
5757
"symfony/string": "^5.0",

0 commit comments

Comments
 (0)