declare types in array_map callbacks
This commit is contained in:
parent
9a0422ce45
commit
e7d5634cf4
@ -16,6 +16,7 @@ use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||
use Symfony\Component\ExpressionLanguage\Expression;
|
||||
|
||||
@ -44,7 +45,7 @@ class ContainerConfigurator extends AbstractConfigurator
|
||||
final public function extension($namespace, array $config)
|
||||
{
|
||||
if (!$this->container->hasExtension($namespace)) {
|
||||
$extensions = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
|
||||
$extensions = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
|
||||
throw new InvalidArgumentException(sprintf(
|
||||
'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s',
|
||||
$namespace,
|
||||
|
@ -13,6 +13,7 @@ namespace Symfony\Component\DependencyInjection\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
|
||||
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
@ -788,7 +789,7 @@ class XmlFileLoaderTest extends TestCase
|
||||
'$foo' => array(null),
|
||||
'$quz' => 'quz',
|
||||
'$factory' => 'factory',
|
||||
), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings()));
|
||||
), array_map(function (BoundArgument $v) { return $v->getValues()[0]; }, $definition->getBindings()));
|
||||
$this->assertEquals(array(
|
||||
'quz',
|
||||
null,
|
||||
@ -805,6 +806,6 @@ class XmlFileLoaderTest extends TestCase
|
||||
'NonExistent' => null,
|
||||
'$quz' => 'quz',
|
||||
'$factory' => 'factory',
|
||||
), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings()));
|
||||
), array_map(function (BoundArgument $v) { return $v->getValues()[0]; }, $definition->getBindings()));
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\DependencyInjection\Tests\Loader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
|
||||
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
@ -713,7 +714,7 @@ class YamlFileLoaderTest extends TestCase
|
||||
'$foo' => array(null),
|
||||
'$quz' => 'quz',
|
||||
'$factory' => 'factory',
|
||||
), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings()));
|
||||
), array_map(function (BoundArgument $v) { return $v->getValues()[0]; }, $definition->getBindings()));
|
||||
$this->assertEquals(array(
|
||||
'quz',
|
||||
null,
|
||||
@ -730,6 +731,6 @@ class YamlFileLoaderTest extends TestCase
|
||||
'NonExistent' => null,
|
||||
'$quz' => 'quz',
|
||||
'$factory' => 'factory',
|
||||
), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings()));
|
||||
), array_map(function (BoundArgument $v) { return $v->getValues()[0]; }, $definition->getBindings()));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user