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

MyIntervals / PHP-CSS-Parser / 13806647682

12 Mar 2025 08:15AM UTC coverage: 55.752% (-0.03%) from 55.782%
13806647682

Pull #1148

github

web-flow
Merge 08b7a1a10 into 46da4b251
Pull Request #1148: [CLEANUP] Avoid magic method forwarding in `AtRuleBlockList`

0 of 3 new or added lines in 1 file covered. (0.0%)

1042 of 1869 relevant lines covered (55.75%)

12.39 hits per line

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

44.0
/src/CSSList/AtRuleBlockList.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Sabberworm\CSS\CSSList;
6

7
use Sabberworm\CSS\OutputFormat;
8
use Sabberworm\CSS\Property\AtRule;
9

10
/**
11
 * A `BlockList` constructed by an unknown at-rule. `@media` rules are rendered into `AtRuleBlockList` objects.
12
 */
13
class AtRuleBlockList extends CSSBlockList implements AtRule
14
{
15
    /**
16
     * @var string
17
     */
18
    private $type;
19

20
    /**
21
     * @var string
22
     */
23
    private $arguments;
24

25
    /**
26
     * @param int<0, max> $lineNumber
27
     */
28
    public function __construct(string $type, string $arguments = '', int $lineNumber = 0)
18✔
29
    {
30
        parent::__construct($lineNumber);
18✔
31
        $this->type = $type;
18✔
32
        $this->arguments = $arguments;
18✔
33
    }
18✔
34

35
    public function atRuleName(): string
3✔
36
    {
37
        return $this->type;
3✔
38
    }
39

40
    public function atRuleArgs(): string
4✔
41
    {
42
        return $this->arguments;
4✔
43
    }
44

45
    /**
46
     * @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
47
     */
48
    public function __toString(): string
×
49
    {
50
        return $this->render(new OutputFormat());
×
51
    }
52

53
    public function render(OutputFormat $outputFormat): string
×
54
    {
NEW
55
        $formatter = $outputFormat->getFormatter();
×
NEW
56
        $result = $formatter->comments($this);
×
57
        $result .= $outputFormat->getContentBeforeAtRuleBlock();
×
58
        $arguments = $this->arguments;
×
59
        if ($arguments) {
×
60
            $arguments = ' ' . $arguments;
×
61
        }
NEW
62
        $result .= "@{$this->type}$arguments{$formatter->spaceBeforeOpeningBrace()}{";
×
63
        $result .= $this->renderListContents($outputFormat);
×
64
        $result .= '}';
×
65
        $result .= $outputFormat->getContentAfterAtRuleBlock();
×
66
        return $result;
×
67
    }
68

69
    public function isRootList(): bool
1✔
70
    {
71
        return false;
1✔
72
    }
73
}
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