Skip to content

Commit 6d934af

Browse files
authored
[TASK] Add native type declarations for atRuleName() (#1145)
Part of #811
1 parent 46da4b2 commit 6d934af

File tree

7 files changed

+19
-9
lines changed

7 files changed

+19
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Please also have a look at our
3333
- Make all non-private properties `@internal` (#886)
3434
- Use more native type declarations and strict mode
3535
(#641, #772, #774, #778, #804, #841, #873, #875, #891, #922, #923, #933, #958,
36-
#964, #967, #1000, #1044, #1134, #1136, #1137, #1139, #1140, #1141)
36+
#964, #967, #1000, #1044, #1134, #1136, #1137, #1139, #1140, #1141, #1145)
3737
- Add visibility to all class/interface constants (#469)
3838

3939
### Deprecated

src/CSSList/AtRuleBlockList.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class AtRuleBlockList extends CSSBlockList implements AtRule
1414
{
1515
/**
16-
* @var string
16+
* @var non-empty-string
1717
*/
1818
private $type;
1919

@@ -23,6 +23,7 @@ class AtRuleBlockList extends CSSBlockList implements AtRule
2323
private $arguments;
2424

2525
/**
26+
* @param non-empty-string $type
2627
* @param int<0, max> $lineNumber
2728
*/
2829
public function __construct(string $type, string $arguments = '', int $lineNumber = 0)
@@ -32,6 +33,9 @@ public function __construct(string $type, string $arguments = '', int $lineNumbe
3233
$this->arguments = $arguments;
3334
}
3435

36+
/**
37+
* @return non-empty-string
38+
*/
3539
public function atRuleName(): string
3640
{
3741
return $this->type;

src/Property/AtRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ interface AtRule extends Renderable, Commentable
2020
public const BLOCK_RULES = 'media/document/supports/region-style/font-feature-values';
2121

2222
/**
23-
* @return string|null
23+
* @return non-empty-string
2424
*/
25-
public function atRuleName();
25+
public function atRuleName(): string;
2626

2727
/**
2828
* @return string|null

src/Property/CSSNamespace.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function setPrefix($prefix): void
101101
}
102102

103103
/**
104-
* @return string
104+
* @return non-empty-string
105105
*/
106106
public function atRuleName(): string
107107
{

src/Property/Charset.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public function render(OutputFormat $outputFormat): string
8484
return "{$outputFormat->comments($this)}@charset {$this->charset->render($outputFormat)};";
8585
}
8686

87+
/**
88+
* @return non-empty-string
89+
*/
8790
public function atRuleName(): string
8891
{
8992
return 'charset';

src/Property/Import.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ public function render(OutputFormat $outputFormat): string
8686
. ($this->mediaQuery === null ? '' : ' ' . $this->mediaQuery) . ';';
8787
}
8888

89+
/**
90+
* @return non-empty-string
91+
*/
8992
public function atRuleName(): string
9093
{
9194
return 'import';

src/RuleSet/AtRuleSet.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class AtRuleSet extends RuleSet implements AtRule
1717
{
1818
/**
19-
* @var string
19+
* @var non-empty-string
2020
*/
2121
private $type;
2222

@@ -26,7 +26,7 @@ class AtRuleSet extends RuleSet implements AtRule
2626
private $arguments;
2727

2828
/**
29-
* @param string $type
29+
* @param non-empty-string $type
3030
* @param string $arguments
3131
* @param int<0, max> $lineNumber
3232
*/
@@ -38,9 +38,9 @@ public function __construct($type, $arguments = '', int $lineNumber = 0)
3838
}
3939

4040
/**
41-
* @return string
41+
* @return non-empty-string
4242
*/
43-
public function atRuleName()
43+
public function atRuleName(): string
4444
{
4545
return $this->type;
4646
}

0 commit comments

Comments
 (0)