Skip to content

Commit 40dc31d

Browse files
authored
[CLEANUP] Rector: Add return type from return direct array (#590)
This applies the rule ReturnTypeFromReturnDirectArrayRector. For Details see: https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#returntypefromreturndirectarrayrector Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
1 parent dc5f0e9 commit 40dc31d

File tree

4 files changed

+13
-20
lines changed

4 files changed

+13
-20
lines changed

src/Parsing/ParserState.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,8 @@ public function comes($sString, $bCaseInsensitive = false): bool
270270
/**
271271
* @param int $iLength
272272
* @param int $iOffset
273-
*
274-
* @return string
275273
*/
276-
public function peek($iLength = 1, $iOffset = 0)
274+
public function peek($iLength = 1, $iOffset = 0): string
277275
{
278276
$iOffset += $this->iCurrentPosition;
279277
if ($iOffset >= $this->iLength) {
@@ -285,12 +283,10 @@ public function peek($iLength = 1, $iOffset = 0)
285283
/**
286284
* @param int $mValue
287285
*
288-
* @return string
289-
*
290286
* @throws UnexpectedEOFException
291287
* @throws UnexpectedTokenException
292288
*/
293-
public function consume($mValue = 1)
289+
public function consume($mValue = 1): string
294290
{
295291
if (is_string($mValue)) {
296292
$iLineCount = substr_count($mValue, "\n");
@@ -410,10 +406,7 @@ public function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false, a
410406
);
411407
}
412408

413-
/**
414-
* @return string
415-
*/
416-
private function inputLeft()
409+
private function inputLeft(): string
417410
{
418411
return $this->substr($this->iCurrentPosition, -1);
419412
}

src/Rule/Rule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public static function parse(ParserState $oParserState)
117117
*
118118
* @return array<int, string>
119119
*/
120-
private static function listDelimiterForRule($sRule)
120+
private static function listDelimiterForRule($sRule): array
121121
{
122122
if (preg_match('/^font($|-)/', $sRule)) {
123123
return [',', '/', ' '];

tests/CSSList/DocumentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getContentsInitiallyReturnsEmptyArray(): void
5050
/**
5151
* @return array<string, array<int, array<int, DeclarationBlock>>>
5252
*/
53-
public static function contentsDataProvider()
53+
public static function contentsDataProvider(): array
5454
{
5555
return [
5656
'empty array' => [[]],

tests/RuleSet/DeclarationBlockTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function expandBorderShorthand($sCss, $sExpected): void
3333
/**
3434
* @return array<int, array<int, string>>
3535
*/
36-
public static function expandBorderShorthandProvider()
36+
public static function expandBorderShorthandProvider(): array
3737
{
3838
return [
3939
['body{ border: 2px solid #000 }', 'body {border-width: 2px;border-style: solid;border-color: #000;}'],
@@ -66,7 +66,7 @@ public function expandFontShorthand($sCss, $sExpected): void
6666
/**
6767
* @return array<int, array<int, string>>
6868
*/
69-
public static function expandFontShorthandProvider()
69+
public static function expandFontShorthandProvider(): array
7070
{
7171
return [
7272
[
@@ -122,7 +122,7 @@ public function expandBackgroundShorthand($sCss, $sExpected): void
122122
/**
123123
* @return array<int, array<int, string>>
124124
*/
125-
public static function expandBackgroundShorthandProvider()
125+
public static function expandBackgroundShorthandProvider(): array
126126
{
127127
return [
128128
['body {border: 1px;}', 'body {border: 1px;}'],
@@ -175,7 +175,7 @@ public function expandDimensionsShorthand($sCss, $sExpected): void
175175
/**
176176
* @return array<int, array<int, string>>
177177
*/
178-
public static function expandDimensionsShorthandProvider()
178+
public static function expandDimensionsShorthandProvider(): array
179179
{
180180
return [
181181
['body {border: 1px;}', 'body {border: 1px;}'],
@@ -213,7 +213,7 @@ public function createBorderShorthand($sCss, $sExpected): void
213213
/**
214214
* @return array<int, array<int, string>>
215215
*/
216-
public static function createBorderShorthandProvider()
216+
public static function createBorderShorthandProvider(): array
217217
{
218218
return [
219219
['body {border-width: 2px;border-style: solid;border-color: #000;}', 'body {border: 2px solid #000;}'],
@@ -244,7 +244,7 @@ public function createFontShorthand($sCss, $sExpected): void
244244
/**
245245
* @return array<int, array<int, string>>
246246
*/
247-
public static function createFontShorthandProvider()
247+
public static function createFontShorthandProvider(): array
248248
{
249249
return [
250250
['body {font-size: 12px; font-family: serif}', 'body {font: 12px serif;}'],
@@ -287,7 +287,7 @@ public function createDimensionsShorthand($sCss, $sExpected): void
287287
/**
288288
* @return array<int, array<int, string>>
289289
*/
290-
public static function createDimensionsShorthandProvider()
290+
public static function createDimensionsShorthandProvider(): array
291291
{
292292
return [
293293
['body {border: 1px;}', 'body {border: 1px;}'],
@@ -325,7 +325,7 @@ public function createBackgroundShorthand($sCss, $sExpected): void
325325
/**
326326
* @return array<int, array<int, string>>
327327
*/
328-
public static function createBackgroundShorthandProvider()
328+
public static function createBackgroundShorthandProvider(): array
329329
{
330330
return [
331331
['body {border: 1px;}', 'body {border: 1px;}'],

0 commit comments

Comments
 (0)