8000 minor #26990 declare types in array_map callbacks (DQNEO) · symfony/symfony@2ed0c67 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ed0c67

Browse files
committed
minor #26990 declare types in array_map callbacks (DQNEO)
This PR was squashed before being merged into the 4.1-dev branch (closes #26990). Discussion ---------- declare types in array_map callbacks | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | This is a continuation of #26821 Commits ------- e7d5634 declare types in array_map callbacks
2 parents cbc2376 + e7d5634 commit 2ed0c67

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717
use Symfony\Component\DependencyInjection\Definition;
1818
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
19+
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
1920
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
2021
use Symfony\Component\ExpressionLanguage\Expression;
2122

@@ -45,7 +46,7 @@ public function __construct(ContainerBuilder $container, PhpFileLoader $loader,
4546
final public function extension(string $namespace, array $config)
4647
{
4748
if (!$this->container->hasExtension($namespace)) {
48-
$extensions = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
49+
$extensions = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
4950
throw new InvalidArgumentException(sprintf(
5051
'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s',
5152
$namespace,

src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
16+
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718
use Symfony\Component\DependencyInjection\Reference;
1819
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
@@ -776,7 +777,7 @@ public function testBindings()
776777
'$foo' => array(null),
777778
'$quz' => 'quz',
778779
'$factory' => 'factory',
779-
), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings()));
780+
), array_map(function (BoundArgument $v) { return $v->getValues()[0]; }, $definition->getBindings()));
780781
$this->assertEquals(array(
781782
'quz',
782783
null,
@@ -793,6 +794,6 @@ public function testBindings()
793794
'NonExistent' => null,
794795
'$quz' => 'quz',
795796
'$factory' => 'factory',
796-
), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings()));
797+
), array_map(function (BoundArgument $v) { return $v->getValues()[0]; }, $definition->getBindings()));
797798
}
798799
}

src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Loader;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\DependencyInjection\Argument\BoundArgument;
1516
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718
use Symfony\Component\DependencyInjection\Reference;
@@ -719,7 +720,7 @@ public function testBindings()
719720
'$foo' => array(null),
720721
'$quz' => 'quz',
721722
'$factory' => 'factory',
722-
), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings()));
723+
), array_map(function (BoundArgument $v) { return $v->getValues()[0]; }, $definition->getBindings()));
723724
$this->assertEquals(array(
724725
'quz',
725726
null,
@@ -736,6 +737,6 @@ public function testBindings()
736737
'NonExistent' => null,
737738
'$quz' => 'quz',
738739
'$factory' => 'factory',
739-
), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings()));
740+
), array_map(function (BoundArgument $v) { return $v->getValues()[0]; }, $definition->getBindings()));
740741
}
741742
}

0 commit comments

Comments
 (0)
0