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

MyIntervals / PHP-CSS-Parser / 13562750149

27 Feb 2025 09:09AM UTC coverage: 54.784%. Remained the same
13562750149

push

github

web-flow
[TASK] Deprecate `__toString()` (#1006)

Part of #998

1042 of 1902 relevant lines covered (54.78%)

12.12 hits per line

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

45.83
/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
    {
55
        $result = $outputFormat->comments($this);
×
56
        $result .= $outputFormat->sBeforeAtRuleBlock;
×
57
        $arguments = $this->arguments;
×
58
        if ($arguments) {
×
59
            $arguments = ' ' . $arguments;
×
60
        }
61
        $result .= "@{$this->type}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{";
×
62
        $result .= $this->renderListContents($outputFormat);
×
63
        $result .= '}';
×
64
        $result .= $outputFormat->sAfterAtRuleBlock;
×
65
        return $result;
×
66
    }
67

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

© 2025 Coveralls, Inc