Skip to content

Commit c29481f

Browse files
committed
[TASK] Add native type declarations for RuleSet
Part of #811
1 parent a583a2e commit c29481f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Please also have a look at our
3434
- Use more native type declarations and strict mode
3535
(#641, #772, #774, #778, #804, #841, #873, #875, #891, #922, #923, #933, #958,
3636
#964, #967, #1000, #1044, #1134, #1136, #1137, #1139, #1140, #1141, #1145,
37-
#1162, #1163, #1166, #1172, #1174, #1178, #1179, #1181, #1183, #1184)
37+
#1162, #1163, #1166, #1172, #1174, #1178, #1179, #1181, #1183, #1184, #1186)
3838
- Add visibility to all class/interface constants (#469)
3939

4040
### Deprecated

src/RuleSet/RuleSet.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,13 @@ public function addRule(Rule $ruleToAdd, ?Rule $sibling = null): void
151151
* as well as one matching the pattern with the dash excluded.
152152
* Passing a `Rule` behaves like calling `getRules($rule->getRule())`.
153153
*
154-
* @return array<int, Rule>
154+
* @return array<int<0, max>, Rule>
155155
*/
156-
public function getRules($searchPattern = null)
156+
public function getRules($searchPattern = null): array
157157
{
158158
if ($searchPattern instanceof Rule) {
159159
$searchPattern = $searchPattern->getRule();
160160
}
161-
/** @var array<int, Rule> $result */
162161
$result = [];
163162
foreach ($this->rules as $propertyName => $rules) {
164163
// Either no search rule is given or the search rule matches the found rule exactly
@@ -187,7 +186,7 @@ public function getRules($searchPattern = null)
187186
/**
188187
* Overrides all the rules of this set.
189188
*
190-
* @param array<array-key, Rule> $rules The rules to override with.
189+
* @param array<Rule> $rules The rules to override with.
191190
*/
192191
public function setRules(array $rules): void
193192
{
@@ -212,13 +211,14 @@ public function setRules(array $rules): void
212211
*
213212
* @return array<string, Rule>
214213
*/
215-
public function getRulesAssoc($searchPattern = null)
214+
public function getRulesAssoc($searchPattern = null): array
216215
{
217216
/** @var array<string, Rule> $result */
218217
$result = [];
219218
foreach ($this->getRules($searchPattern) as $rule) {
220219
$result[$rule->getRule()] = $rule;
221220
}
221+
222222
return $result;
223223
}
224224

0 commit comments

Comments
 (0)