22
22
class Rule implements Renderable, Commentable
23
23
{
24
24
/**
25
- * @var string
25
+ * @var non-empty- string
26
26
*/
27
27
private $ rule ;
28
28
@@ -42,7 +42,7 @@ class Rule implements Renderable, Commentable
42
42
protected $ lineNumber ;
43
43
44
44
/**
45
- * @var int
45
+ * @var int<0, max>
46
46
*
47
47
* @internal since 8.8.0
48
48
*/
@@ -56,11 +56,11 @@ class Rule implements Renderable, Commentable
56
56
protected $ comments = [];
57
57
58
58
/**
59
- * @param string $rule
59
+ * @param non-empty- string $rule
60
60
* @param int<0, max> $lineNumber
61
- * @param int $columnNumber
61
+ * @param int<0, max> $columnNumber
62
62
*/
63
- public function __construct ($ rule , int $ lineNumber = 0 , $ columnNumber = 0 )
63
+ public function __construct (string $ rule , int $ lineNumber = 0 , int $ columnNumber = 0 )
64
64
{
65
65
$ this ->rule = $ rule ;
66
66
$ this ->lineNumber = $ lineNumber ;
@@ -108,11 +108,11 @@ public static function parse(ParserState $parserState, array $commentsBeforeRule
108
108
* The first item is the innermost separator (or, put another way, the highest-precedence operator).
109
109
* The sequence continues to the outermost separator (or lowest-precedence operator).
110
110
*
111
- * @param string $rule
111
+ * @param non-empty- string $rule
112
112
*
113
113
* @return list<non-empty-string>
114
114
*/
115
- private static function listDelimiterForRule ($ rule ): array
115
+ private static function listDelimiterForRule (string $ rule ): array
116
116
{
117
117
if (\preg_match ('/^font($|-)/ ' , $ rule )) {
118
118
return [', ' , '/ ' , ' ' ];
@@ -135,35 +135,35 @@ public function getLineNo(): int
135
135
}
136
136
137
137
/**
138
- * @return int
138
+ * @return int<0, max>
139
139
*/
140
- public function getColNo ()
140
+ public function getColNo (): int
141
141
{
142
142
return $ this ->columnNumber ;
143
143
}
144
144
145
145
/**
146
146
* @param int<0, max> $lineNumber
147
- * @param int $columnNumber
147
+ * @param int<0, max> $columnNumber
148
148
*/
149
- public function setPosition (int $ lineNumber , $ columnNumber ): void
149
+ public function setPosition (int $ lineNumber , int $ columnNumber ): void
150
150
{
151
151
$ this ->columnNumber = $ columnNumber ;
152
152
$ this ->lineNumber = $ lineNumber ;
153
153
}
154
154
155
155
/**
156
- * @param string $rule
156
+ * @param non-empty- string $rule
157
157
*/
158
- public function setRule ($ rule ): void
158
+ public function setRule (string $ rule ): void
159
159
{
160
160
$ this ->rule = $ rule ;
161
161
}
162
162
163
163
/**
164
- * @return string
164
+ * @return non-empty- string
165
165
*/
166
- public function getRule ()
166
+ public function getRule (): string
167
167
{
168
168
return $ this ->rule ;
169
169
}
@@ -189,9 +189,8 @@ public function setValue($value): void
189
189
* Otherwise, the existing value will be wrapped by one.
190
190
*
191
191
* @param RuleValueList|array<int, RuleValueList> $value
192
- * @param string $type
193
192
*/
194
- public function addValue ($ value , $ type = ' ' ): void
193
+ public function addValue ($ value , string $ type = ' ' ): void
195
194
{
196
195
if (!\is_array ($ value )) {
197
196
$ value = [$ value ];
@@ -208,22 +207,19 @@ public function addValue($value, $type = ' '): void
208
207
}
209
208
}
210
209
211
- /**
212
- * @param bool $isImportant
213
- */
214
- public function setIsImportant ($ isImportant ): void
210
+ public function setIsImportant (bool $ isImportant ): void
215
211
{
216
212
$ this ->isImportant = $ isImportant ;
217
213
}
218
214
219
- /**
220
- * @return bool
221
- */
222
- public function getIsImportant ()
215
+ public function getIsImportant (): bool
223
216
{
224
217
return $ this ->isImportant ;
225
218
}
226
219
220
+ /**
221
+ * @return non-empty-string
222
+ */
227
223
public function render (OutputFormat $ outputFormat ): string
228
224
{
229
225
$ formatter = $ outputFormat ->getFormatter ();
0 commit comments