Skip to content

Commit 2d2ac4e

Browse files
committed
Changes suggested in code review
1 parent e108d47 commit 2d2ac4e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/CSSList/CSSList.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,12 @@ private static function parseAtRule(ParserState $oParserState)
167167
$sMediaQuery = null;
168168
if (!$oParserState->comes(';')) {
169169
$sMediaQuery = \trim($oParserState->consumeUntil([';', ParserState::EOF]));
170+
if ($sMediaQuery === '') {
171+
$sMediaQuery = null;
172+
}
170173
}
171174
$oParserState->consumeUntil([';', ParserState::EOF], true, true);
172-
return new Import(
173-
$oLocation,
174-
$sMediaQuery !== null && $sMediaQuery !== '' && $sMediaQuery !== '0' ? $sMediaQuery : null,
175-
$iIdentifierLineNum
176-
);
175+
return new Import($oLocation, $sMediaQuery, $iIdentifierLineNum);
177176
} elseif ($sIdentifier === 'charset') {
178177
$oCharsetString = CSSString::parse($oParserState);
179178
$oParserState->consumeWhiteSpace();

src/Value/CSSString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function parse(ParserState $oParserState): CSSString
5353
$sContent = null;
5454
if ($sQuote === null) {
5555
// Unquoted strings end in whitespace or with braces, brackets, parentheses
56-
while (\in_array(\preg_match('/[\\s{}()<>\\[\\]]/isu', $oParserState->peek()), [0, false], true)) {
56+
while (\preg_match('/[\\s{}()<>\\[\\]]/isu', $oParserState->peek()) !== 1) {
5757
$sResult .= $oParserState->parseCharacter(false);
5858
}
5959
} else {

0 commit comments

Comments
 (0)