Skip to content

Commit c69b1f8

Browse files
authored
[CLEANUP] Rector: Add return type void to function like without any return (#597)
This applies the rule AddVoidReturnTypeWhereNoReturnRector. For Details see: https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#addvoidreturntypewherenoreturnrector Signed-off-by: Daniel Ziegenberg <[email protected]>
1 parent 3163c9f commit c69b1f8

23 files changed

+72
-193
lines changed

src/CSSList/CSSList.php

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,10 @@ public function __construct($iLineNo = 0)
5757
}
5858

5959
/**
60-
* @return void
61-
*
6260
* @throws UnexpectedTokenException
6361
* @throws SourceException
6462
*/
65-
public static function parseList(ParserState $oParserState, CSSList $oList)
63+
public static function parseList(ParserState $oParserState, CSSList $oList): void
6664
{
6765
$bIsRoot = $oList instanceof Document;
6866
if (is_string($oParserState)) {
@@ -260,10 +258,8 @@ public function getLineNo()
260258
* Prepends an item to the list of contents.
261259
*
262260
* @param RuleSet|CSSList|Import|Charset $oItem
263-
*
264-
* @return void
265261
*/
266-
public function prepend($oItem)
262+
public function prepend($oItem): void
267263
{
268264
array_unshift($this->aContents, $oItem);
269265
}
@@ -272,10 +268,8 @@ public function prepend($oItem)
272268
* Appends an item to the list of contents.
273269
*
274270
* @param RuleSet|CSSList|Import|Charset $oItem
275-
*
276-
* @return void
277271
*/
278-
public function append($oItem)
272+
public function append($oItem): void
279273
{
280274
$this->aContents[] = $oItem;
281275
}
@@ -286,10 +280,8 @@ public function append($oItem)
286280
* @param int $iOffset
287281
* @param int $iLength
288282
* @param array<int, RuleSet|CSSList|Import|Charset> $mReplacement
289-
*
290-
* @return void
291283
*/
292-
public function splice($iOffset, $iLength = null, $mReplacement = null)
284+
public function splice($iOffset, $iLength = null, $mReplacement = null): void
293285
{
294286
array_splice($this->aContents, $iOffset, $iLength, $mReplacement);
295287
}
@@ -355,7 +347,7 @@ public function replace($oOldItem, $mNewItem)
355347
/**
356348
* @param array<int, RuleSet|Import|Charset|CSSList> $aContents
357349
*/
358-
public function setContents(array $aContents)
350+
public function setContents(array $aContents): void
359351
{
360352
$this->aContents = [];
361353
foreach ($aContents as $content) {
@@ -368,10 +360,8 @@ public function setContents(array $aContents)
368360
*
369361
* @param DeclarationBlock|array<array-key, Selector>|string $mSelector the selectors to match
370362
* @param bool $bRemoveAll whether to stop at the first declaration block found or remove all blocks
371-
*
372-
* @return void
373363
*/
374-
public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false)
364+
public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false): void
375365
{
376366
if ($mSelector instanceof DeclarationBlock) {
377367
$mSelector = $mSelector->getSelectors();
@@ -466,10 +456,8 @@ public function getContents()
466456

467457
/**
468458
* @param array<array-key, Comment> $aComments
469-
*
470-
* @return void
471459
*/
472-
public function addComments(array $aComments)
460+
public function addComments(array $aComments): void
473461
{
474462
$this->aComments = array_merge($this->aComments, $aComments);
475463
}
@@ -484,10 +472,8 @@ public function getComments()
484472

485473
/**
486474
* @param array<array-key, Comment> $aComments
487-
*
488-
* @return void
489475
*/
490-
public function setComments(array $aComments)
476+
public function setComments(array $aComments): void
491477
{
492478
$this->aComments = $aComments;
493479
}

src/CSSList/Document.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,9 @@ public function getSelectorsBySpecificity($sSpecificitySearch = null)
113113
/**
114114
* Expands all shorthand properties to their long value.
115115
*
116-
* @return void
117-
*
118116
* @deprecated This will be removed without substitution in version 10.0.
119117
*/
120-
public function expandShorthands()
118+
public function expandShorthands(): void
121119
{
122120
foreach ($this->getAllDeclarationBlocks() as $oDeclaration) {
123121
$oDeclaration->expandShorthands();
@@ -127,11 +125,9 @@ public function expandShorthands()
127125
/**
128126
* Create shorthands properties whenever possible.
129127
*
130-
* @return void
131-
*
132128
* @deprecated This will be removed without substitution in version 10.0.
133129
*/
134-
public function createShorthands()
130+
public function createShorthands(): void
135131
{
136132
foreach ($this->getAllDeclarationBlocks() as $oDeclaration) {
137133
$oDeclaration->createShorthands();

src/CSSList/KeyFrame.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct($iLineNo = 0)
3030
/**
3131
* @param string $vendorKeyFrame
3232
*/
33-
public function setVendorKeyFrame($vendorKeyFrame)
33+
public function setVendorKeyFrame($vendorKeyFrame): void
3434
{
3535
$this->vendorKeyFrame = $vendorKeyFrame;
3636
}
@@ -46,7 +46,7 @@ public function getVendorKeyFrame()
4646
/**
4747
* @param string $animationName
4848
*/
49-
public function setAnimationName($animationName)
49+
public function setAnimationName($animationName): void
5050
{
5151
$this->animationName = $animationName;
5252
}

src/Comment/Comment.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ public function getLineNo()
4545

4646
/**
4747
* @param string $sComment
48-
*
49-
* @return void
5048
*/
51-
public function setComment($sComment)
49+
public function setComment($sComment): void
5250
{
5351
$this->sComment = $sComment;
5452
}

src/OutputFormat.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,7 @@ public function nextLevel()
274274
return $this->oNextLevelFormat;
275275
}
276276

277-
/**
278-
* @return void
279-
*/
280-
public function beLenient()
277+
public function beLenient(): void
281278
{
282279
$this->bIgnoreExceptions = true;
283280
}

src/Parser.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,16 @@ public function __construct($sText, Settings $oParserSettings = null, $iLineNo =
3333
* Sets the charset to be used if the CSS does not contain an `@charset` declaration.
3434
*
3535
* @param string $sCharset
36-
*
37-
* @return void
3836
*/
39-
public function setCharset($sCharset)
37+
public function setCharset($sCharset): void
4038
{
4139
$this->oParserState->setCharset($sCharset);
4240
}
4341

4442
/**
4543
* Returns the charset that is used if the CSS does not contain an `@charset` declaration.
46-
*
47-
* @return void
4844
*/
49-
public function getCharset()
45+
public function getCharset(): void
5046
{
5147
// Note: The `return` statement is missing here. This is a bug that needs to be fixed.
5248
$this->oParserState->getCharset();

src/Parsing/Anchor.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ public function __construct($iPosition, ParserState $oParserState)
2424
$this->oParserState = $oParserState;
2525
}
2626

27-
/**
28-
* @return void
29-
*/
30-
public function backtrack()
27+
public function backtrack(): void
3128
{
3229
$this->oParserState->setPosition($this->iPosition);
3330
}

src/Parsing/ParserState.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,8 @@ public function __construct($sText, Settings $oParserSettings, $iLineNo = 1)
6969
* Sets the charset to be used if the CSS does not contain an `@charset` declaration.
7070
*
7171
* @param string $sCharset
72-
*
73-
* @return void
7472
*/
75-
public function setCharset($sCharset)
73+
public function setCharset($sCharset): void
7674
{
7775
$this->sCharset = $sCharset;
7876
$this->aText = $this->strsplit($this->sText);
@@ -123,10 +121,8 @@ public function anchor(): Anchor
123121

124122
/**
125123
* @param int $iPosition
126-
*
127-
* @return void
128124
*/
129-
public function setPosition($iPosition)
125+
public function setPosition($iPosition): void
130126
{
131127
$this->iCurrentPosition = $iPosition;
132128
}
@@ -426,10 +422,8 @@ public function streql($sString1, $sString2, $bCaseInsensitive = true): bool
426422

427423
/**
428424
* @param int $iAmount
429-
*
430-
* @return void
431425
*/
432-
public function backtrack($iAmount)
426+
public function backtrack($iAmount): void
433427
{
434428
$this->iCurrentPosition -= $iAmount;
435429
}

src/Property/CSSNamespace.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,16 @@ public function getPrefix()
8383

8484
/**
8585
* @param string $mUrl
86-
*
87-
* @return void
8886
*/
89-
public function setUrl($mUrl)
87+
public function setUrl($mUrl): void
9088
{
9189
$this->mUrl = $mUrl;
9290
}
9391

9492
/**
9593
* @param string $sPrefix
96-
*
97-
* @return void
9894
*/
99-
public function setPrefix($sPrefix)
95+
public function setPrefix($sPrefix): void
10096
{
10197
$this->sPrefix = $sPrefix;
10298
}
@@ -123,10 +119,8 @@ public function atRuleArgs(): array
123119

124120
/**
125121
* @param array<array-key, Comment> $aComments
126-
*
127-
* @return void
128122
*/
129-
public function addComments(array $aComments)
123+
public function addComments(array $aComments): void
130124
{
131125
$this->aComments = array_merge($this->aComments, $aComments);
132126
}
@@ -141,10 +135,8 @@ public function getComments()
141135

142136
/**
143137
* @param array<array-key, Comment> $aComments
144-
*
145-
* @return void
146138
*/
147-
public function setComments(array $aComments)
139+
public function setComments(array $aComments): void
148140
{
149141
$this->aComments = $aComments;
150142
}

src/Property/Charset.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function getLineNo()
5555
*
5656
* @return void
5757
*/
58-
public function setCharset($sCharset)
58+
public function setCharset($sCharset): void
5959
{
6060
$sCharset = $sCharset instanceof CSSString ? $sCharset : new CSSString($sCharset);
6161
$this->oCharset = $sCharset;
@@ -100,7 +100,7 @@ public function atRuleArgs()
100100
*
101101
* @return void
102102
*/
103-
public function addComments(array $aComments)
103+
public function addComments(array $aComments): void
104104
{
105105
$this->aComments = array_merge($this->aComments, $aComments);
106106
}
@@ -118,7 +118,7 @@ public function getComments()
118118
*
119119
* @return void
120120
*/
121-
public function setComments(array $aComments)
121+
public function setComments(array $aComments): void
122122
{
123123
$this->aComments = $aComments;
124124
}

src/Property/Import.php

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

5555
/**
5656
* @param URL $oLocation
57-
*
58-
* @return void
5957
*/
60-
public function setLocation($oLocation)
58+
public function setLocation($oLocation): void
6159
{
6260
$this->oLocation = $oLocation;
6361
}
@@ -103,10 +101,8 @@ public function atRuleArgs(): array
103101

104102
/**
105103
* @param array<array-key, Comment> $aComments
106-
*
107-
* @return void
108104
*/
109-
public function addComments(array $aComments)
105+
public function addComments(array $aComments): void
110106
{
111107
$this->aComments = array_merge($this->aComments, $aComments);
112108
}
@@ -121,10 +117,8 @@ public function getComments()
121117

122118
/**
123119
* @param array<array-key, Comment> $aComments
124-
*
125-
* @return void
126120
*/
127-
public function setComments(array $aComments)
121+
public function setComments(array $aComments): void
128122
{
129123
$this->aComments = $aComments;
130124
}

src/Property/Selector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function getSelector()
107107
*
108108
* @return void
109109
*/
110-
public function setSelector($sSelector)
110+
public function setSelector($sSelector): void
111111
{
112112
$this->sSelector = trim($sSelector);
113113
$this->iSpecificity = null;

0 commit comments

Comments
 (0)