mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-31 20:47:28 +00:00
Fix CS
This commit is contained in:
@@ -34,7 +34,7 @@ function twig_html_to_markdown(string $body, array $options = []): string
|
||||
throw new \LogicException('You cannot use the "html_to_markdown" filter as league/html-to-markdown is not installed; try running "composer require league/html-to-markdown".');
|
||||
}
|
||||
|
||||
$options = $options + [
|
||||
$options += [
|
||||
'hard_break' => true,
|
||||
'strip_tags' => true,
|
||||
'remove_nodes' => 'head style',
|
||||
|
||||
@@ -29,7 +29,7 @@ class FunctionalTest extends TestCase
|
||||
*/
|
||||
public function testMarkdown(string $template, string $expected): void
|
||||
{
|
||||
foreach ([LeagueMarkdown::class, ErusevMarkdown::class, /*MichelfMarkdown::class,*/ DefaultMarkdown::class] as $class) {
|
||||
foreach ([LeagueMarkdown::class, ErusevMarkdown::class, /* MichelfMarkdown::class, */ DefaultMarkdown::class] as $class) {
|
||||
$twig = new Environment(new ArrayLoader([
|
||||
'index' => $template,
|
||||
'html' => <<<EOF
|
||||
|
||||
@@ -38,7 +38,7 @@ class TwigExtraExtension extends Extension
|
||||
if ($this->isConfigEnabled($container, $config[$extension])) {
|
||||
$loader->load($extension.'.php');
|
||||
|
||||
if ('markdown' === $extension && \class_exists(CommonMarkConverter::class)) {
|
||||
if ('markdown' === $extension && class_exists(CommonMarkConverter::class)) {
|
||||
$loader->load('markdown_league.php');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ namespace Twig\Extra\TwigExtraBundle\Tests\Fixture;
|
||||
|
||||
use League\CommonMark\Extension\Strikethrough\StrikethroughExtension;
|
||||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||
use Symfony\Bundle\TwigBundle\TwigBundle;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||
use Twig\Extra\TwigExtraBundle\TwigExtraBundle;
|
||||
|
||||
class Kernel extends BaseKernel
|
||||
|
||||
@@ -63,7 +63,7 @@ class FilesystemCache implements CacheInterface
|
||||
|
||||
if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) {
|
||||
// Compile cached file into bytecode cache
|
||||
if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) {
|
||||
if (\function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) {
|
||||
@opcache_invalidate($key, true);
|
||||
} elseif (\function_exists('apc_compile_file')) {
|
||||
apc_compile_file($key);
|
||||
|
||||
@@ -343,9 +343,9 @@ function twig_cycle($values, $position)
|
||||
* @param \Traversable|array|int|float|string $values The values to pick a random item from
|
||||
* @param int|null $max Maximum value used when $values is an int
|
||||
*
|
||||
* @throws RuntimeError when $values is an empty array (does not apply to an empty string which is returned as is)
|
||||
*
|
||||
* @return mixed A random value from the given sequence
|
||||
*
|
||||
* @throws RuntimeError when $values is an empty array (does not apply to an empty string which is returned as is)
|
||||
*/
|
||||
function twig_random(Environment $env, $values = null, $max = null)
|
||||
{
|
||||
@@ -768,7 +768,7 @@ function twig_split_filter(Environment $env, $value, $delimiter, $limit = null)
|
||||
{
|
||||
$value = $value ?? '';
|
||||
|
||||
if (\strlen($delimiter) > 0) {
|
||||
if ('' !== $delimiter) {
|
||||
return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit);
|
||||
}
|
||||
|
||||
@@ -1022,9 +1022,6 @@ function twig_compare($a, $b)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pattern
|
||||
* @param string|null $subject
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RuntimeError When an invalid pattern is used
|
||||
@@ -1123,7 +1120,7 @@ function twig_length_filter(Environment $env, $thing)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_scalar($thing)) {
|
||||
if (\is_scalar($thing)) {
|
||||
return mb_strlen($thing, $env->getCharset());
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ final class DebugExtension extends AbstractExtension
|
||||
// dump is safe if var_dump is overridden by xdebug
|
||||
$isDumpOutputHtmlSafe = \extension_loaded('xdebug')
|
||||
// false means that it was not set (and the default is on) or it explicitly enabled
|
||||
&& (false === ini_get('xdebug.overload_var_dump') || ini_get('xdebug.overload_var_dump'))
|
||||
&& (false === \ini_get('xdebug.overload_var_dump') || \ini_get('xdebug.overload_var_dump'))
|
||||
// false means that it was not set (and the default is on) or it explicitly enabled
|
||||
// xdebug.overload_var_dump produces HTML only when html_errors is also enabled
|
||||
&& (false === ini_get('html_errors') || ini_get('html_errors'))
|
||||
&& (false === \ini_get('html_errors') || \ini_get('html_errors'))
|
||||
|| 'cli' === \PHP_SAPI
|
||||
;
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ function twig_escape_filter(Environment $env, $string, $strategy = 'html', $char
|
||||
* The following replaces characters undefined in HTML with the
|
||||
* hex entity for the Unicode replacement character.
|
||||
*/
|
||||
if (($ord <= 0x1f && "\t" != $chr && "\n" != $chr && "\r" != $chr) || ($ord >= 0x7f && $ord <= 0x9f)) {
|
||||
if (($ord <= 0x1F && "\t" != $chr && "\n" != $chr && "\r" != $chr) || ($ord >= 0x7F && $ord <= 0x9F)) {
|
||||
return '�';
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ function twig_escape_filter(Environment $env, $string, $strategy = 'html', $char
|
||||
|
||||
default:
|
||||
$escapers = $env->getExtension(EscaperExtension::class)->getEscapers();
|
||||
if (array_key_exists($strategy, $escapers)) {
|
||||
if (\array_key_exists($strategy, $escapers)) {
|
||||
return $escapers[$strategy]($env, $string, $charset);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -422,7 +422,7 @@ class Lexer
|
||||
$this->pushToken(/* Token::INTERPOLATION_START_TYPE */ 10);
|
||||
$this->moveCursor($match[0]);
|
||||
$this->pushState(self::STATE_INTERPOLATION);
|
||||
} elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, 0, $this->cursor) && \strlen($match[0]) > 0) {
|
||||
} elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, 0, $this->cursor) && '' !== $match[0]) {
|
||||
$this->pushToken(/* Token::STRING_TYPE */ 7, stripcslashes($match[0]));
|
||||
$this->moveCursor($match[0]);
|
||||
} elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, 0, $this->cursor)) {
|
||||
|
||||
@@ -41,9 +41,6 @@ class Markup implements \Countable, \JsonSerializable
|
||||
return mb_strlen($this->content, $this->charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
|
||||
@@ -50,10 +50,10 @@ final class MacroAutoImportNodeVisitor implements NodeVisitorInterface
|
||||
}
|
||||
} elseif ($this->inAModule) {
|
||||
if (
|
||||
$node instanceof GetAttrExpression &&
|
||||
$node->getNode('node') instanceof NameExpression &&
|
||||
'_self' === $node->getNode('node')->getAttribute('name') &&
|
||||
$node->getNode('attribute') instanceof ConstantExpression
|
||||
$node instanceof GetAttrExpression
|
||||
&& $node->getNode('node') instanceof NameExpression
|
||||
&& '_self' === $node->getNode('node')->getAttribute('name')
|
||||
&& $node->getNode('attribute') instanceof ConstantExpression
|
||||
) {
|
||||
$this->hasMacroCalls = true;
|
||||
|
||||
|
||||
@@ -99,8 +99,8 @@ final class OptimizerNodeVisitor implements NodeVisitorInterface
|
||||
|
||||
$exprNode = $node->getNode('expr');
|
||||
if (
|
||||
$exprNode instanceof BlockReferenceExpression ||
|
||||
$exprNode instanceof ParentExpression
|
||||
$exprNode instanceof BlockReferenceExpression
|
||||
|| $exprNode instanceof ParentExpression
|
||||
) {
|
||||
$exprNode->setAttribute('output', true);
|
||||
|
||||
@@ -166,7 +166,7 @@ final class OptimizerNodeVisitor implements NodeVisitorInterface
|
||||
&& 'include' === $node->getAttribute('name')
|
||||
&& (!$node->getNode('arguments')->hasNode('with_context')
|
||||
|| false !== $node->getNode('arguments')->getNode('with_context')->getAttribute('value')
|
||||
)
|
||||
)
|
||||
) {
|
||||
$this->addLoopToAll();
|
||||
}
|
||||
@@ -175,12 +175,12 @@ final class OptimizerNodeVisitor implements NodeVisitorInterface
|
||||
elseif ($node instanceof GetAttrExpression
|
||||
&& (!$node->getNode('attribute') instanceof ConstantExpression
|
||||
|| 'parent' === $node->getNode('attribute')->getAttribute('value')
|
||||
)
|
||||
)
|
||||
&& (true === $this->loops[0]->getAttribute('with_loop')
|
||||
|| ($node->getNode('node') instanceof NameExpression
|
||||
&& 'loop' === $node->getNode('node')->getAttribute('name')
|
||||
)
|
||||
)
|
||||
|| ($node->getNode('node') instanceof NameExpression
|
||||
&& 'loop' === $node->getNode('node')->getAttribute('name')
|
||||
)
|
||||
)
|
||||
) {
|
||||
$this->addLoopToAll();
|
||||
}
|
||||
|
||||
+1
-2
@@ -303,8 +303,7 @@ class Parser
|
||||
// check that the body does not contain non-empty output nodes
|
||||
if (
|
||||
($node instanceof TextNode && !ctype_space($node->getAttribute('data')))
|
||||
||
|
||||
(!$node instanceof TextNode && !$node instanceof BlockReferenceNode && $node instanceof NodeOutputInterface)
|
||||
|| (!$node instanceof TextNode && !$node instanceof BlockReferenceNode && $node instanceof NodeOutputInterface)
|
||||
) {
|
||||
if (false !== strpos((string) $node, \chr(0xEF).\chr(0xBB).\chr(0xBF))) {
|
||||
$t = substr($node->getAttribute('data'), 3);
|
||||
|
||||
@@ -84,6 +84,7 @@ abstract class IntegrationTestCase extends TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider getLegacyTests
|
||||
*
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyIntegration($file, $message, $condition, $templates, $exception, $outputs, $deprecation = '')
|
||||
@@ -257,7 +258,7 @@ abstract class IntegrationTestCase extends TestCase
|
||||
$templates = [];
|
||||
preg_match_all('/--TEMPLATE(?:\((.*?)\))?--(.*?)(?=\-\-TEMPLATE|$)/s', $test, $matches, \PREG_SET_ORDER);
|
||||
foreach ($matches as $match) {
|
||||
$templates[($match[1] ?: 'index.twig')] = $match[2];
|
||||
$templates[$match[1] ?: 'index.twig'] = $match[2];
|
||||
}
|
||||
|
||||
return $templates;
|
||||
|
||||
+3
-3
@@ -68,9 +68,9 @@ final class Token
|
||||
}
|
||||
|
||||
return ($this->type === $type) && (
|
||||
null === $values ||
|
||||
(\is_array($values) && \in_array($this->value, $values)) ||
|
||||
$this->value == $values
|
||||
null === $values
|
||||
|| (\is_array($values) && \in_array($this->value, $values))
|
||||
|| $this->value == $values
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ final class FromTokenParser extends AbstractTokenParser
|
||||
$stream->expect(/* Token::NAME_TYPE */ 5, 'import');
|
||||
|
||||
$targets = [];
|
||||
do {
|
||||
while (true) {
|
||||
$name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue();
|
||||
|
||||
$alias = $name;
|
||||
@@ -45,7 +45,7 @@ final class FromTokenParser extends AbstractTokenParser
|
||||
if (!$stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) {
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
$stream->expect(/* Token::BLOCK_END_TYPE */ 3);
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ final class UseTokenParser extends AbstractTokenParser
|
||||
|
||||
$targets = [];
|
||||
if ($stream->nextIf('with')) {
|
||||
do {
|
||||
while (true) {
|
||||
$name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue();
|
||||
|
||||
$alias = $name;
|
||||
@@ -56,7 +56,7 @@ final class UseTokenParser extends AbstractTokenParser
|
||||
if (!$stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) {
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
|
||||
$stream->expect(/* Token::BLOCK_END_TYPE */ 3);
|
||||
|
||||
@@ -16,18 +16,12 @@ namespace Twig\Util;
|
||||
*/
|
||||
class TemplateDirIterator extends \IteratorIterator
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return file_get_contents(parent::current());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
|
||||
@@ -380,9 +380,6 @@ final class CoreTestIterator implements \Iterator
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
@@ -393,9 +390,6 @@ final class CoreTestIterator implements \Iterator
|
||||
throw new \LogicException('Code should only use the keys, not the values provided by iterator.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
|
||||
@@ -189,10 +189,10 @@ class Twig_Tests_Extension_EscaperTest extends TestCase
|
||||
try {
|
||||
mb_internal_encoding('ISO-8859-1');
|
||||
foreach ($this->jsSpecialChars as $key => $value) {
|
||||
$this->assertEquals($value, twig_escape_filter($twig, $key, 'js'), 'Failed to escape: ' . $key);
|
||||
$this->assertEquals($value, twig_escape_filter($twig, $key, 'js'), 'Failed to escape: '.$key);
|
||||
}
|
||||
} finally {
|
||||
if ($previousInternalEncoding !== false) {
|
||||
if (false !== $previousInternalEncoding) {
|
||||
mb_internal_encoding($previousInternalEncoding);
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ class Twig_Tests_Extension_EscaperTest extends TestCase
|
||||
public function testUnicodeCodepointConversionToUtf8()
|
||||
{
|
||||
$expected = ' ~ޙ';
|
||||
$codepoints = [0x20, 0x7e, 0x799];
|
||||
$codepoints = [0x20, 0x7E, 0x799];
|
||||
$result = '';
|
||||
foreach ($codepoints as $value) {
|
||||
$result .= $this->codepointToUtf8($value);
|
||||
@@ -270,19 +270,19 @@ class Twig_Tests_Extension_EscaperTest extends TestCase
|
||||
return \chr($codepoint);
|
||||
}
|
||||
if ($codepoint < 0x800) {
|
||||
return \chr($codepoint >> 6 & 0x3f | 0xc0)
|
||||
.\chr($codepoint & 0x3f | 0x80);
|
||||
return \chr($codepoint >> 6 & 0x3F | 0xC0)
|
||||
.\chr($codepoint & 0x3F | 0x80);
|
||||
}
|
||||
if ($codepoint < 0x10000) {
|
||||
return \chr($codepoint >> 12 & 0x0f | 0xe0)
|
||||
.\chr($codepoint >> 6 & 0x3f | 0x80)
|
||||
.\chr($codepoint & 0x3f | 0x80);
|
||||
return \chr($codepoint >> 12 & 0x0F | 0xE0)
|
||||
.\chr($codepoint >> 6 & 0x3F | 0x80)
|
||||
.\chr($codepoint & 0x3F | 0x80);
|
||||
}
|
||||
if ($codepoint < 0x110000) {
|
||||
return \chr($codepoint >> 18 & 0x07 | 0xf0)
|
||||
.\chr($codepoint >> 12 & 0x3f | 0x80)
|
||||
.\chr($codepoint >> 6 & 0x3f | 0x80)
|
||||
.\chr($codepoint & 0x3f | 0x80);
|
||||
return \chr($codepoint >> 18 & 0x07 | 0xF0)
|
||||
.\chr($codepoint >> 12 & 0x3F | 0x80)
|
||||
.\chr($codepoint >> 6 & 0x3F | 0x80)
|
||||
.\chr($codepoint & 0x3F | 0x80);
|
||||
}
|
||||
throw new \Exception('Codepoint requested outside of Unicode range.');
|
||||
}
|
||||
|
||||
@@ -105,18 +105,12 @@ class TwigTestFoo implements \Iterator
|
||||
$this->position = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
return $this->array[$this->position];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
@@ -371,9 +365,6 @@ class SimpleIteratorForTesting implements \Iterator
|
||||
private $data = [1, 2, 3, 4, 5, 6, 7];
|
||||
private $key = 0;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function current()
|
||||
{
|
||||
@@ -385,9 +376,6 @@ class SimpleIteratorForTesting implements \Iterator
|
||||
++$this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function key()
|
||||
{
|
||||
|
||||
@@ -47,11 +47,11 @@ EOF
|
||||
];
|
||||
|
||||
$expr = new ConditionalExpression(
|
||||
new ConstantExpression(true, 1),
|
||||
new ConstantExpression('foo', 1),
|
||||
new ConstantExpression('foo', 1),
|
||||
0
|
||||
);
|
||||
new ConstantExpression(true, 1),
|
||||
new ConstantExpression('foo', 1),
|
||||
new ConstantExpression('foo', 1),
|
||||
0
|
||||
);
|
||||
$node = new IncludeNode($expr, null, false, false, 1);
|
||||
$tests[] = [$node, <<<EOF
|
||||
// line 1
|
||||
|
||||
@@ -194,11 +194,11 @@ EOF
|
||||
$set = new SetNode(false, new Node([new AssignNameExpression('foo', 4)]), new Node([new ConstantExpression('foo', 4)]), 4);
|
||||
$body = new Node([$set]);
|
||||
$extends = new ConditionalExpression(
|
||||
new ConstantExpression(true, 2),
|
||||
new ConstantExpression('foo', 2),
|
||||
new ConstantExpression('foo', 2),
|
||||
2
|
||||
);
|
||||
new ConstantExpression(true, 2),
|
||||
new ConstantExpression('foo', 2),
|
||||
new ConstantExpression('foo', 2),
|
||||
2
|
||||
);
|
||||
|
||||
$twig = new Environment($this->createMock(LoaderInterface::class), ['debug' => true]);
|
||||
$node = new ModuleNode($body, $extends, $blocks, $macros, $traits, new Node([]), $source);
|
||||
|
||||
@@ -168,7 +168,7 @@ class ParserTest extends TestCase
|
||||
{{ foo }}
|
||||
{% endmacro %}
|
||||
EOF
|
||||
, 'index')));
|
||||
, 'index')));
|
||||
|
||||
// The getVarName() must not depend on the template loaders,
|
||||
// If this test does not throw any exception, that's good.
|
||||
|
||||
@@ -73,7 +73,6 @@ abstract class AbstractTest extends TestCase
|
||||
/**
|
||||
* @param string $name
|
||||
* @param float $duration
|
||||
* @param bool $isTemplate
|
||||
* @param string $type
|
||||
* @param string $templateName
|
||||
*
|
||||
|
||||
@@ -31,6 +31,6 @@ index.twig==>embedded.twig//2 %d %d %d
|
||||
embedded.twig==>included.twig//2 %d %d %d
|
||||
index.twig==>index.twig::macro(foo)//1 %d %d %d
|
||||
EOF
|
||||
, $dumper->dump($this->getProfile()));
|
||||
, $dumper->dump($this->getProfile()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ class HtmlTest extends AbstractTest
|
||||
└ <span style="background-color: #ffd">included.twig</span>
|
||||
</pre>
|
||||
EOF
|
||||
, $dumper->dump($this->getProfile()));
|
||||
, $dumper->dump($this->getProfile()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ main %d.%dms/%d%
|
||||
└ included.twig
|
||||
|
||||
EOF
|
||||
, $dumper->dump($this->getProfile()));
|
||||
, $dumper->dump($this->getProfile()));
|
||||
}
|
||||
}
|
||||
|
||||
+10
-19
@@ -89,7 +89,7 @@ class TemplateTest extends TestCase
|
||||
public function testGetAttributeWithSandbox($object, $item, $allowed)
|
||||
{
|
||||
$twig = new Environment($this->createMock(LoaderInterface::class));
|
||||
$policy = new SecurityPolicy([], [], [/*method*/], [/*prop*/], []);
|
||||
$policy = new SecurityPolicy([], [], [/* method */], [/* prop */], []);
|
||||
$twig->addExtension(new SandboxExtension($policy, !$allowed));
|
||||
$template = new TemplateForTest($twig);
|
||||
|
||||
@@ -477,25 +477,22 @@ class TemplateArrayAccessObject implements \ArrayAccess
|
||||
'+4' => '+4',
|
||||
];
|
||||
|
||||
public function offsetExists($name) : bool
|
||||
public function offsetExists($name): bool
|
||||
{
|
||||
return \array_key_exists($name, $this->attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($name)
|
||||
{
|
||||
return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null;
|
||||
}
|
||||
|
||||
public function offsetSet($name, $value) : void
|
||||
public function offsetSet($name, $value): void
|
||||
{
|
||||
}
|
||||
|
||||
public function offsetUnset($name) : void
|
||||
public function offsetUnset($name): void
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -570,25 +567,22 @@ class TemplatePropertyObjectAndArrayAccess extends TemplatePropertyObject implem
|
||||
'baf' => 'baf',
|
||||
];
|
||||
|
||||
public function offsetExists($offset) : bool
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return \array_key_exists($offset, $this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->offsetExists($offset) ? $this->data[$offset] : 'n/a';
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) : void
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) : void
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -722,26 +716,23 @@ class TemplateArrayAccess implements \ArrayAccess
|
||||
];
|
||||
private $children = [];
|
||||
|
||||
public function offsetExists($offset) : bool
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return \array_key_exists($offset, $this->children);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->children[$offset];
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) : void
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
$this->children[$offset] = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) : void
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
unset($this->children[$offset]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user