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
6 changes: 3 additions & 3 deletions src/OutputFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ public function get(string $sName)

/**
* @param array<array-key, string>|string $aNames
* @param mixed $mValue
* @param mixed $value
*
* @return self|false
*/
public function set($aNames, $mValue)
public function set($aNames, $value)
{
$aVarPrefixes = ['a', 's', 'm', 'b', 'f', 'o', 'c', 'i'];
if (\is_string($aNames) && \strpos($aNames, '*') !== false) {
Expand All @@ -221,7 +221,7 @@ public function set($aNames, $mValue)
foreach ($aNames as $sName) {
$sFieldName = $prefix . \ucfirst($sName);
if (isset($this->$sFieldName)) {
$this->$sFieldName = $mValue;
$this->$sFieldName = $value;
$bDidReplace = true;
}
}
Expand Down
26 changes: 13 additions & 13 deletions src/Parsing/ParserState.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,35 +251,35 @@ public function peek($length = 1, $offset = 0): string
}

/**
* @param int $mValue
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the type here should be int|string, but that's beyond the scope of this PR.

* @param int $value
*
* @throws UnexpectedEOFException
* @throws UnexpectedTokenException
*/
public function consume($mValue = 1): string
public function consume($value = 1): string
{
if (\is_string($mValue)) {
$iLineCount = \substr_count($mValue, "\n");
$length = $this->strlen($mValue);
if (!$this->streql($this->substr($this->currentPosition, $length), $mValue)) {
if (\is_string($value)) {
$iLineCount = \substr_count($value, "\n");
$length = $this->strlen($value);
if (!$this->streql($this->substr($this->currentPosition, $length), $value)) {
throw new UnexpectedTokenException(
$mValue,
$value,
$this->peek(\max($length, 5)),
'literal',
$this->lineNumber
);
}
$this->lineNumber += $iLineCount;
$this->currentPosition += $this->strlen($mValue);
return $mValue;
$this->currentPosition += $this->strlen($value);
return $value;
} else {
if ($this->currentPosition + $mValue > \count($this->characters)) {
throw new UnexpectedEOFException((string) $mValue, $this->peek(5), 'count', $this->lineNumber);
if ($this->currentPosition + $value > \count($this->characters)) {
throw new UnexpectedEOFException((string) $value, $this->peek(5), 'count', $this->lineNumber);
}
$result = $this->substr($this->currentPosition, $mValue);
$result = $this->substr($this->currentPosition, $value);
$iLineCount = \substr_count($result, "\n");
$this->lineNumber += $iLineCount;
$this->currentPosition += $mValue;
$this->currentPosition += $value;
return $result;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Rule/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ public function getValue()
}

/**
* @param RuleValueList|string|null $mValue
* @param RuleValueList|string|null $value
*/
public function setValue($mValue): void
public function setValue($value): void
{
$this->value = $mValue;
$this->value = $value;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Value/CalcFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public static function parse(ParserState $parserState, bool $ignoreCase = false)
continue;
}
if ($lastComponentType != CalcFunction::T_OPERAND) {
$oVal = Value::parsePrimitiveValue($parserState);
$calcRuleValueList->addListComponent($oVal);
$value = Value::parsePrimitiveValue($parserState);
$calcRuleValueList->addListComponent($value);
$lastComponentType = CalcFunction::T_OPERAND;
} else {
if (\in_array($parserState->peek(), $operators, true)) {
Expand Down