• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nette / latte / 22359082277

24 Feb 2026 04:03PM UTC coverage: 93.959% (+0.05%) from 93.907%
22359082277

push

github

dg
fixed operator ! priority

5273 of 5612 relevant lines covered (93.96%)

0.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.75
/src/Latte/Essential/Nodes/ExtendsNode.php
1
<?php declare(strict_types=1);
2

3
/**
4
 * This file is part of the Latte (https://latte.nette.org)
5
 * Copyright (c) 2008 David Grudl (https://davidgrudl.com)
6
 */
7

8
namespace Latte\Essential\Nodes;
9

10
use Latte\CompileException;
11
use Latte\Compiler\Nodes\Php\ExpressionNode;
12
use Latte\Compiler\Nodes\Php\Scalar\BooleanNode;
13
use Latte\Compiler\Nodes\Php\Scalar\NullNode;
14
use Latte\Compiler\Nodes\StatementNode;
15
use Latte\Compiler\PrintContext;
16
use Latte\Compiler\Tag;
17

18

19
/**
20
 * {extends none | auto | "file"}
21
 * {layout none | auto | "file"}
22
 */
23
class ExtendsNode extends StatementNode
24
{
25
        public ExpressionNode $extends;
26

27

28
        public static function create(Tag $tag): static
1✔
29
        {
30
                $tag->expectArguments();
1✔
31
                $node = new static;
1✔
32
                if (!$tag->isInHead()) {
1✔
33
                        throw new CompileException("{{$tag->name}} must be placed in template head.", $tag->position);
×
34
                } elseif ($tag->parser->stream->tryConsume('auto')) {
1✔
35
                        $node->extends = new NullNode;
1✔
36
                } elseif ($tag->parser->stream->tryConsume('none')) {
1✔
37
                        $node->extends = new BooleanNode(false);
1✔
38
                } else {
39
                        $node->extends = $tag->parser->parseUnquotedStringOrExpression();
1✔
40
                }
41
                return $node;
1✔
42
        }
43

44

45
        public function print(PrintContext $context): string
1✔
46
        {
47
                return $context->format('$this->parentName = %node;', $this->extends);
1✔
48
        }
49

50

51
        public function &getIterator(): \Generator
1✔
52
        {
53
                yield $this->extends;
1✔
54
        }
1✔
55
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc