Skip to content

Commit 129f7ce

Browse files
oliverkleeJakeQZ
andauthored
[TASK] Use native void return type declarations (#805)
Also include previous changes for adding native type declarations or strict mode into the changelog. Co-authored-by: JakeQZ <[email protected]>
1 parent 24f44c2 commit 129f7ce

File tree

6 files changed

+13
-29
lines changed

6 files changed

+13
-29
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Please also have a look at our
2222

2323
### Changed
2424

25+
- Use more native type declarations and strict mode
26+
(#641, #772, #774, #778, #804)
2527
- Mark parsing-internal classes and methods as `@internal` (#674)
2628
- Block installations on unsupported higher PHP versions (#691)
2729
- Improve performance of `Value::parseValue` with many delimiters by refactoring

src/CSSList/CSSBlockList.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ public function __construct($iLineNo = 0)
3030

3131
/**
3232
* @param array<int, DeclarationBlock> $aResult
33-
*
34-
* @return void
3533
*/
36-
protected function allDeclarationBlocks(array &$aResult)
34+
protected function allDeclarationBlocks(array &$aResult): void
3735
{
3836
foreach ($this->aContents as $mContent) {
3937
if ($mContent instanceof DeclarationBlock) {
@@ -46,10 +44,8 @@ protected function allDeclarationBlocks(array &$aResult)
4644

4745
/**
4846
* @param array<int, RuleSet> $aResult
49-
*
50-
* @return void
5147
*/
52-
protected function allRuleSets(array &$aResult)
48+
protected function allRuleSets(array &$aResult): void
5349
{
5450
foreach ($this->aContents as $mContent) {
5551
if ($mContent instanceof RuleSet) {
@@ -65,11 +61,13 @@ protected function allRuleSets(array &$aResult)
6561
* @param array<int, Value> $aResult
6662
* @param string|null $sSearchString
6763
* @param bool $bSearchInFunctionArguments
68-
*
69-
* @return void
7064
*/
71-
protected function allValues($oElement, array &$aResult, $sSearchString = null, $bSearchInFunctionArguments = false)
72-
{
65+
protected function allValues(
66+
$oElement,
67+
array &$aResult,
68+
$sSearchString = null,
69+
$bSearchInFunctionArguments = false
70+
): void {
7371
if ($oElement instanceof CSSBlockList) {
7472
foreach ($oElement->getContents() as $oContent) {
7573
$this->allValues($oContent, $aResult, $sSearchString, $bSearchInFunctionArguments);
@@ -95,10 +93,8 @@ protected function allValues($oElement, array &$aResult, $sSearchString = null,
9593
/**
9694
* @param array<int, Selector> $aResult
9795
* @param string|null $sSpecificitySearch
98-
*
99-
* @return void
10096
*/
101-
protected function allSelectors(array &$aResult, $sSpecificitySearch = null)
97+
protected function allSelectors(array &$aResult, $sSpecificitySearch = null): void
10298
{
10399
/** @var array<int, DeclarationBlock> $aDeclarationBlocks */
104100
$aDeclarationBlocks = [];

src/Comment/Commentable.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ interface Commentable
88
{
99
/**
1010
* @param array<array-key, Comment> $comments
11-
*
12-
* @return void
1311
*/
14-
public function addComments(array $comments);
12+
public function addComments(array $comments): void;
1513

1614
/**
1715
* @return array<array-key, Comment>
@@ -20,8 +18,6 @@ public function getComments();
2018

2119
/**
2220
* @param array<array-key, Comment> $comments
23-
*
24-
* @return void
2521
*/
26-
public function setComments(array $comments);
22+
public function setComments(array $comments): void;
2723
}

src/Property/Charset.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ public function getLineNo()
5454

5555
/**
5656
* @param string|CSSString $oCharset
57-
*
58-
* @return void
5957
*/
6058
public function setCharset($sCharset): void
6159
{
@@ -96,8 +94,6 @@ public function atRuleArgs()
9694

9795
/**
9896
* @param array<array-key, Comment> $comments
99-
*
100-
* @return void
10197
*/
10298
public function addComments(array $comments): void
10399
{
@@ -114,8 +110,6 @@ public function getComments()
114110

115111
/**
116112
* @param array<array-key, Comment> $comments
117-
*
118-
* @return void
119113
*/
120114
public function setComments(array $comments): void
121115
{

src/Property/Selector.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ public function getSelector()
106106

107107
/**
108108
* @param string $sSelector
109-
*
110-
* @return void
111109
*/
112110
public function setSelector($sSelector): void
113111
{

src/Rule/Rule.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,6 @@ public function addIeHack($iModifier): void
228228

229229
/**
230230
* @param array<int, int> $aModifiers
231-
*
232-
* @return void
233231
*/
234232
public function setIeHack(array $aModifiers): void
235233
{

0 commit comments

Comments
 (0)