minor #26821 declare type for arguments of anonymous functions for v2.7 (DQNEO)
This PR was submitted for the 2.7 branch but it was squashed and merged into the 4.1-dev branch instead (closes #26821).
Discussion
----------
declare type for arguments of anonymous functions for v2.7
| 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 |
Declare type for array_map
Commits
-------
74ab256bec
declare type for arguments of anonymous functions for v2.7
This commit is contained in:
commit
028e1e57f0
@ -204,7 +204,7 @@ class DoctrineExtensionTest extends TestCase
|
|||||||
$definition = $container->getDefinition('doctrine.orm.default_metadata_cache');
|
$definition = $container->getDefinition('doctrine.orm.default_metadata_cache');
|
||||||
$defCalls = $definition->getMethodCalls();
|
$defCalls = $definition->getMethodCalls();
|
||||||
$expectedCalls[] = 'setNamespace';
|
$expectedCalls[] = 'setNamespace';
|
||||||
$actualCalls = array_map(function ($call) {
|
$actualCalls = array_map(function (array $call) {
|
||||||
return $call[0];
|
return $call[0];
|
||||||
}, $defCalls);
|
}, $defCalls);
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
// format args
|
// format args
|
||||||
$args = array_map(function ($param) {
|
$args = array_map(function (\ReflectionParameter $param) {
|
||||||
if ($param->isDefaultValueAvailable()) {
|
if ($param->isDefaultValueAvailable()) {
|
||||||
return $param->getName().' = '.json_encode($param->getDefaultValue());
|
return $param->getName().' = '.json_encode($param->getDefaultValue());
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Controller;
|
namespace Symfony\Bundle\FrameworkBundle\Controller;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||||
use Symfony\Component\HttpKernel\KernelInterface;
|
use Symfony\Component\HttpKernel\KernelInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,7 +118,7 @@ class ControllerNameParser
|
|||||||
*/
|
*/
|
||||||
private function findAlternative(string $nonExistentBundleName): ?string
|
private function findAlternative(string $nonExistentBundleName): ?string
|
||||||
{
|
{
|
||||||
$bundleNames = array_map(function ($b) {
|
$bundleNames = array_map(function (BundleInterface $b) {
|
||||||
return $b->getName();
|
return $b->getName();
|
||||||
}, $this->kernel->getBundles());
|
}, $this->kernel->getBundles());
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
||||||
|
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||||
use Symfony\Component\ExpressionLanguage\Expression;
|
use Symfony\Component\ExpressionLanguage\Expression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -667,7 +668,7 @@ EOF
|
|||||||
|
|
||||||
// can it be handled by an extension?
|
// can it be handled by an extension?
|
||||||
if (!$this->container->hasExtension($node->namespaceURI)) {
|
if (!$this->container->hasExtension($node->namespaceURI)) {
|
||||||
$extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getNamespace(); }, $this->container->getExtensions()));
|
$extensionNamespaces = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getNamespace(); }, $this->container->getExtensions()));
|
||||||
throw new InvalidArgumentException(sprintf(
|
throw new InvalidArgumentException(sprintf(
|
||||||
'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s',
|
'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s',
|
||||||
$node->tagName,
|
$node->tagName,
|
||||||
|
@ -23,6 +23,7 @@ use Symfony\Component\DependencyInjection\Definition;
|
|||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
||||||
|
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||||
use Symfony\Component\Yaml\Exception\ParseException;
|
use Symfony\Component\Yaml\Exception\ParseException;
|
||||||
use Symfony\Component\Yaml\Parser as YamlParser;
|
use Symfony\Component\Yaml\Parser as YamlParser;
|
||||||
use Symfony\Component\Yaml\Tag\TaggedValue;
|
use Symfony\Component\Yaml\Tag\TaggedValue;
|
||||||
@ -652,7 +653,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->container->hasExtension($namespace)) {
|
if (!$this->container->hasExtension($namespace)) {
|
||||||
$extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
|
$extensionNamespaces = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
|
||||||
throw new InvalidArgumentException(sprintf(
|
throw new InvalidArgumentException(sprintf(
|
||||||
'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s',
|
'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s',
|
||||||
$namespace,
|
$namespace,
|
||||||
|
@ -144,7 +144,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
|||||||
// when there are errors in sub-requests, the parent and/or children tokens
|
// when there are errors in sub-requests, the parent and/or children tokens
|
||||||
// may equal the profile token, resulting in infinite loops
|
// may equal the profile token, resulting in infinite loops
|
||||||
$parentToken = $profile->getParentToken() !== $profileToken ? $profile->getParentToken() : null;
|
$parentToken = $profile->getParentToken() !== $profileToken ? $profile->getParentToken() : null;
|
||||||
$childrenToken = array_filter(array_map(function ($p) use ($profileToken) {
|
$childrenToken = array_filter(array_map(function (Profile $p) use ($profileToken) {
|
||||||
return $profileToken !== $p->getToken() ? $p->getToken() : null;
|
return $profileToken !== $p->getToken() ? $p->getToken() : null;
|
||||||
}, $profile->getChildren()));
|
}, $profile->getChildren()));
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
|
|||||||
*/
|
*/
|
||||||
private function notImplemented(array $dataSets)
|
private function notImplemented(array $dataSets)
|
||||||
{
|
{
|
||||||
return array_map(function ($row) {
|
return array_map(function (array $row) {
|
||||||
return array($row[0], $row[1], 0);
|
return array($row[0], $row[1], 0);
|
||||||
}, $dataSets);
|
}, $dataSets);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ namespace Symfony\Component\Security\Core\Authorization\Voter;
|
|||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
|
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
|
||||||
use Symfony\Component\Security\Core\Authorization\ExpressionLanguage;
|
use Symfony\Component\Security\Core\Authorization\ExpressionLanguage;
|
||||||
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
use Symfony\Component\Security\Core\Role\RoleHierarchyInterface;
|
use Symfony\Component\Security\Core\Role\RoleHierarchyInterface;
|
||||||
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
|
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
|
||||||
use Symfony\Component\ExpressionLanguage\Expression;
|
use Symfony\Component\ExpressionLanguage\Expression;
|
||||||
@ -85,7 +86,7 @@ class ExpressionVoter implements VoterInterface
|
|||||||
'user' => $token->getUser(),
|
'user' => $token->getUser(),
|
||||||
'object' => $subject,
|
'object' => $subject,
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
'roles' => array_map(function ($role) { return $role->getRole(); }, $roles),
|
'roles' => array_map(function (Role $role) { return $role->getRole(); }, $roles),
|
||||||
'trust_resolver' => $this->trustResolver,
|
'trust_resolver' => $this->trustResolver,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
|
|||||||
|
|
||||||
$interfaces = $metadata->getReflectionClass()->getInterfaces();
|
$interfaces = $metadata->getReflectionClass()->getInterfaces();
|
||||||
|
|
||||||
$interfaces = array_filter($interfaces, function ($interface) use ($parent, $interfaces) {
|
$interfaces = array_filter($interfaces, function (\ReflectionClass $interface) use ($parent, $interfaces) {
|
||||||
$interfaceName = $interface->getName();
|
$interfaceName = $interface->getName();
|
||||||
|
|
||||||
if ($parent && $parent->implementsInterface($interfaceName)) {
|
if ($parent && $parent->implementsInterface($interfaceName)) {
|
||||||
|
Reference in New Issue
Block a user