Skip to content

[CLEANUP] Rector: Add return type void to function like without any return #597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions src/CSSList/CSSList.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ public function __construct($iLineNo = 0)
}

/**
* @return void
*
* @throws UnexpectedTokenException
* @throws SourceException
*/
public static function parseList(ParserState $oParserState, CSSList $oList)
public static function parseList(ParserState $oParserState, CSSList $oList): void
{
$bIsRoot = $oList instanceof Document;
if (is_string($oParserState)) {
Expand Down Expand Up @@ -260,10 +258,8 @@ public function getLineNo()
* Prepends an item to the list of contents.
*
* @param RuleSet|CSSList|Import|Charset $oItem
*
* @return void
*/
public function prepend($oItem)
public function prepend($oItem): void
{
array_unshift($this->aContents, $oItem);
}
Expand All @@ -272,10 +268,8 @@ public function prepend($oItem)
* Appends an item to the list of contents.
*
* @param RuleSet|CSSList|Import|Charset $oItem
*
* @return void
*/
public function append($oItem)
public function append($oItem): void
{
$this->aContents[] = $oItem;
}
Expand All @@ -286,10 +280,8 @@ public function append($oItem)
* @param int $iOffset
* @param int $iLength
* @param array<int, RuleSet|CSSList|Import|Charset> $mReplacement
*
* @return void
*/
public function splice($iOffset, $iLength = null, $mReplacement = null)
public function splice($iOffset, $iLength = null, $mReplacement = null): void
{
array_splice($this->aContents, $iOffset, $iLength, $mReplacement);
}
Expand Down Expand Up @@ -355,7 +347,7 @@ public function replace($oOldItem, $mNewItem)
/**
* @param array<int, RuleSet|Import|Charset|CSSList> $aContents
*/
public function setContents(array $aContents)
public function setContents(array $aContents): void
{
$this->aContents = [];
foreach ($aContents as $content) {
Expand All @@ -368,10 +360,8 @@ public function setContents(array $aContents)
*
* @param DeclarationBlock|array<array-key, Selector>|string $mSelector the selectors to match
* @param bool $bRemoveAll whether to stop at the first declaration block found or remove all blocks
*
* @return void
*/
public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false)
public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false): void
{
if ($mSelector instanceof DeclarationBlock) {
$mSelector = $mSelector->getSelectors();
Expand Down Expand Up @@ -466,10 +456,8 @@ public function getContents()

/**
* @param array<array-key, Comment> $aComments
*
* @return void
*/
public function addComments(array $aComments)
public function addComments(array $aComments): void
{
$this->aComments = array_merge($this->aComments, $aComments);
}
Expand All @@ -484,10 +472,8 @@ public function getComments()

/**
* @param array<array-key, Comment> $aComments
*
* @return void
*/
public function setComments(array $aComments)
public function setComments(array $aComments): void
{
$this->aComments = $aComments;
}
Expand Down
8 changes: 2 additions & 6 deletions src/CSSList/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@ public function getSelectorsBySpecificity($sSpecificitySearch = null)
/**
* Expands all shorthand properties to their long value.
*
* @return void
*
* @deprecated This will be removed without substitution in version 10.0.
*/
public function expandShorthands()
public function expandShorthands(): void
{
foreach ($this->getAllDeclarationBlocks() as $oDeclaration) {
$oDeclaration->expandShorthands();
Expand All @@ -127,11 +125,9 @@ public function expandShorthands()
/**
* Create shorthands properties whenever possible.
*
* @return void
*
* @deprecated This will be removed without substitution in version 10.0.
*/
public function createShorthands()
public function createShorthands(): void
{
foreach ($this->getAllDeclarationBlocks() as $oDeclaration) {
$oDeclaration->createShorthands();
Expand Down
4 changes: 2 additions & 2 deletions src/CSSList/KeyFrame.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct($iLineNo = 0)
/**
* @param string $vendorKeyFrame
*/
public function setVendorKeyFrame($vendorKeyFrame)
public function setVendorKeyFrame($vendorKeyFrame): void
{
$this->vendorKeyFrame = $vendorKeyFrame;
}
Expand All @@ -46,7 +46,7 @@ public function getVendorKeyFrame()
/**
* @param string $animationName
*/
public function setAnimationName($animationName)
public function setAnimationName($animationName): void
{
$this->animationName = $animationName;
}
Expand Down
4 changes: 1 addition & 3 deletions src/Comment/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ public function getLineNo()

/**
* @param string $sComment
*
* @return void
*/
public function setComment($sComment)
public function setComment($sComment): void
{
$this->sComment = $sComment;
}
Expand Down
5 changes: 1 addition & 4 deletions src/OutputFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,7 @@ public function nextLevel()
return $this->oNextLevelFormat;
}

/**
* @return void
*/
public function beLenient()
public function beLenient(): void
{
$this->bIgnoreExceptions = true;
}
Expand Down
8 changes: 2 additions & 6 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,16 @@ public function __construct($sText, Settings $oParserSettings = null, $iLineNo =
* Sets the charset to be used if the CSS does not contain an `@charset` declaration.
*
* @param string $sCharset
*
* @return void
*/
public function setCharset($sCharset)
public function setCharset($sCharset): void
{
$this->oParserState->setCharset($sCharset);
}

/**
* Returns the charset that is used if the CSS does not contain an `@charset` declaration.
*
* @return void
*/
public function getCharset()
public function getCharset(): void
{
// Note: The `return` statement is missing here. This is a bug that needs to be fixed.
$this->oParserState->getCharset();
Expand Down
5 changes: 1 addition & 4 deletions src/Parsing/Anchor.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ public function __construct($iPosition, ParserState $oParserState)
$this->oParserState = $oParserState;
}

/**
* @return void
*/
public function backtrack()
public function backtrack(): void
{
$this->oParserState->setPosition($this->iPosition);
}
Expand Down
12 changes: 3 additions & 9 deletions src/Parsing/ParserState.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ public function __construct($sText, Settings $oParserSettings, $iLineNo = 1)
* Sets the charset to be used if the CSS does not contain an `@charset` declaration.
*
* @param string $sCharset
*
* @return void
*/
public function setCharset($sCharset)
public function setCharset($sCharset): void
{
$this->sCharset = $sCharset;
$this->aText = $this->strsplit($this->sText);
Expand Down Expand Up @@ -123,10 +121,8 @@ public function anchor(): Anchor

/**
* @param int $iPosition
*
* @return void
*/
public function setPosition($iPosition)
public function setPosition($iPosition): void
{
$this->iCurrentPosition = $iPosition;
}
Expand Down Expand Up @@ -426,10 +422,8 @@ public function streql($sString1, $sString2, $bCaseInsensitive = true): bool

/**
* @param int $iAmount
*
* @return void
*/
public function backtrack($iAmount)
public function backtrack($iAmount): void
{
$this->iCurrentPosition -= $iAmount;
}
Expand Down
16 changes: 4 additions & 12 deletions src/Property/CSSNamespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,16 @@ public function getPrefix()

/**
* @param string $mUrl
*
* @return void
*/
public function setUrl($mUrl)
public function setUrl($mUrl): void
{
$this->mUrl = $mUrl;
}

/**
* @param string $sPrefix
*
* @return void
*/
public function setPrefix($sPrefix)
public function setPrefix($sPrefix): void
{
$this->sPrefix = $sPrefix;
}
Expand All @@ -123,10 +119,8 @@ public function atRuleArgs(): array

/**
* @param array<array-key, Comment> $aComments
*
* @return void
*/
public function addComments(array $aComments)
public function addComments(array $aComments): void
{
$this->aComments = array_merge($this->aComments, $aComments);
}
Expand All @@ -141,10 +135,8 @@ public function getComments()

/**
* @param array<array-key, Comment> $aComments
*
* @return void
*/
public function setComments(array $aComments)
public function setComments(array $aComments): void
{
$this->aComments = $aComments;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Property/Charset.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getLineNo()
*
* @return void
*/
public function setCharset($sCharset)
public function setCharset($sCharset): void
{
$sCharset = $sCharset instanceof CSSString ? $sCharset : new CSSString($sCharset);
$this->oCharset = $sCharset;
Expand Down Expand Up @@ -100,7 +100,7 @@ public function atRuleArgs()
*
* @return void
*/
public function addComments(array $aComments)
public function addComments(array $aComments): void
{
$this->aComments = array_merge($this->aComments, $aComments);
}
Expand All @@ -118,7 +118,7 @@ public function getComments()
*
* @return void
*/
public function setComments(array $aComments)
public function setComments(array $aComments): void
{
$this->aComments = $aComments;
}
Expand Down
12 changes: 3 additions & 9 deletions src/Property/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ public function getLineNo()

/**
* @param URL $oLocation
*
* @return void
*/
public function setLocation($oLocation)
public function setLocation($oLocation): void
{
$this->oLocation = $oLocation;
}
Expand Down Expand Up @@ -103,10 +101,8 @@ public function atRuleArgs(): array

/**
* @param array<array-key, Comment> $aComments
*
* @return void
*/
public function addComments(array $aComments)
public function addComments(array $aComments): void
{
$this->aComments = array_merge($this->aComments, $aComments);
}
Expand All @@ -121,10 +117,8 @@ public function getComments()

/**
* @param array<array-key, Comment> $aComments
*
* @return void
*/
public function setComments(array $aComments)
public function setComments(array $aComments): void
{
$this->aComments = $aComments;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Property/Selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function getSelector()
*
* @return void
*/
public function setSelector($sSelector)
public function setSelector($sSelector): void
{
$this->sSelector = trim($sSelector);
$this->iSpecificity = null;
Expand Down
Loading