diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1121ae1b235..facf2c1361c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -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 diff --git a/src/Environment.php b/src/Environment.php index f016048babf..80c578d766d 100644 --- a/src/Environment.php +++ b/src/Environment.php @@ -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; diff --git a/src/ExpressionParser.php b/src/ExpressionParser.php index d5528f14069..1797d2ec186 100644 --- a/src/ExpressionParser.php +++ b/src/ExpressionParser.php @@ -26,9 +26,7 @@ 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; diff --git a/src/Runtime/LoopIterator.php b/src/Runtime/LoopIterator.php index af20fcfd756..db9c0ce7174 100644 --- a/src/Runtime/LoopIterator.php +++ b/src/Runtime/LoopIterator.php @@ -45,10 +45,12 @@ public function __construct($seq) $this->seq = new \ArrayIterator($seq); } elseif ($seq instanceof \IteratorAggregate) { do { + /** @var \Iterator $seq */ $seq = $seq->getIterator(); } while ($seq instanceof \IteratorAggregate); $this->seq = $seq; } elseif (is_iterable($seq)) { + /** @var \Iterator $seq */ $this->seq = $seq; } else { $this->seq = new \EmptyIterator();