Skip to content

[CLEANUP] Avoid Hungarian notation for parserSettings #938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ class Parser
* @param string $sText the complete CSS as text (i.e., usually the contents of a CSS file)
* @param int<0, max> $lineNumber the line number (starting from 1, not from 0)
*/
public function __construct($sText, ?Settings $oParserSettings = null, $lineNumber = 1)
public function __construct($sText, ?Settings $parserSettings = null, $lineNumber = 1)
{
if ($oParserSettings === null) {
$oParserSettings = Settings::create();
if ($parserSettings === null) {
$parserSettings = Settings::create();
}
$this->parserState = new ParserState($sText, $oParserSettings, $lineNumber);
$this->parserState = new ParserState($sText, $parserSettings, $lineNumber);
}

/**
Expand Down
22 changes: 11 additions & 11 deletions src/Parsing/ParserState.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ParserState
/**
* @var Settings
*/
private $oParserSettings;
private $parserSettings;

/**
* @var string
Expand Down Expand Up @@ -60,12 +60,12 @@ class ParserState
* @param string $sText the complete CSS as text (i.e., usually the contents of a CSS file)
* @param int<0, max> $lineNumber
*/
public function __construct($sText, Settings $oParserSettings, $lineNumber = 1)
public function __construct($sText, Settings $parserSettings, $lineNumber = 1)
{
$this->oParserSettings = $oParserSettings;
$this->parserSettings = $parserSettings;
$this->sText = $sText;
$this->lineNumber = $lineNumber;
$this->setCharset($this->oParserSettings->sDefaultCharset);
$this->setCharset($this->parserSettings->sDefaultCharset);
}

/**
Expand Down Expand Up @@ -113,7 +113,7 @@ public function currentColumn()
*/
public function getSettings()
{
return $this->oParserSettings;
return $this->parserSettings;
}

public function anchor(): Anchor
Expand Down Expand Up @@ -175,7 +175,7 @@ public function parseCharacter($bIsForIdentifier)
{
if ($this->peek() === '\\') {
if (
$bIsForIdentifier && $this->oParserSettings->bLenientParsing
$bIsForIdentifier && $this->parserSettings->bLenientParsing
&& ($this->comes('\\0') || $this->comes('\\9'))
) {
// Non-strings can contain \0 or \9 which is an IE hack supported in lenient parsing.
Expand Down Expand Up @@ -239,7 +239,7 @@ public function consumeWhiteSpace(): array
while (\preg_match('/\\s/isSu', $this->peek()) === 1) {
$this->consume(1);
}
if ($this->oParserSettings->bLenientParsing) {
if ($this->parserSettings->bLenientParsing) {
try {
$oComment = $this->consumeComment();
} catch (UnexpectedEOFException $e) {
Expand Down Expand Up @@ -440,7 +440,7 @@ public function backtrack($iAmount): void
*/
public function strlen($sString): int
{
if ($this->oParserSettings->bMultibyteSupport) {
if ($this->parserSettings->bMultibyteSupport) {
return \mb_strlen($sString, $this->sCharset);
} else {
return \strlen($sString);
Expand Down Expand Up @@ -473,7 +473,7 @@ private function substr($iStart, $iLength): string
*/
private function strtolower($sString): string
{
if ($this->oParserSettings->bMultibyteSupport) {
if ($this->parserSettings->bMultibyteSupport) {
return \mb_strtolower($sString, $this->sCharset);
} else {
return \strtolower($sString);
Expand All @@ -487,7 +487,7 @@ private function strtolower($sString): string
*/
private function strsplit($sString)
{
if ($this->oParserSettings->bMultibyteSupport) {
if ($this->parserSettings->bMultibyteSupport) {
if ($this->streql($this->sCharset, 'utf-8')) {
return \preg_split('//u', $sString, -1, PREG_SPLIT_NO_EMPTY);
} else {
Expand Down Expand Up @@ -516,7 +516,7 @@ private function strsplit($sString)
*/
private function strpos($sString, $sNeedle, $iOffset)
{
if ($this->oParserSettings->bMultibyteSupport) {
if ($this->parserSettings->bMultibyteSupport) {
return \mb_strpos($sString, $sNeedle, $iOffset, $this->sCharset);
} else {
return \strpos($sString, $sNeedle, $iOffset);
Expand Down