Use PHP functions as array_map callbacks when possible

This commit is contained in:
Javier Eguiluz 2017-03-14 12:32:10 +01:00
parent 71b2c3a52e
commit 405bd4cc81
3 changed files with 3 additions and 3 deletions

View File

@ -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),

View File

@ -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(

View File

@ -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');
}