Skip to content

Commit ddbe63e

Browse files
committed
[CLEANUP] Return null from DeclarationBlock::parse() on failure
Part of #1176.
1 parent 6393660 commit ddbe63e

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

config/phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ parameters:
4848
count: 1
4949
path: ../src/RuleSet/DeclarationBlock.php
5050

51-
-
52-
message: '#^Returning false in non return bool class method\. Use null with type\|null instead or add bool return type$#'
53-
identifier: typePerfect.nullOverFalse
54-
count: 1
55-
path: ../src/RuleSet/DeclarationBlock.php
56-
5751
-
5852
message: '#^Only booleans are allowed in a negated boolean, string\|null given\.$#'
5953
identifier: booleanNot.exprNotBoolean

src/RuleSet/DeclarationBlock.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@ class DeclarationBlock extends RuleSet
3030
private $selectors = [];
3131

3232
/**
33-
* @return DeclarationBlock|false
34-
*
3533
* @throws UnexpectedTokenException
3634
* @throws UnexpectedEOFException
3735
*
3836
* @internal since V8.8.0
3937
*/
40-
public static function parse(ParserState $parserState, ?CSSList $list = null)
38+
public static function parse(ParserState $parserState, ?CSSList $list = null): ?DeclarationBlock
4139
{
4240
$comments = [];
4341
$result = new DeclarationBlock($parserState->currentLine());
@@ -63,7 +61,7 @@ public static function parse(ParserState $parserState, ?CSSList $list = null)
6361
if (!$parserState->comes('}')) {
6462
$parserState->consumeUntil('}', false, true);
6563
}
66-
return false;
64+
return null;
6765
} else {
6866
throw $e;
6967
}

0 commit comments

Comments
 (0)