Skip to content

Commit 1b4dc29

Browse files
authored
[CLEANUP] Rector: Add return type to function like with return new (#591)
This applies the rule ReturnTypeFromReturnNewRector. For Details see: https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#returntypefromreturnnewrector Signed-off-by: Daniel Ziegenberg <[email protected]>
1 parent 9fe826f commit 1b4dc29

File tree

11 files changed

+14
-32
lines changed

11 files changed

+14
-32
lines changed

src/CSSList/Document.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ public function __construct($iLineNo = 0)
2525
}
2626

2727
/**
28-
* @return Document
29-
*
3028
* @throws SourceException
3129
*/
32-
public static function parse(ParserState $oParserState)
30+
public static function parse(ParserState $oParserState): Document
3331
{
3432
$oDocument = new Document($oParserState->currentLine());
3533
CSSList::parseList($oParserState, $oDocument);

src/OutputFormat.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,8 @@ public function level()
303303

304304
/**
305305
* Creates an instance of this class without any particular formatting settings.
306-
*
307-
* @return self
308306
*/
309-
public static function create()
307+
public static function create(): OutputFormat
310308
{
311309
return new OutputFormat();
312310
}

src/Parsing/ParserState.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Sabberworm\CSS\Parsing;
44

55
use Sabberworm\CSS\Comment\Comment;
6+
use Sabberworm\CSS\Parsing\Anchor;
67
use Sabberworm\CSS\Settings;
78

89
class ParserState
@@ -114,10 +115,8 @@ public function getSettings()
114115
return $this->oParserSettings;
115116
}
116117

117-
/**
118-
* @return \Sabberworm\CSS\Parsing\Anchor
119-
*/
120-
public function anchor()
118+
119+
public function anchor(): Anchor
121120
{
122121
return new Anchor($this->iCurrentPosition, $this);
123122
}

src/Rule/Rule.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,10 @@ public function __construct($sRule, $iLineNo = 0, $iColNo = 0)
7171
}
7272

7373
/**
74-
* @return Rule
75-
*
7674
* @throws UnexpectedEOFException
7775
* @throws UnexpectedTokenException
7876
*/
79-
public static function parse(ParserState $oParserState)
77+
public static function parse(ParserState $oParserState): Rule
8078
{
8179
$aComments = $oParserState->consumeWhiteSpace();
8280
$oRule = new Rule(

src/Settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private function __construct()
4141
/**
4242
* @return self new instance
4343
*/
44-
public static function create()
44+
public static function create(): Settings
4545
{
4646
return new Settings();
4747
}

src/Value/CSSString.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ public function __construct($sString, $iLineNo = 0)
3131
}
3232

3333
/**
34-
* @return CSSString
35-
*
3634
* @throws SourceException
3735
* @throws UnexpectedEOFException
3836
* @throws UnexpectedTokenException
3937
*/
40-
public static function parse(ParserState $oParserState)
38+
public static function parse(ParserState $oParserState): CSSString
4139
{
4240
$sBegin = $oParserState->peek();
4341
$sQuote = null;

src/Value/CalcFunction.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ class CalcFunction extends CSSFunction
2222
* @param ParserState $oParserState
2323
* @param bool $bIgnoreCase
2424
*
25-
* @return CalcFunction
26-
*
2725
* @throws UnexpectedTokenException
2826
* @throws UnexpectedEOFException
2927
*/
30-
public static function parse(ParserState $oParserState, $bIgnoreCase = false)
28+
public static function parse(ParserState $oParserState, $bIgnoreCase = false): CalcFunction
3129
{
3230
$aOperators = ['+', '-', '*', '/'];
3331
$sFunction = $oParserState->parseIdentifier();

src/Value/LineName.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ public function __construct(array $aComponents = [], $iLineNo = 0)
1919
}
2020

2121
/**
22-
* @return LineName
23-
*
2422
* @throws UnexpectedTokenException
2523
* @throws UnexpectedEOFException
2624
*/
27-
public static function parse(ParserState $oParserState)
25+
public static function parse(ParserState $oParserState): LineName
2826
{
2927
$oParserState->consume('[');
3028
$oParserState->consumeWhiteSpace();

src/Value/Size.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,10 @@ public function __construct($fSize, $sUnit = null, $bIsColorComponent = false, $
7171
/**
7272
* @param bool $bIsColorComponent
7373
*
74-
* @return Size
75-
*
7674
* @throws UnexpectedEOFException
7775
* @throws UnexpectedTokenException
7876
*/
79-
public static function parse(ParserState $oParserState, $bIsColorComponent = false)
77+
public static function parse(ParserState $oParserState, $bIsColorComponent = false): Size
8078
{
8179
$sSize = '';
8280
if ($oParserState->comes('-')) {

src/Value/URL.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ public function __construct(CSSString $oURL, $iLineNo = 0)
2828
}
2929

3030
/**
31-
* @return URL
32-
*
3331
* @throws SourceException
3432
* @throws UnexpectedEOFException
3533
* @throws UnexpectedTokenException
3634
*/
37-
public static function parse(ParserState $oParserState)
35+
public static function parse(ParserState $oParserState): URL
3836
{
3937
$oAnchor = $oParserState->anchor();
4038
$sIdentifier = '';

src/Value/Value.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Sabberworm\CSS\Parsing\SourceException;
77
use Sabberworm\CSS\Parsing\UnexpectedEOFException;
88
use Sabberworm\CSS\Parsing\UnexpectedTokenException;
9+
use Sabberworm\CSS\Value\CSSFunction;
910
use Sabberworm\CSS\Renderable;
1011

1112
/**
@@ -170,12 +171,10 @@ public static function parsePrimitiveValue(ParserState $oParserState)
170171
}
171172

172173
/**
173-
* @return CSSFunction
174-
*
175174
* @throws UnexpectedEOFException
176175
* @throws UnexpectedTokenException
177176
*/
178-
private static function parseMicrosoftFilter(ParserState $oParserState)
177+
private static function parseMicrosoftFilter(ParserState $oParserState): CSSFunction
179178
{
180179
$sFunction = $oParserState->consumeUntil('(', false, true);
181180
$aArguments = Value::parseValue($oParserState, [',', '=']);

0 commit comments

Comments
 (0)