From a6da60375f0778ec5bba28d6fc52035f6e4e7643 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Sun, 2 Feb 2025 09:49:37 +0100 Subject: [PATCH] [CLEANUP] Avoid Hungarian notation for `sIdentifier` Part of #756 --- src/CSSList/CSSList.php | 26 +++++++++++++------------- src/Value/URL.php | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/CSSList/CSSList.php b/src/CSSList/CSSList.php index a701cd91..8d4a1c10 100644 --- a/src/CSSList/CSSList.php +++ b/src/CSSList/CSSList.php @@ -156,10 +156,10 @@ private static function parseListItem(ParserState $parserState, CSSList $list) private static function parseAtRule(ParserState $parserState) { $parserState->consume('@'); - $sIdentifier = $parserState->parseIdentifier(); + $identifier = $parserState->parseIdentifier(); $iIdentifierLineNum = $parserState->currentLine(); $parserState->consumeWhiteSpace(); - if ($sIdentifier === 'import') { + if ($identifier === 'import') { $oLocation = URL::parse($parserState); $parserState->consumeWhiteSpace(); $mediaQuery = null; @@ -171,21 +171,21 @@ private static function parseAtRule(ParserState $parserState) } $parserState->consumeUntil([';', ParserState::EOF], true, true); return new Import($oLocation, $mediaQuery, $iIdentifierLineNum); - } elseif ($sIdentifier === 'charset') { + } elseif ($identifier === 'charset') { $oCharsetString = CSSString::parse($parserState); $parserState->consumeWhiteSpace(); $parserState->consumeUntil([';', ParserState::EOF], true, true); return new Charset($oCharsetString, $iIdentifierLineNum); - } elseif (self::identifierIs($sIdentifier, 'keyframes')) { + } elseif (self::identifierIs($identifier, 'keyframes')) { $oResult = new KeyFrame($iIdentifierLineNum); - $oResult->setVendorKeyFrame($sIdentifier); + $oResult->setVendorKeyFrame($identifier); $oResult->setAnimationName(\trim($parserState->consumeUntil('{', false, true))); CSSList::parseList($parserState, $oResult); if ($parserState->comes('}')) { $parserState->consume('}'); } return $oResult; - } elseif ($sIdentifier === 'namespace') { + } elseif ($identifier === 'namespace') { $sPrefix = null; $mUrl = Value::parsePrimitiveValue($parserState); if (!$parserState->comes(';')) { @@ -217,16 +217,16 @@ private static function parseAtRule(ParserState $parserState) } $bUseRuleSet = true; foreach (\explode('/', AtRule::BLOCK_RULES) as $sBlockRuleName) { - if (self::identifierIs($sIdentifier, $sBlockRuleName)) { + if (self::identifierIs($identifier, $sBlockRuleName)) { $bUseRuleSet = false; break; } } if ($bUseRuleSet) { - $oAtRule = new AtRuleSet($sIdentifier, $sArgs, $iIdentifierLineNum); + $oAtRule = new AtRuleSet($identifier, $sArgs, $iIdentifierLineNum); RuleSet::parseRuleSet($parserState, $oAtRule); } else { - $oAtRule = new AtRuleBlockList($sIdentifier, $sArgs, $iIdentifierLineNum); + $oAtRule = new AtRuleBlockList($identifier, $sArgs, $iIdentifierLineNum); CSSList::parseList($parserState, $oAtRule); if ($parserState->comes('}')) { $parserState->consume('}'); @@ -240,12 +240,12 @@ private static function parseAtRule(ParserState $parserState) * Tests an identifier for a given value. Since identifiers are all keywords, they can be vendor-prefixed. * We need to check for these versions too. * - * @param string $sIdentifier + * @param string $identifier */ - private static function identifierIs($sIdentifier, string $sMatch): bool + private static function identifierIs($identifier, string $sMatch): bool { - return (\strcasecmp($sIdentifier, $sMatch) === 0) - ?: \preg_match("/^(-\\w+-)?$sMatch$/i", $sIdentifier) === 1; + return (\strcasecmp($identifier, $sMatch) === 0) + ?: \preg_match("/^(-\\w+-)?$sMatch$/i", $identifier) === 1; } /** diff --git a/src/Value/URL.php b/src/Value/URL.php index cefaef53..6084417a 100644 --- a/src/Value/URL.php +++ b/src/Value/URL.php @@ -37,15 +37,15 @@ public function __construct(CSSString $oURL, $lineNumber = 0) public static function parse(ParserState $parserState): URL { $oAnchor = $parserState->anchor(); - $sIdentifier = ''; + $identifier = ''; for ($i = 0; $i < 3; $i++) { $sChar = $parserState->parseCharacter(true); if ($sChar === null) { break; } - $sIdentifier .= $sChar; + $identifier .= $sChar; } - $bUseUrl = $parserState->streql($sIdentifier, 'url'); + $bUseUrl = $parserState->streql($identifier, 'url'); if ($bUseUrl) { $parserState->consumeWhiteSpace(); $parserState->consume('(');