8000 minor #21994 Use PHP functions as array_map callbacks when possible (… · symfony/symfony@dd8e50b · GitHub
[go: up one dir, main page]

Skip to content

Commit dd8e50b

Browse files
committed
minor #21994 Use PHP functions as array_map callbacks when possible (javiereguiluz)
This PR was merged into the 2.7 branch. Discussion ---------- Use PHP functions as array_map callbacks when possible | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - We already do that in 99% of the cases ... but there were 3 occurrences where we didn't do it. Commits ------- 405bd4c Use PHP functions as array_map callbacks when possible
2 parents 26198cf + 405bd4c commit dd8e50b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function testTranslator()
224224
$this->assertEquals('translator.default', (string) $container->getAlias('translator'), '->registerTranslatorConfiguration() redefines translator service from identity to real translator');
225225
$options = $container->getDefinition('translator.default')->getArgument(3);
226226

227-
$files = array_map(function ($resource) { return realpath($resource); }, $options['resource_files']['en']);
227+
$files = array_map('realpath', $options['resource_files']['en']);
228228
$ref = new \ReflectionClass('Symfony\Component\Validator\Validation');
229229
$this->assertContains(
230230
strtr(dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR),

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testFirewalls()
7373
foreach (array_keys($arguments[1]) as $contextId) {
7474
$contextDef = $container->getDefinition($contextId);
7575
$arguments = $contextDef->getArguments();
76-
$listeners[] = array_map(function ($ref) { return (string) $ref; }, $arguments['index_0']);
76+
$listeners[] = array_map('strval', $arguments['index_0']);
7777
}
7878

7979
$this->assertEquals(array(

src/Symfony/Component/Finder/Tests/FinderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ public function testGetIterator()
317317

318318
$finder = $this->buildFinder();
319319
$a = iterator_to_array($finder->directories()->in(self::$tmpDir));
320-
$a = array_values(array_map(function ($a) { return (string) $a; }, $a));
320+
$a = array_values(array_map('strval', $a));
321321
sort($a);
322322
$this->assertEquals($expected, $a, 'implements the \IteratorAggregate interface');
323323
}

0 commit comments

Comments
 (0)
0