Skip to content

Commit a8709e4

Browse files
oliverkleeJakeQZ
andauthored
[CLEANUP] Fix some type annotations in ParserState (#1130)
Also make the parameter names non-Hungarian. Part of #756 Co-authored-by: JakeQZ <[email protected]>
1 parent b43388a commit a8709e4

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

config/phpstan-baseline.neon

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -102,36 +102,12 @@ parameters:
102102
count: 2
103103
path: ../src/CSSList/KeyFrame.php
104104

105-
-
106-
message: '#^Default value of the parameter \#2 \$bIncludeEnd \(false\) of method Sabberworm\\CSS\\Parsing\\ParserState\:\:consumeUntil\(\) is incompatible with type string\.$#'
107-
identifier: parameter.defaultValue
108-
count: 1
109-
path: ../src/Parsing/ParserState.php
110-
111-
-
112-
message: '#^Default value of the parameter \#3 \$consumeEnd \(false\) of method Sabberworm\\CSS\\Parsing\\ParserState\:\:consumeUntil\(\) is incompatible with type string\.$#'
113-
identifier: parameter.defaultValue
114-
count: 1
115-
path: ../src/Parsing/ParserState.php
116-
117105
-
118106
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
119107
identifier: equal.notAllowed
120108
count: 1
121109
path: ../src/Parsing/ParserState.php
122110

123-
-
124-
message: '#^Only booleans are allowed in a negated boolean, string given\.$#'
125-
identifier: booleanNot.exprNotBoolean
126-
count: 1
127-
path: ../src/Parsing/ParserState.php
128-
129-
-
130-
message: '#^Only booleans are allowed in an if condition, string given\.$#'
131-
identifier: if.condNotBoolean
132-
count: 1
133-
path: ../src/Parsing/ParserState.php
134-
135111
-
136112
message: '#^PHPDoc tag @return with type array\<int, Sabberworm\\CSS\\Comment\\Comment\>\|void is not subtype of native type array\.$#'
137113
identifier: return.phpDocType

src/Parsing/ParserState.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,16 +335,16 @@ public function isEnd(): bool
335335

336336
/**
337337
* @param array<array-key, string>|string $stopCharacters
338-
* @param string $bIncludeEnd
339-
* @param string $consumeEnd
338+
* @param bool $includeEnd
339+
* @param bool $consumeEnd
340340
* @param array<int, Comment> $comments
341341
*
342342
* @throws UnexpectedEOFException
343343
* @throws UnexpectedTokenException
344344
*/
345345
public function consumeUntil(
346346
$stopCharacters,
347-
$bIncludeEnd = false,
347+
$includeEnd = false,
348348
$consumeEnd = false,
349349
array &$comments = []
350350
): string {
@@ -355,7 +355,7 @@ public function consumeUntil(
355355
while (!$this->isEnd()) {
356356
$character = $this->consume(1);
357357
if (\in_array($character, $stopCharacters, true)) {
358-
if ($bIncludeEnd) {
358+
if ($includeEnd) {
359359
$consumedCharacters .= $character;
360360
} elseif (!$consumeEnd) {
361361
$this->currentPosition -= $this->strlen($character);

0 commit comments

Comments
 (0)