8000 declare type for arguments of anonymous functions for v2.7 · symfony/symfony@74ab256 · GitHub
[go: up one dir, main page]

Skip to content

Commit 74ab256

Browse files
DQNEOfabpot
authored andcommitted
declare type for arguments of anonymous functions for v2.7
1 parent 3d40bfa commit 74ab256

File tree

9 files changed

+13
-9
lines changed

9 files changed

+13
-9
lines changed

src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function testLoadBasicCacheDriver(string $class, array $config, array $ex
204204
$definition = $container->getDefinition('doctrine.orm.default_metadata_cache');
205205
$defCalls = $definition->getMethodCalls();
206206
$expectedCalls[] = 'setNamespace';
207-
$actualCalls = array_map(function ($call) {
207+
$actualCalls = array_map(function (array $call) {
208208
return $call[0];
209209
}, $defCalls);
210210

src/Symfony/Bridge/Twig/Command/DebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private function getMetadata($type, $entity)
199199
}
200200

201201
// format args
202-
$args = array_map(function ($param) {
202+
$args = array_map(function (\ReflectionParameter $param) {
203203
if ($param->isDefaultValueAvailable()) {
204204
return $param->getName().' = '.json_encode($param->getDefaultValue());
205205
}

src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Controller;
1313

14+
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
1415
use Symfony\Component\HttpKernel\KernelInterface;
1516

1617
/**
@@ -117,7 +118,7 @@ public function build($controller)
117118
*/
118119
private function findAlternative(string $nonExistentBundleName): ?string
119120
{
120-
$bundleNames = array_map(function ($b) {
121+
$bundleNames = array_map(function (BundleInterface $b) {
121122
return $b->getName();
122123
}, $this->kernel->getBundles());
123124

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Symfony\Component\DependencyInjection\Reference;
2424
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
2525
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
26+
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
2627
use Symfony\Component\ExpressionLanguage\Expression;
2728

2829
/**
@@ -667,7 +668,7 @@ private function validateExtensions(\DOMDocument $dom, $file)
667668

668669
// can it be handled by an extension?
669670
if (!$this->container->hasExtension($node->namespaceURI)) {
670-
$extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getNamespace(); }, $this->container->getExtensions()));
671+
$extensionNamespaces = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getNamespace(); }, $this->container->getExtensions()));
671672
throw new InvalidArgumentException(sprintf(
672673
'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s',
673674
$node->tagName,

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Symfony\Component\DependencyInjection\Reference;
2424
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
2525
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
26+
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
2627
use Symfony\Component\Yaml\Exception\ParseException;
2728
use Symfony\Component\Yaml\Parser as YamlParser;
2829
use Symfony\Component\Yaml\Tag\TaggedValue;
@@ -652,7 +653,7 @@ private function validate($content, $file)
652653
}
653654

654655
if (!$this->container->hasExtension($namespace)) {
655-
$extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
656+
$extensionNamespaces = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
656657
throw new InvalidArgumentException(sprintf(
657658
'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s',
658659
$namespace,

src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function write(Profile $profile)
144144
// when there are errors in sub-requests, the parent and/or children tokens
145145
// may equal the profile token, resulting in infinite loops
146146
$parentToken = $profile->getParentToken() !== $profileToken ? $profile->getParentToken() : null;
147-
$childrenToken = array_filter(array_map(function ($p) use ($profileToken) {
147+
$childrenToken = array_filter(array_map(function (Profile $p) use ($profileToken) {
148148
return $profileToken !== $p->getToken() ? $p->getToken() : null;
149149
}, $profile->getChildren()));
150150

src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ protected function isIntlFailure($errorCode)
219219
*/
220220
private function notImplemented(array $dataSets)
221221
{
222-
return array_map(function ($row) {
222+
return array_map(function (array $row) {
223223
return array($row[0], $row[1], 0);
224224
}, $dataSets);
225225
}

src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1515
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
1616
use Symfony\Component\Security\Core\Authorization\ExpressionLanguage;
17+
use Symfony\Component\Security\Core\Role\Role;
1718
use Symfony\Component\Security\Core\Role\RoleHierarchyInterface;
1819
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
1920
use Symfony\Component\ExpressionLanguage\Expression;
@@ -85,7 +86,7 @@ private function getVariables(TokenInterface $token, $subject)
8586
'user' => $token->getUser(),
8687
'object' => $subject,
8788
'subject' => $subject,
88-
'roles' => array_map(function ($role) { return $role->getRole(); }, $roles),
89+
'roles' => array_map(function (Role $role) { return $role->getRole(); }, $roles),
8990
'trust_resolver' => $this->trustResolver,
9091
);
9192

src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private function mergeConstraints(ClassMetadata $metadata)
124124

125125
$interfaces = $metadata->getReflectionClass()->getInterfaces();
126126

127-
$interfaces = array_filter($interfaces, function ($interface) use ($parent, $interfaces) {
127+
$interfaces = array_filter($interfaces, function (\ReflectionClass $interface) use ($parent, $interfaces) {
128128
$interfaceName = $interface->getName();
129129

130130
if ($parent && $parent->implementsInterface($interfaceName)) {

0 commit comments

Comments
 (0)
0