Skip to content

[CLEANUP] Rector: Add strict return type based native function or class method return #603

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 2 commits 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
53 changes: 12 additions & 41 deletions src/OutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,102 +36,73 @@ public function space($sName, $sType = null): string
return $this->prepareSpace($sSpaceString);
}

/**
* @return string
*/
public function spaceAfterRuleName()
public function spaceAfterRuleName(): string
{
return $this->space('AfterRuleName');
}

/**
* @return string
*/
public function spaceBeforeRules()
public function spaceBeforeRules(): string
{
return $this->space('BeforeRules');
}

/**
* @return string
*/
public function spaceAfterRules()
public function spaceAfterRules(): string
{
return $this->space('AfterRules');
}

/**
* @return string
*/
public function spaceBetweenRules()
public function spaceBetweenRules(): string
{
return $this->space('BetweenRules');
}

/**
* @return string
*/
public function spaceBeforeBlocks()
public function spaceBeforeBlocks(): string
{
return $this->space('BeforeBlocks');
}

/**
* @return string
*/
public function spaceAfterBlocks()
public function spaceAfterBlocks(): string
{
return $this->space('AfterBlocks');
}

/**
* @return string
*/
public function spaceBetweenBlocks()
public function spaceBetweenBlocks(): string
{
return $this->space('BetweenBlocks');
}

/**
* @return string
*/
public function spaceBeforeSelectorSeparator()
public function spaceBeforeSelectorSeparator(): string
{
return $this->space('BeforeSelectorSeparator');
}

/**
* @return string
*/
public function spaceAfterSelectorSeparator()
public function spaceAfterSelectorSeparator(): string
{
return $this->space('AfterSelectorSeparator');
}

/**
* @param string $sSeparator
*
* @return string
*/
public function spaceBeforeListArgumentSeparator($sSeparator)
public function spaceBeforeListArgumentSeparator($sSeparator): string
{
return $this->space('BeforeListArgumentSeparator', $sSeparator);
}

/**
* @param string $sSeparator
*
* @return string
*/
public function spaceAfterListArgumentSeparator($sSeparator)
public function spaceAfterListArgumentSeparator($sSeparator): string
{
return $this->space('AfterListArgumentSeparator', $sSeparator);
}

/**
* @return string
*/
public function spaceBeforeOpeningBrace()
public function spaceBeforeOpeningBrace(): string
{
return $this->space('BeforeOpeningBrace');
}
Expand Down
4 changes: 1 addition & 3 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ public function getCharset(): void
/**
* Parses the CSS provided to the constructor and creates a `Document` from it.
*
* @return Document
*
* @throws SourceException
*/
public function parse()
public function parse(): Document
{
return Document::parse($this->oParserState);
}
Expand Down
4 changes: 1 addition & 3 deletions src/Parsing/ParserState.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,10 @@ public function consume($mValue = 1): string
* @param string $mExpression
* @param int|null $iMaxLength
*
* @return string
*
* @throws UnexpectedEOFException
* @throws UnexpectedTokenException
*/
public function consumeExpression($mExpression, $iMaxLength = null)
public function consumeExpression($mExpression, $iMaxLength = null): string
{
$aMatches = null;
$sInput = $iMaxLength !== null ? $this->peek($iMaxLength) : $this->inputLeft();
Expand Down
4 changes: 1 addition & 3 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1004,10 +1004,8 @@ public function missingPropertyValueLenient(): void
*
* @param string $sFileName
* @param Settings|null $oSettings
*
* @return Document parsed document
*/
public static function parsedStructureForFile($sFileName, $oSettings = null)
public static function parsedStructureForFile($sFileName, $oSettings = null): Document
{
$sFile = __DIR__ . "/fixtures/$sFileName.css";
$oParser = new Parser(file_get_contents($sFile), $oSettings);
Expand Down