PHPStan fixes

This commit is contained in:
Vincent Langlet
2024-11-22 09:52:07 +01:00
parent 223ddb5d44
commit 0cb1728113
4 changed files with 3 additions and 15 deletions
-12
View File
@@ -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
View File
@@ -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;
-2
View File
@@ -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;
+2
View File
@@ -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();