Skip to content

Commit e299f80

Browse files
authored
[CLEANUP] Rector: Change return type based on strict scalar returns - string, int, float or bool (#589)
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 <[email protected]>
1 parent 4a9b2f5 commit e299f80

17 files changed

+24
-78
lines changed

src/CSSList/AtRuleBlockList.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ public function __toString()
5656
return $this->render(new OutputFormat());
5757
}
5858

59-
/**
60-
* @return string
61-
*/
62-
public function render(OutputFormat $oOutputFormat)
59+
public function render(OutputFormat $oOutputFormat): string
6360
{
6461
$sResult = $oOutputFormat->comments($this);
6562
$sResult .= $oOutputFormat->sBeforeAtRuleBlock;

src/CSSList/Document.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,8 @@ public function createShorthands()
144144
* Overrides `render()` to make format argument optional.
145145
*
146146
* @param OutputFormat|null $oOutputFormat
147-
*
148-
* @return string
149147
*/
150-
public function render(OutputFormat $oOutputFormat = null)
148+
public function render(OutputFormat $oOutputFormat = null): string
151149
{
152150
if ($oOutputFormat === null) {
153151
$oOutputFormat = new OutputFormat();

src/CSSList/KeyFrame.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ public function __toString()
6767
return $this->render(new OutputFormat());
6868
}
6969

70-
/**
71-
* @return string
72-
*/
73-
public function render(OutputFormat $oOutputFormat)
70+
public function render(OutputFormat $oOutputFormat): string
7471
{
7572
$sResult = $oOutputFormat->comments($this);
7673
$sResult .= "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{";

src/Comment/Comment.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ public function __toString()
6161
return $this->render(new OutputFormat());
6262
}
6363

64-
/**
65-
* @return string
66-
*/
67-
public function render(OutputFormat $oOutputFormat)
64+
public function render(OutputFormat $oOutputFormat): string
6865
{
6966
return '/*' . $this->sComment . '*/';
7067
}

src/OutputFormatter.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,8 @@ public function safely($cCode)
166166
* @param string $sSeparator
167167
* @param array<array-key, Renderable|string> $aValues
168168
* @param bool $bIncreaseLevel
169-
*
170-
* @return string
171169
*/
172-
public function implode($sSeparator, array $aValues, $bIncreaseLevel = false)
170+
public function implode($sSeparator, array $aValues, $bIncreaseLevel = false): string
173171
{
174172
$sResult = '';
175173
$oFormat = $this->oFormat;
@@ -218,7 +216,7 @@ public function removeLastSemicolon($sString)
218216
*
219217
* @return string
220218
*/
221-
public function comments(Commentable $oCommentable)
219+
public function comments(Commentable $oCommentable): string
222220
{
223221
if (!$this->oFormat->bRenderComments) {
224222
return '';
@@ -248,7 +246,7 @@ private function prepareSpace($sSpaceString)
248246
/**
249247
* @return string
250248
*/
251-
private function indent()
249+
private function indent(): string
252250
{
253251
return str_repeat($this->oFormat->sIndentation, $this->oFormat->level());
254252
}

src/Parsing/ParserState.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,8 @@ public function strlen($sString): int
457457
/**
458458
* @param int $iStart
459459
* @param int $iLength
460-
*
461-
* @return string
462460
*/
463-
private function substr($iStart, $iLength)
461+
private function substr($iStart, $iLength): string
464462
{
465463
if ($iLength < 0) {
466464
$iLength = $this->iLength - $iStart + $iLength;
@@ -479,10 +477,8 @@ private function substr($iStart, $iLength)
479477

480478
/**
481479
* @param string $sString
482-
*
483-
* @return string
484480
*/
485-
private function strtolower($sString)
481+
private function strtolower($sString): string
486482
{
487483
if ($this->oParserSettings->bMultibyteSupport) {
488484
return mb_strtolower($sString, $this->sCharset);

src/Property/CSSNamespace.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ public function __toString()
5959
return $this->render(new OutputFormat());
6060
}
6161

62-
/**
63-
* @return string
64-
*/
65-
public function render(OutputFormat $oOutputFormat)
62+
public function render(OutputFormat $oOutputFormat): string
6663
{
6764
return '@namespace ' . ($this->sPrefix === null ? '' : $this->sPrefix . ' ')
6865
. $this->mUrl->render($oOutputFormat) . ';';
@@ -107,7 +104,7 @@ public function setPrefix($sPrefix)
107104
/**
108105
* @return string
109106
*/
110-
public function atRuleName()
107+
public function atRuleName(): string
111108
{
112109
return 'namespace';
113110
}

src/Property/Charset.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,12 @@ public function __toString()
7777
return $this->render(new OutputFormat());
7878
}
7979

80-
/**
81-
* @return string
82-
*/
83-
public function render(OutputFormat $oOutputFormat)
80+
public function render(OutputFormat $oOutputFormat): string
8481
{
8582
return "{$oOutputFormat->comments($this)}@charset {$this->oCharset->render($oOutputFormat)};";
8683
}
8784

88-
/**
89-
* @return string
90-
*/
91-
public function atRuleName()
85+
public function atRuleName(): string
9286
{
9387
return 'charset';
9488
}

src/Property/Import.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,13 @@ public function __toString()
7878
return $this->render(new OutputFormat());
7979
}
8080

81-
/**
82-
* @return string
83-
*/
84-
public function render(OutputFormat $oOutputFormat)
81+
public function render(OutputFormat $oOutputFormat): string
8582
{
8683
return $oOutputFormat->comments($this) . "@import " . $this->oLocation->render($oOutputFormat)
8784
. ($this->sMediaQuery === null ? '' : ' ' . $this->sMediaQuery) . ';';
8885
}
8986

90-
/**
91-
* @return string
92-
*/
93-
public function atRuleName()
87+
public function atRuleName(): string
9488
{
9589
return 'import';
9690
}

src/Rule/Rule.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,7 @@ public function __toString()
269269
return $this->render(new OutputFormat());
270270
}
271271

272-
/**
273-
* @return string
274-
*/
275-
public function render(OutputFormat $oOutputFormat)
272+
public function render(OutputFormat $oOutputFormat): string
276273
{
277274
$sResult = "{$oOutputFormat->comments($this)}{$this->sRule}:{$oOutputFormat->spaceAfterRuleName()}";
278275
if ($this->mValue instanceof Value) { // Can also be a ValueList

src/RuleSet/AtRuleSet.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ public function __toString()
5959
return $this->render(new OutputFormat());
6060
}
6161

62-
/**
63-
* @return string
64-
*/
65-
public function render(OutputFormat $oOutputFormat)
62+
public function render(OutputFormat $oOutputFormat): string
6663
{
6764
$sResult = $oOutputFormat->comments($this);
6865
$sArgs = $this->sArgs;

src/RuleSet/DeclarationBlock.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -799,11 +799,9 @@ public function __toString()
799799
}
800800

801801
/**
802-
* @return string
803-
*
804802
* @throws OutputException
805803
*/
806-
public function render(OutputFormat $oOutputFormat)
804+
public function render(OutputFormat $oOutputFormat): string
807805
{
808806
$sResult = $oOutputFormat->comments($this);
809807
if (count($this->aSelectors) === 0) {

src/Value/CSSString.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ public function __toString()
9898
return $this->render(new OutputFormat());
9999
}
100100

101-
/**
102-
* @return string
103-
*/
104-
public function render(OutputFormat $oOutputFormat)
101+
public function render(OutputFormat $oOutputFormat): string
105102
{
106103
$sString = addslashes($this->sString);
107104
$sString = str_replace("\n", '\A', $sString);

src/Value/LineName.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ public function __toString()
5555
return $this->render(new OutputFormat());
5656
}
5757

58-
/**
59-
* @return string
60-
*/
61-
public function render(OutputFormat $oOutputFormat)
58+
public function render(OutputFormat $oOutputFormat): string
6259
{
6360
return '[' . parent::render(OutputFormat::createCompact()) . ']';
6461
}

src/Value/Size.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function isColorComponent()
179179
*
180180
* @return false if the unit an angle, a duration, a frequency or the number is a component in a Color object.
181181
*/
182-
public function isSize()
182+
public function isSize(): bool
183183
{
184184
if (in_array($this->sUnit, self::NON_SIZE_UNITS, true)) {
185185
return false;
@@ -206,10 +206,7 @@ public function __toString()
206206
return $this->render(new OutputFormat());
207207
}
208208

209-
/**
210-
* @return string
211-
*/
212-
public function render(OutputFormat $oOutputFormat)
209+
public function render(OutputFormat $oOutputFormat): string
213210
{
214211
$l = localeconv();
215212
$sPoint = preg_quote($l['decimal_point'], '/');

src/Value/URL.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ public function __toString()
8585
return $this->render(new OutputFormat());
8686
}
8787

88-
/**
89-
* @return string
90-
*/
91-
public function render(OutputFormat $oOutputFormat)
88+
public function render(OutputFormat $oOutputFormat): string
9289
{
9390
return "url({$this->oURL->render($oOutputFormat)})";
9491
}

src/Value/Value.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,10 @@ private static function parseMicrosoftFilter(ParserState $oParserState)
183183
}
184184

185185
/**
186-
* @return string
187-
*
188186
* @throws UnexpectedEOFException
189187
* @throws UnexpectedTokenException
190188
*/
191-
private static function parseUnicodeRangeValue(ParserState $oParserState)
189+
private static function parseUnicodeRangeValue(ParserState $oParserState): string
192190
{
193191
$iCodepointMaxLength = 6; // Code points outside BMP can use up to six digits
194192
$sRange = "";

0 commit comments

Comments
 (0)