mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 19:06:40 +00:00
minor #4466 Fix PHPStan for Twig 4.x (VincentLanglet)
This PR was merged into the 4.x branch.
Discussion
----------
Fix PHPStan for Twig 4.x
Hi `@fabpot`, to help introducing PHPStan on 4.x, I made the merge 3.x into 4.x
- Fixing the conflits
- Fixing PHPStan build
I have
- A commit with the merge https://github.com/twigphp/Twig/pull/4466/commits/6a82e16617183c793bad4cfa672cee3c3923b714
- A commit with the update needed to get PHPStan build green in 4.x https://github.com/twigphp/Twig/pull/4466/commits/cb89b7528c997dd11a1a28192eba11a9fdbe5f5f
Commits
-------
0cb1728113 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