mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 18:36:53 +00:00
Use arrow function
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user