Use arrow function

This commit is contained in:
Fabien Potencier
2023-12-09 15:21:27 +01:00
parent 06d9fc6ad0
commit 0668be9e76
4 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -1561,7 +1561,7 @@ function twig_get_attribute(Environment $env, Source $source, $object, $item, ar
if (!isset($cache[$class])) {
$methods = get_class_methods($object);
sort($methods);
$lcMethods = array_map(function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, $methods);
$lcMethods = array_map(fn($value) => strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), $methods);
$classCache = [];
foreach ($methods as $i => $method) {
$classCache[$method] = $method;
+1 -1
View File
@@ -50,7 +50,7 @@ final class SecurityPolicy implements SecurityPolicyInterface
{
$this->allowedMethods = [];
foreach ($methods as $class => $m) {
$this->allowedMethods[$class] = array_map(function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]);
$this->allowedMethods[$class] = array_map(fn($value) => strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), \is_array($m) ? $m : [$m]);
}
}
+3 -3
View File
@@ -213,7 +213,7 @@ abstract class Template
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
ob_start(fn() => '');
}
$this->displayParentBlock($name, $context, $blocks);
@@ -238,7 +238,7 @@ abstract class Template
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
ob_start(fn() => '');
}
$this->displayBlock($name, $context, $blocks, $useBlocks);
@@ -373,7 +373,7 @@ abstract class Template
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
ob_start(fn() => '');
}
try {
$this->display($context);
+1 -1
View File
@@ -65,7 +65,7 @@ final class TemplateWrapper
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
ob_start(fn() => '');
}
try {
$this->template->displayBlock($name, $context);