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
-------
405bd4cc81
Use PHP functions as array_map callbacks when possible
This commit is contained in:
commit
dd8e50baa1
@ -224,7 +224,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$this->assertEquals('translator.default', (string) $container->getAlias('translator'), '->registerTranslatorConfiguration() redefines translator service from identity to real translator');
|
||||
$options = $container->getDefinition('translator.default')->getArgument(3);
|
||||
|
||||
$files = array_map(function ($resource) { return realpath($resource); }, $options['resource_files']['en']);
|
||||
$files = array_map('realpath', $options['resource_files']['en']);
|
||||
$ref = new \ReflectionClass('Symfony\Component\Validator\Validation');
|
||||
$this->assertContains(
|
||||
strtr(dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR),
|
||||
|
@ -73,7 +73,7 @@ abstract class CompleteConfigurationTest extends TestCase
|
||||
foreach (array_keys($arguments[1]) as $contextId) {
|
||||
$contextDef = $container->getDefinition($contextId);
|
||||
$arguments = $contextDef->getArguments();
|
||||
$listeners[] = array_map(function ($ref) { return (string) $ref; }, $arguments['index_0']);
|
||||
$listeners[] = array_map('strval', $arguments['index_0']);
|
||||
}
|
||||
|
||||
$this->assertEquals(array(
|
||||
|
@ -317,7 +317,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$a = iterator_to_array($finder->directories()->in(self::$tmpDir));
|
||||
$a = array_values(array_map(function ($a) { return (string) $a; }, $a));
|
||||
$a = array_values(array_map('strval', $a));
|
||||
sort($a);
|
||||
$this->assertEquals($expected, $a, 'implements the \IteratorAggregate interface');
|
||||
}
|
||||
|
Reference in New Issue
Block a user