Skip to content

Commit 779d500

Browse files
committed
Add properties specific to at-rules
1 parent e15d523 commit 779d500

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

src/RuleSet/AtRuleSet.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,18 @@ public function render(OutputFormat $outputFormat): string
6565
$result .= '}';
6666
return $result;
6767
}
68+
69+
/**
70+
* @return array<string, bool|int|float|string|array<mixed>|null>
71+
*
72+
* @internal
73+
*/
74+
public function getArrayRepresentation(): array
75+
{
76+
$arrayRepresentation = parent::getArrayRepresentation();
77+
$arrayRepresentation['atRuleName'] = $this->type;
78+
$arrayRepresentation['arguments'] = $this->arguments;
79+
80+
return $arrayRepresentation;
81+
}
6882
}

tests/Unit/RuleSet/AtRuleSetTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,30 @@ public function getArrayRepresentationIncludesDeclarations(): void
7777
$result['declarations']
7878
);
7979
}
80+
81+
/**
82+
* @test
83+
*/
84+
public function getArrayRepresentationIncludesAtRuleName(): void
85+
{
86+
$atRuleName = 'supports';
87+
$subject = new AtRuleSet($atRuleName);
88+
89+
$result = $subject->getArrayRepresentation();
90+
91+
self::assertSame($atRuleName, $result['atRuleName']);
92+
}
93+
94+
/**
95+
* @test
96+
*/
97+
public function getArrayRepresentationIncludesArguments(): void
98+
{
99+
$arguments = 'foo';
100+
$subject = new AtRuleSet('supports', $arguments);
101+
102+
$result = $subject->getArrayRepresentation();
103+
104+
self::assertSame($arguments, $result['arguments']);
105+
}
80106
}

0 commit comments

Comments
 (0)