mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-03 14:07:34 +00:00
Fix CS
This commit is contained in:
+2
-2
@@ -76,7 +76,7 @@ class Compiler
|
||||
$node->compile($this);
|
||||
|
||||
if ($this->didUseEcho) {
|
||||
throw new \LogicException('Using "%s" is not supported; use "yield" instead in "%s".', $this->didUseEcho, \get_class($node));
|
||||
throw new \LogicException('Using "%s" is not supported; use "yield" instead in "%s".', $this->didUseEcho, $node::class);
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -101,7 +101,7 @@ class Compiler
|
||||
$node->compile($this);
|
||||
|
||||
if ($this->didUseEcho) {
|
||||
throw new \LogicException(sprintf('Using "%s" is not supported; use "yield" instead in "%s".', $this->didUseEcho, \get_class($node)));
|
||||
throw new \LogicException(sprintf('Using "%s" is not supported; use "yield" instead in "%s".', $this->didUseEcho, $node::class));
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
@@ -504,7 +504,6 @@ final class CoreExtension extends AbstractExtension
|
||||
$date = 'now';
|
||||
}
|
||||
|
||||
return new \DateTimeImmutable($date, false !== $timezone ? $timezone : $env->getExtension(self::class)->getTimezone());
|
||||
return new \DateTimeImmutable($date, false !== $timezone ? $timezone : $this->getTimezone());
|
||||
}
|
||||
|
||||
@@ -1549,7 +1548,7 @@ final class CoreExtension extends AbstractExtension
|
||||
if (!isset($cache[$class])) {
|
||||
$methods = get_class_methods($object);
|
||||
sort($methods);
|
||||
$lcMethods = array_map(fn($value) => strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), $methods);
|
||||
$lcMethods = array_map(fn ($value) => strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), $methods);
|
||||
$classCache = [];
|
||||
foreach ($methods as $i => $method) {
|
||||
$classCache[$method] = $method;
|
||||
|
||||
@@ -42,7 +42,7 @@ class CaptureNode extends Node
|
||||
->subcompile($this->getNode('body'))
|
||||
->write("return; yield '';\n")
|
||||
->outdent()
|
||||
->write("})(), false))")
|
||||
->write('})(), false))')
|
||||
;
|
||||
if (!$this->getAttribute('raw')) {
|
||||
$compiler->raw(") ? '' : new Markup(\$tmp, \$this->env->getCharset())");
|
||||
|
||||
@@ -113,7 +113,7 @@ final class OptimizerNodeVisitor implements NodeVisitorInterface
|
||||
return $node;
|
||||
}
|
||||
|
||||
if (Node::class === get_class($node)) {
|
||||
if (Node::class === $node::class) {
|
||||
return new TextNode($text, $node->getTemplateLine());
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ final class EscaperRuntime implements RuntimeExtensionInterface
|
||||
if (!\is_string($string)) {
|
||||
if (\is_object($string) && method_exists($string, '__toString')) {
|
||||
if ($autoescape) {
|
||||
$c = \get_class($string);
|
||||
$c = $string::class;
|
||||
if (!isset($this->safeClasses[$c])) {
|
||||
$this->safeClasses[$c] = [];
|
||||
foreach (class_parents($string) + class_implements($string) as $class) {
|
||||
|
||||
@@ -65,7 +65,7 @@ final class SecurityPolicy implements SecurityPolicyInterface
|
||||
{
|
||||
$this->allowedMethods = [];
|
||||
foreach ($methods as $class => $m) {
|
||||
$this->allowedMethods[$class] = array_map(fn($value) => 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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,7 @@ use Twig\Loader\ArrayLoader;
|
||||
use Twig\Loader\LoaderInterface;
|
||||
use Twig\Node\Node;
|
||||
use Twig\NodeVisitor\NodeVisitorInterface;
|
||||
use Twig\Runtime\EscaperRuntime;
|
||||
use Twig\RuntimeLoader\FactoryRuntimeLoader;
|
||||
use Twig\RuntimeLoader\RuntimeLoaderInterface;
|
||||
use Twig\Source;
|
||||
use Twig\Token;
|
||||
use Twig\TokenParser\AbstractTokenParser;
|
||||
|
||||
Reference in New Issue
Block a user