mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-11 18:06:46 +00:00
Make Node abstract
This commit is contained in:
+1
-5
@@ -24,7 +24,7 @@ use Twig\Source;
|
||||
* @implements \IteratorAggregate<int|string, Node>
|
||||
*/
|
||||
#[YieldReady]
|
||||
class Node implements \Countable, \IteratorAggregate
|
||||
abstract class Node implements \Countable, \IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* @var array<string|int, Node>
|
||||
@@ -48,10 +48,6 @@ class Node implements \Countable, \IteratorAggregate
|
||||
*/
|
||||
public function __construct(array $nodes = [], array $attributes = [], int $lineno = 0)
|
||||
{
|
||||
if (self::class === static::class) {
|
||||
trigger_deprecation('twig/twig', '3.15', \sprintf('Instantiating "%s" directly is deprecated; the class will become abstract in 4.0.', self::class));
|
||||
}
|
||||
|
||||
foreach ($nodes as $name => $node) {
|
||||
if (!$node instanceof self) {
|
||||
throw new \InvalidArgumentException(\sprintf('Using "%s" for the value of node "%s" of "%s" is not supported. You must pass a \Twig\Node\Node instance.', \is_object($node) ? $node::class : (null === $node ? 'null' : \gettype($node)), $name, static::class));
|
||||
|
||||
Reference in New Issue
Block a user