Skip to content

Commit a06d326

Browse files
authored
[CLEANUP] Rector: Add strict return type based native function or class method return (MyIntervals#603)
This applies the rule ReturnTypeFromStrictScalarReturnExprRector. For Details see: https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#returntypefromstrictscalarreturnexprrector Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
1 parent 3a34389 commit a06d326

File tree

4 files changed

+15
-50
lines changed

4 files changed

+15
-50
lines changed

src/OutputFormatter.php

Lines changed: 12 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -36,102 +36,73 @@ public function space($sName, $sType = null): string
3636
return $this->prepareSpace($sSpaceString);
3737
}
3838

39-
/**
40-
* @return string
41-
*/
42-
public function spaceAfterRuleName()
39+
public function spaceAfterRuleName(): string
4340
{
4441
return $this->space('AfterRuleName');
4542
}
4643

47-
/**
48-
* @return string
49-
*/
50-
public function spaceBeforeRules()
44+
public function spaceBeforeRules(): string
5145
{
5246
return $this->space('BeforeRules');
5347
}
5448

55-
/**
56-
* @return string
57-
*/
58-
public function spaceAfterRules()
49+
public function spaceAfterRules(): string
5950
{
6051
return $this->space('AfterRules');
6152
}
6253

63-
/**
64-
* @return string
65-
*/
66-
public function spaceBetweenRules()
54+
public function spaceBetweenRules(): string
6755
{
6856
return $this->space('BetweenRules');
6957
}
7058

71-
/**
72-
* @return string
73-
*/
74-
public function spaceBeforeBlocks()
59+
public function spaceBeforeBlocks(): string
7560
{
7661
return $this->space('BeforeBlocks');
7762
}
7863

79-
/**
80-
* @return string
81-
*/
82-
public function spaceAfterBlocks()
64+
public function spaceAfterBlocks(): string
8365
{
8466
return $this->space('AfterBlocks');
8567
}
8668

87-
/**
88-
* @return string
89-
*/
90-
public function spaceBetweenBlocks()
69+
public function spaceBetweenBlocks(): string
9170
{
9271
return $this->space('BetweenBlocks');
9372
}
9473

95-
/**
96-
* @return string
97-
*/
98-
public function spaceBeforeSelectorSeparator()
74+
public function spaceBeforeSelectorSeparator(): string
9975
{
10076
return $this->space('BeforeSelectorSeparator');
10177
}
10278

10379
/**
10480
* @return string
10581
*/
106-
public function spaceAfterSelectorSeparator()
82+
public function spaceAfterSelectorSeparator(): string
10783
{
10884
return $this->space('AfterSelectorSeparator');
10985
}
11086

11187
/**
11288
* @param string $sSeparator
11389
*
114-
* @return string
11590
*/
116-
public function spaceBeforeListArgumentSeparator($sSeparator)
91+
public function spaceBeforeListArgumentSeparator($sSeparator): string
11792
{
11893
return $this->space('BeforeListArgumentSeparator', $sSeparator);
11994
}
12095

12196
/**
12297
* @param string $sSeparator
12398
*
124-
* @return string
12599
*/
126-
public function spaceAfterListArgumentSeparator($sSeparator)
100+
public function spaceAfterListArgumentSeparator($sSeparator): string
127101
{
128102
return $this->space('AfterListArgumentSeparator', $sSeparator);
129103
}
130104

131-
/**
132-
* @return string
133-
*/
134-
public function spaceBeforeOpeningBrace()
105+
public function spaceBeforeOpeningBrace(): string
135106
{
136107
return $this->space('BeforeOpeningBrace');
137108
}

src/Parser.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ public function getCharset(): void
5151
/**
5252
* Parses the CSS provided to the constructor and creates a `Document` from it.
5353
*
54-
* @return Document
55-
*
5654
* @throws SourceException
5755
*/
58-
public function parse()
56+
public function parse(): Document
5957
{
6058
return Document::parse($this->oParserState);
6159
}

src/Parsing/ParserState.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,10 @@ public function consume($mValue = 1): string
308308
* @param string $mExpression
309309
* @param int|null $iMaxLength
310310
*
311-
* @return string
312-
*
313311
* @throws UnexpectedEOFException
314312
* @throws UnexpectedTokenException
315313
*/
316-
public function consumeExpression($mExpression, $iMaxLength = null)
314+
public function consumeExpression($mExpression, $iMaxLength = null): string
317315
{
318316
$aMatches = null;
319317
$sInput = $iMaxLength !== null ? $this->peek($iMaxLength) : $this->inputLeft();

tests/ParserTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,10 +1004,8 @@ public function missingPropertyValueLenient(): void
10041004
*
10051005
* @param string $sFileName
10061006
* @param Settings|null $oSettings
1007-
*
1008-
* @return Document parsed document
10091007
*/
1010-
public static function parsedStructureForFile($sFileName, $oSettings = null)
1008+
public static function parsedStructureForFile($sFileName, $oSettings = null): Document
10111009
{
10121010
$sFile = __DIR__ . "/fixtures/$sFileName.css";
10131011
$oParser = new Parser(file_get_contents($sFile), $oSettings);

0 commit comments

Comments
 (0)