Skip to content
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
14 changes: 7 additions & 7 deletions src/CSSList/AtRuleBlockList.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ public function __toString(): string

public function render(OutputFormat $outputFormat): string
{
$sResult = $outputFormat->comments($this);
$sResult .= $outputFormat->sBeforeAtRuleBlock;
$result = $outputFormat->comments($this);
$result .= $outputFormat->sBeforeAtRuleBlock;
$arguments = $this->arguments;
if ($arguments) {
$arguments = ' ' . $arguments;
}
$sResult .= "@{$this->type}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{";
$sResult .= $this->renderListContents($outputFormat);
$sResult .= '}';
$sResult .= $outputFormat->sAfterAtRuleBlock;
return $sResult;
$result .= "@{$this->type}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{";
$result .= $this->renderListContents($outputFormat);
$result .= '}';
$result .= $outputFormat->sAfterAtRuleBlock;
return $result;
}

public function isRootList(): bool
Expand Down
32 changes: 16 additions & 16 deletions src/CSSList/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public static function parse(ParserState $parserState): Document
*/
public function getAllDeclarationBlocks(): array
{
/** @var array<int, DeclarationBlock> $aResult */
$aResult = [];
$this->allDeclarationBlocks($aResult);
return $aResult;
/** @var array<int, DeclarationBlock> $result */
$result = [];
$this->allDeclarationBlocks($result);
return $result;
}

/**
Expand All @@ -59,10 +59,10 @@ public function getAllDeclarationBlocks(): array
*/
public function getAllRuleSets(): array
{
/** @var array<int, RuleSet> $aResult */
$aResult = [];
$this->allRuleSets($aResult);
return $aResult;
/** @var array<int, RuleSet> $result */
$result = [];
$this->allRuleSets($result);
return $result;
}

/**
Expand All @@ -86,10 +86,10 @@ public function getAllValues($element = null, $bSearchInFunctionArguments = fals
$sSearchString = $element;
$element = $this;
}
/** @var array<int, Value> $aResult */
$aResult = [];
$this->allValues($element, $aResult, $sSearchString, $bSearchInFunctionArguments);
return $aResult;
/** @var array<int, Value> $result */
$result = [];
$this->allValues($element, $result, $sSearchString, $bSearchInFunctionArguments);
return $result;
}

/**
Expand All @@ -107,10 +107,10 @@ public function getAllValues($element = null, $bSearchInFunctionArguments = fals
*/
public function getSelectorsBySpecificity($sSpecificitySearch = null): array
{
/** @var array<int, Selector> $aResult */
$aResult = [];
$this->allSelectors($aResult, $sSpecificitySearch);
return $aResult;
/** @var array<int, Selector> $result */
$result = [];
$this->allSelectors($result, $sSpecificitySearch);
return $result;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/CSSList/KeyFrame.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ public function __toString(): string

public function render(OutputFormat $outputFormat): string
{
$sResult = $outputFormat->comments($this);
$sResult .= "@{$this->vendorKeyFrame} {$this->animationName}{$outputFormat->spaceBeforeOpeningBrace()}{";
$sResult .= $this->renderListContents($outputFormat);
$sResult .= '}';
return $sResult;
$result = $outputFormat->comments($this);
$result .= "@{$this->vendorKeyFrame} {$this->animationName}{$outputFormat->spaceBeforeOpeningBrace()}{";
$result .= $this->renderListContents($outputFormat);
$result .= '}';
return $result;
}

public function isRootList(): bool
Expand Down
18 changes: 9 additions & 9 deletions src/OutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function safely($cCode)
*/
public function implode(string $sSeparator, array $aValues, $bIncreaseLevel = false): string
{
$sResult = '';
$result = '';
$oFormat = $this->oFormat;
if ($bIncreaseLevel) {
$oFormat = $oFormat->nextLevel();
Expand All @@ -151,15 +151,15 @@ public function implode(string $sSeparator, array $aValues, $bIncreaseLevel = fa
if ($bIsFirst) {
$bIsFirst = false;
} else {
$sResult .= $sSeparator;
$result .= $sSeparator;
}
if ($mValue instanceof Renderable) {
$sResult .= $mValue->render($oFormat);
$result .= $mValue->render($oFormat);
} else {
$sResult .= $mValue;
$result .= $mValue;
}
}
return $sResult;
return $result;
}

/**
Expand Down Expand Up @@ -188,15 +188,15 @@ public function comments(Commentable $oCommentable): string
return '';
}

$sResult = '';
$result = '';
$comments = $oCommentable->getComments();
$iLastCommentIndex = \count($comments) - 1;

foreach ($comments as $i => $oComment) {
$sResult .= $oComment->render($this->oFormat);
$sResult .= $i === $iLastCommentIndex ? $this->spaceAfterBlocks() : $this->spaceBetweenBlocks();
$result .= $oComment->render($this->oFormat);
$result .= $i === $iLastCommentIndex ? $this->spaceAfterBlocks() : $this->spaceBetweenBlocks();
}
return $sResult;
return $result;
}

/**
Expand Down
30 changes: 15 additions & 15 deletions src/Parsing/ParserState.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,22 @@ public function parseIdentifier($bIgnoreCase = true)
if ($this->isEnd()) {
throw new UnexpectedEOFException('', '', 'identifier', $this->lineNumber);
}
$sResult = $this->parseCharacter(true);
if ($sResult === null) {
$result = $this->parseCharacter(true);
if ($result === null) {
throw new UnexpectedTokenException('', $this->peek(5), 'identifier', $this->lineNumber);
}
$sCharacter = null;
while (!$this->isEnd() && ($sCharacter = $this->parseCharacter(true)) !== null) {
if (\preg_match('/[a-zA-Z0-9\\x{00A0}-\\x{FFFF}_-]/Sux', $sCharacter)) {
$sResult .= $sCharacter;
$result .= $sCharacter;
} else {
$sResult .= '\\' . $sCharacter;
$result .= '\\' . $sCharacter;
}
}
if ($bIgnoreCase) {
$sResult = $this->strtolower($sResult);
$result = $this->strtolower($result);
}
return $sResult;
return $result;
}

/**
Expand Down Expand Up @@ -308,11 +308,11 @@ public function consume($mValue = 1): string
if ($this->iCurrentPosition + $mValue > $this->iLength) {
throw new UnexpectedEOFException((string) $mValue, $this->peek(5), 'count', $this->lineNumber);
}
$sResult = $this->substr($this->iCurrentPosition, $mValue);
$iLineCount = \substr_count($sResult, "\n");
$result = $this->substr($this->iCurrentPosition, $mValue);
$iLineCount = \substr_count($result, "\n");
$this->lineNumber += $iLineCount;
$this->iCurrentPosition += $mValue;
return $sResult;
return $result;
}
}

Expand Down Expand Up @@ -460,13 +460,13 @@ private function substr($iStart, $iLength): string
if ($iStart + $iLength > $this->iLength) {
$iLength = $this->iLength - $iStart;
}
$sResult = '';
$result = '';
while ($iLength > 0) {
$sResult .= $this->aText[$iStart];
$result .= $this->aText[$iStart];
$iStart++;
$iLength--;
}
return $sResult;
return $result;
}

/**
Expand All @@ -493,11 +493,11 @@ private function strsplit($sString)
return \preg_split('//u', $sString, -1, PREG_SPLIT_NO_EMPTY);
} else {
$iLength = \mb_strlen($sString, $this->sCharset);
$aResult = [];
$result = [];
for ($i = 0; $i < $iLength; ++$i) {
$aResult[] = \mb_substr($sString, $i, 1, $this->sCharset);
$result[] = \mb_substr($sString, $i, 1, $this->sCharset);
}
return $aResult;
return $result;
}
} else {
if ($sString === '') {
Expand Down
6 changes: 3 additions & 3 deletions src/Property/CSSNamespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ public function atRuleName(): string
*/
public function atRuleArgs(): array
{
$aResult = [$this->mUrl];
$result = [$this->mUrl];
if ($this->sPrefix) {
\array_unshift($aResult, $this->sPrefix);
\array_unshift($result, $this->sPrefix);
}
return $aResult;
return $result;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Property/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ public function atRuleName(): string
*/
public function atRuleArgs(): array
{
$aResult = [$this->location];
$result = [$this->location];
if ($this->mediaQuery) {
\array_push($aResult, $this->mediaQuery);
\array_push($result, $this->mediaQuery);
}
return $aResult;
return $result;
}

/**
Expand Down
14 changes: 7 additions & 7 deletions src/Rule/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,20 +271,20 @@ public function __toString(): string

public function render(OutputFormat $outputFormat): string
{
$sResult = "{$outputFormat->comments($this)}{$this->sRule}:{$outputFormat->spaceAfterRuleName()}";
$result = "{$outputFormat->comments($this)}{$this->sRule}:{$outputFormat->spaceAfterRuleName()}";
if ($this->mValue instanceof Value) { // Can also be a ValueList
$sResult .= $this->mValue->render($outputFormat);
$result .= $this->mValue->render($outputFormat);
} else {
$sResult .= $this->mValue;
$result .= $this->mValue;
}
if (!empty($this->aIeHack)) {
$sResult .= ' \\' . \implode('\\', $this->aIeHack);
$result .= ' \\' . \implode('\\', $this->aIeHack);
}
if ($this->bIsImportant) {
$sResult .= ' !important';
$result .= ' !important';
}
$sResult .= ';';
return $sResult;
$result .= ';';
return $result;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/RuleSet/AtRuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ public function __toString(): string

public function render(OutputFormat $outputFormat): string
{
$sResult = $outputFormat->comments($this);
$result = $outputFormat->comments($this);
$arguments = $this->arguments;
if ($arguments) {
$arguments = ' ' . $arguments;
}
$sResult .= "@{$this->sType}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{";
$sResult .= $this->renderRules($outputFormat);
$sResult .= '}';
return $sResult;
$result .= "@{$this->sType}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{";
$result .= $this->renderRules($outputFormat);
$result .= '}';
return $result;
}
}
18 changes: 9 additions & 9 deletions src/RuleSet/DeclarationBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,21 @@ public function __toString(): string
*/
public function render(OutputFormat $outputFormat): string
{
$sResult = $outputFormat->comments($this);
$result = $outputFormat->comments($this);
if (\count($this->aSelectors) === 0) {
// If all the selectors have been removed, this declaration block becomes invalid
throw new OutputException('Attempt to print declaration block with missing selector', $this->lineNumber);
}
$sResult .= $outputFormat->sBeforeDeclarationBlock;
$sResult .= $outputFormat->implode(
$result .= $outputFormat->sBeforeDeclarationBlock;
$result .= $outputFormat->implode(
$outputFormat->spaceBeforeSelectorSeparator() . ',' . $outputFormat->spaceAfterSelectorSeparator(),
$this->aSelectors
);
$sResult .= $outputFormat->sAfterDeclarationBlockSelectors;
$sResult .= $outputFormat->spaceBeforeOpeningBrace() . '{';
$sResult .= $this->renderRules($outputFormat);
$sResult .= '}';
$sResult .= $outputFormat->sAfterDeclarationBlock;
return $sResult;
$result .= $outputFormat->sAfterDeclarationBlockSelectors;
$result .= $outputFormat->spaceBeforeOpeningBrace() . '{';
$result .= $this->renderRules($outputFormat);
$result .= '}';
$result .= $outputFormat->sAfterDeclarationBlock;
return $result;
}
}
Loading