mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 10:56:38 +00:00
PHPStan fixes
This commit is contained in:
@@ -6,20 +6,8 @@ parameters:
|
||||
count: 1
|
||||
path: src/Extension/CoreExtension.php
|
||||
|
||||
- # Avoid BC-break
|
||||
message: '#^Constructor of class Twig\\Node\\ForNode has an unused parameter \$ifexpr\.$#'
|
||||
identifier: constructor.unusedParameter
|
||||
count: 1
|
||||
path: src/Node/ForNode.php
|
||||
|
||||
- # 2 parameters will be required
|
||||
message: '#^Method Twig\\Node\\IncludeNode\:\:addGetTemplate\(\) invoked with 2 parameters, 1 required\.$#'
|
||||
identifier: arguments.count
|
||||
count: 1
|
||||
path: src/Node/IncludeNode.php
|
||||
|
||||
- # int|string will be supported in 4.x
|
||||
message: '#^PHPDoc tag @param for parameter $name with type int|string is not subtype of native type string\.$#'
|
||||
identifier: parameter.phpDocType
|
||||
count: 5
|
||||
path: src/Node/Node.php
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ class Environment
|
||||
private LoaderInterface $loader;
|
||||
private bool $debug;
|
||||
private bool $autoReload;
|
||||
private CacheInterface|string|false $cache;
|
||||
private CacheInterface $cache;
|
||||
private ?Lexer $lexer = null;
|
||||
private ?Parser $parser = null;
|
||||
private ?Compiler $compiler = null;
|
||||
|
||||
@@ -26,9 +26,7 @@ use Twig\Node\Expression\NameExpression;
|
||||
use Twig\Node\Expression\Ternary\ConditionalTernary;
|
||||
use Twig\Node\Expression\TestExpression;
|
||||
use Twig\Node\Expression\Unary\AbstractUnary;
|
||||
use Twig\Node\Expression\Unary\NegUnary;
|
||||
use Twig\Node\Expression\Unary\NotUnary;
|
||||
use Twig\Node\Expression\Unary\PosUnary;
|
||||
use Twig\Node\Expression\Unary\SpreadUnary;
|
||||
use Twig\Node\Expression\Variable\AssignContextVariable;
|
||||
use Twig\Node\Expression\Variable\ContextVariable;
|
||||
|
||||
@@ -45,10 +45,12 @@ final class LoopIterator implements \Iterator
|
||||
$this->seq = new \ArrayIterator($seq);
|
||||
} elseif ($seq instanceof \IteratorAggregate) {
|
||||
do {
|
||||
/** @var \Iterator<TKey, TValue> $seq */
|
||||
$seq = $seq->getIterator();
|
||||
} while ($seq instanceof \IteratorAggregate);
|
||||
$this->seq = $seq;
|
||||
} elseif (is_iterable($seq)) {
|
||||
/** @var \Iterator<TKey, TValue> $seq */
|
||||
$this->seq = $seq;
|
||||
} else {
|
||||
$this->seq = new \EmptyIterator();
|
||||
|
||||
Reference in New Issue
Block a user