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

MyIntervals / PHP-CSS-Parser / 13934588276

18 Mar 2025 10:19PM UTC coverage: 51.499%. Remained the same
13934588276

push

github

web-flow
[TASK] Add native type declarations for `AtRuleSet` (#1192)

Part of #811

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

945 of 1835 relevant lines covered (51.5%)

6.71 hits per line

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

0.0
/src/RuleSet/AtRuleSet.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Sabberworm\CSS\RuleSet;
6

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

10
/**
11
 * This class represents rule sets for generic at-rules which are not covered by specific classes, i.e., not
12
 * `@import`, `@charset` or `@media`.
13
 *
14
 * A common example for this is `@font-face`.
15
 */
16
class AtRuleSet extends RuleSet implements AtRule
17
{
18
    /**
19
     * @var non-empty-string
20
     */
21
    private $type;
22

23
    /**
24
     * @var string
25
     */
26
    private $arguments;
27

28
    /**
29
     * @param non-empty-string $type
30
     * @param int<0, max> $lineNumber
31
     */
NEW
32
    public function __construct(string $type, string $arguments = '', int $lineNumber = 0)
×
33
    {
34
        parent::__construct($lineNumber);
×
35
        $this->type = $type;
×
36
        $this->arguments = $arguments;
×
37
    }
×
38

39
    /**
40
     * @return non-empty-string
41
     */
42
    public function atRuleName(): string
×
43
    {
44
        return $this->type;
×
45
    }
46

NEW
47
    public function atRuleArgs(): string
×
48
    {
49
        return $this->arguments;
×
50
    }
51

52
    public function render(OutputFormat $outputFormat): string
×
53
    {
54
        $formatter = $outputFormat->getFormatter();
×
55
        $result = $formatter->comments($this);
×
56
        $arguments = $this->arguments;
×
NEW
57
        if ($arguments !== '') {
×
58
            $arguments = ' ' . $arguments;
×
59
        }
60
        $result .= "@{$this->type}$arguments{$formatter->spaceBeforeOpeningBrace()}{";
×
61
        $result .= $this->renderRules($outputFormat);
×
62
        $result .= '}';
×
63
        return $result;
×
64
    }
65
}
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