Skip to content

Commit

Permalink
[CLEANUP] Avoid Hungarian notation for iLineNo (#833)
Browse files Browse the repository at this point in the history
Part of #756
  • Loading branch information
oliverklee authored Jan 27, 2025
1 parent 98e4204 commit 61aea73
Show file tree
Hide file tree
Showing 25 changed files with 113 additions and 113 deletions.
10 changes: 5 additions & 5 deletions src/CSSList/CSSList.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ abstract class CSSList implements Renderable, Commentable
/**
* @var int
*/
protected $iLineNo;
protected $lineNumber;

/**
* @param int $iLineNo
* @param int $lineNumber
*/
public function __construct($iLineNo = 0)
public function __construct($lineNumber = 0)
{
$this->comments = [];
$this->aContents = [];
$this->iLineNo = $iLineNo;
$this->lineNumber = $lineNumber;
}

/**
Expand Down Expand Up @@ -255,7 +255,7 @@ private static function identifierIs($sIdentifier, string $sMatch): bool
*/
public function getLineNo()
{
return $this->iLineNo;
return $this->lineNumber;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/CSSList/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
class Document extends CSSBlockList
{
/**
* @param int $iLineNo
* @param int $lineNumber
*/
public function __construct($iLineNo = 0)
public function __construct($lineNumber = 0)
{
parent::__construct($iLineNo);
parent::__construct($lineNumber);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/CSSList/KeyFrame.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class KeyFrame extends CSSList implements AtRule
private $animationName;

/**
* @param int $iLineNo
* @param int $lineNumber
*/
public function __construct($iLineNo = 0)
public function __construct($lineNumber = 0)
{
parent::__construct($iLineNo);
parent::__construct($lineNumber);
$this->vendorKeyFrame = null;
$this->animationName = null;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ class Parser
/**
* @param string $sText the complete CSS as text (i.e., usually the contents of a CSS file)
* @param Settings|null $oParserSettings
* @param int $iLineNo the line number (starting from 1, not from 0)
* @param int $lineNumber the line number (starting from 1, not from 0)
*/
public function __construct($sText, ?Settings $oParserSettings = null, $iLineNo = 1)
public function __construct($sText, ?Settings $oParserSettings = null, $lineNumber = 1)
{
if ($oParserSettings === null) {
$oParserSettings = Settings::create();
}
$this->oParserState = new ParserState($sText, $oParserSettings, $iLineNo);
$this->oParserState = new ParserState($sText, $oParserSettings, $lineNumber);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Parsing/OutputException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ final class OutputException extends SourceException
{
/**
* @param string $sMessage
* @param int $iLineNo
* @param int $lineNumber
*/
public function __construct($sMessage, $iLineNo = 0)
public function __construct($sMessage, $lineNumber = 0)
{
parent::__construct($sMessage, $iLineNo);
parent::__construct($sMessage, $lineNumber);
}
}
30 changes: 15 additions & 15 deletions src/Parsing/ParserState.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ class ParserState
/**
* @var int
*/
private $iLineNo;
private $lineNumber;

/**
* @param string $sText the complete CSS as text (i.e., usually the contents of a CSS file)
* @param int $iLineNo
* @param int $lineNumber
*/
public function __construct($sText, Settings $oParserSettings, $iLineNo = 1)
public function __construct($sText, Settings $oParserSettings, $lineNumber = 1)
{
$this->oParserSettings = $oParserSettings;
$this->sText = $sText;
$this->iCurrentPosition = 0;
$this->iLineNo = $iLineNo;
$this->lineNumber = $lineNumber;
$this->setCharset($this->oParserSettings->sDefaultCharset);
}

Expand Down Expand Up @@ -98,7 +98,7 @@ public function getCharset()
*/
public function currentLine()
{
return $this->iLineNo;
return $this->lineNumber;
}

/**
Expand Down Expand Up @@ -140,11 +140,11 @@ public function setPosition($iPosition): void
public function parseIdentifier($bIgnoreCase = true)
{
if ($this->isEnd()) {
throw new UnexpectedEOFException('', '', 'identifier', $this->iLineNo);
throw new UnexpectedEOFException('', '', 'identifier', $this->lineNumber);
}
$sResult = $this->parseCharacter(true);
if ($sResult === null) {
throw new UnexpectedTokenException($sResult, $this->peek(5), 'identifier', $this->iLineNo);
throw new UnexpectedTokenException($sResult, $this->peek(5), 'identifier', $this->lineNumber);
}
$sCharacter = null;
while (!$this->isEnd() && ($sCharacter = $this->parseCharacter(true)) !== null) {
Expand Down Expand Up @@ -290,18 +290,18 @@ public function consume($mValue = 1): string
$iLineCount = \substr_count($mValue, "\n");
$iLength = $this->strlen($mValue);
if (!$this->streql($this->substr($this->iCurrentPosition, $iLength), $mValue)) {
throw new UnexpectedTokenException($mValue, $this->peek(\max($iLength, 5)), $this->iLineNo);
throw new UnexpectedTokenException($mValue, $this->peek(\max($iLength, 5)), $this->lineNumber);
}
$this->iLineNo += $iLineCount;
$this->lineNumber += $iLineCount;
$this->iCurrentPosition += $this->strlen($mValue);
return $mValue;
} else {
if ($this->iCurrentPosition + $mValue > $this->iLength) {
throw new UnexpectedEOFException($mValue, $this->peek(5), 'count', $this->iLineNo);
throw new UnexpectedEOFException($mValue, $this->peek(5), 'count', $this->lineNumber);
}
$sResult = $this->substr($this->iCurrentPosition, $mValue);
$iLineCount = \substr_count($sResult, "\n");
$this->iLineNo += $iLineCount;
$this->lineNumber += $iLineCount;
$this->iCurrentPosition += $mValue;
return $sResult;
}
Expand All @@ -321,7 +321,7 @@ public function consumeExpression($mExpression, $iMaxLength = null): string
if (\preg_match($mExpression, $sInput, $aMatches, PREG_OFFSET_CAPTURE) === 1) {
return $this->consume($aMatches[0][0]);
}
throw new UnexpectedTokenException($mExpression, $this->peek(5), 'expression', $this->iLineNo);
throw new UnexpectedTokenException($mExpression, $this->peek(5), 'expression', $this->lineNumber);
}

/**
Expand All @@ -331,7 +331,7 @@ public function consumeComment()
{
$mComment = false;
if ($this->comes('/*')) {
$iLineNo = $this->iLineNo;
$lineNumber = $this->lineNumber;
$this->consume(1);
$mComment = '';
while (($char = $this->consume(1)) !== '') {
Expand All @@ -345,7 +345,7 @@ public function consumeComment()

if ($mComment !== false) {
// We skip the * which was included in the comment.
return new Comment(\substr($mComment, 1), $iLineNo);
return new Comment(\substr($mComment, 1), $lineNumber);
}

return $mComment;
Expand Down Expand Up @@ -396,7 +396,7 @@ public function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false, a
'One of ("' . \implode('","', $aEnd) . '")',
$this->peek(5),
'search',
$this->iLineNo
$this->lineNumber
);
}

Expand Down
14 changes: 7 additions & 7 deletions src/Parsing/SourceException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ class SourceException extends \Exception
/**
* @var int
*/
private $iLineNo;
private $lineNumber;

/**
* @param string $sMessage
* @param int $iLineNo
* @param int $lineNumber
*/
public function __construct($sMessage, $iLineNo = 0)
public function __construct($sMessage, $lineNumber = 0)
{
$this->iLineNo = $iLineNo;
if ($iLineNo !== 0) {
$sMessage .= " [line no: $iLineNo]";
$this->lineNumber = $lineNumber;
if ($lineNumber !== 0) {
$sMessage .= " [line no: $lineNumber]";
}
parent::__construct($sMessage);
}
Expand All @@ -29,6 +29,6 @@ public function __construct($sMessage, $iLineNo = 0)
*/
public function getLineNo()
{
return $this->iLineNo;
return $this->lineNumber;
}
}
6 changes: 3 additions & 3 deletions src/Parsing/UnexpectedTokenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class UnexpectedTokenException extends SourceException
* @param string $sExpected
* @param string $sFound
* @param string $sMatchType
* @param int $iLineNo
* @param int $lineNumber
*/
public function __construct($sExpected, $sFound, $sMatchType = 'literal', $iLineNo = 0)
public function __construct($sExpected, $sFound, $sMatchType = 'literal', $lineNumber = 0)
{
$this->sExpected = $sExpected;
$this->sFound = $sFound;
Expand All @@ -48,6 +48,6 @@ public function __construct($sExpected, $sFound, $sMatchType = 'literal', $iLine
$sMessage = \trim("$sExpected $sFound");
}

parent::__construct($sMessage, $iLineNo);
parent::__construct($sMessage, $lineNumber);
}
}
10 changes: 5 additions & 5 deletions src/Property/CSSNamespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CSSNamespace implements AtRule
/**
* @var int
*/
private $iLineNo;
private $lineNumber;

/**
* @var array<array-key, Comment>
Expand All @@ -35,13 +35,13 @@ class CSSNamespace implements AtRule
/**
* @param string $mUrl
* @param string|null $sPrefix
* @param int $iLineNo
* @param int $lineNumber
*/
public function __construct($mUrl, $sPrefix = null, $iLineNo = 0)
public function __construct($mUrl, $sPrefix = null, $lineNumber = 0)
{
$this->mUrl = $mUrl;
$this->sPrefix = $sPrefix;
$this->iLineNo = $iLineNo;
$this->lineNumber = $lineNumber;
$this->comments = [];
}

Expand All @@ -50,7 +50,7 @@ public function __construct($mUrl, $sPrefix = null, $iLineNo = 0)
*/
public function getLineNo()
{
return $this->iLineNo;
return $this->lineNumber;
}

public function __toString(): string
Expand Down
10 changes: 5 additions & 5 deletions src/Property/Charset.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Charset implements AtRule
/**
* @var int
*/
protected $iLineNo;
protected $lineNumber;

/**
* @var array<array-key, Comment>
Expand All @@ -35,12 +35,12 @@ class Charset implements AtRule

/**
* @param CSSString $oCharset
* @param int $iLineNo
* @param int $lineNumber
*/
public function __construct(CSSString $oCharset, $iLineNo = 0)
public function __construct(CSSString $oCharset, $lineNumber = 0)
{
$this->oCharset = $oCharset;
$this->iLineNo = $iLineNo;
$this->lineNumber = $lineNumber;
$this->comments = [];
}

Expand All @@ -49,7 +49,7 @@ public function __construct(CSSString $oCharset, $iLineNo = 0)
*/
public function getLineNo()
{
return $this->iLineNo;
return $this->lineNumber;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/Property/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Import implements AtRule
/**
* @var int
*/
protected $iLineNo;
protected $lineNumber;

/**
* @var array<array-key, Comment>
Expand All @@ -36,13 +36,13 @@ class Import implements AtRule
/**
* @param URL $oLocation
* @param string $sMediaQuery
* @param int $iLineNo
* @param int $lineNumber
*/
public function __construct(URL $oLocation, $sMediaQuery, $iLineNo = 0)
public function __construct(URL $oLocation, $sMediaQuery, $lineNumber = 0)
{
$this->oLocation = $oLocation;
$this->sMediaQuery = $sMediaQuery;
$this->iLineNo = $iLineNo;
$this->lineNumber = $lineNumber;
$this->comments = [];
}

Expand All @@ -51,7 +51,7 @@ public function __construct(URL $oLocation, $sMediaQuery, $iLineNo = 0)
*/
public function getLineNo()
{
return $this->iLineNo;
return $this->lineNumber;
}

/**
Expand Down
Loading

0 comments on commit 61aea73

Please sign in to comment.