Skip to content

Commit

Permalink
Anticipate Dependabot (#3805)
Browse files Browse the repository at this point in the history
These changes will be suggested tomorrow. It's better to take care of them in advance.
  • Loading branch information
oleibman authored Nov 30, 2023
1 parent 5a60ba4 commit 7fbf5c4
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 89 deletions.
92 changes: 46 additions & 46 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 0 additions & 25 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
parameters:
ignoreErrors:
-
message: "#^Cannot call method getTokenSubType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#"
count: 4
path: src/PhpSpreadsheet/Calculation/FormulaParser.php

-
message: "#^Cannot call method getTokenType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#"
count: 8
path: src/PhpSpreadsheet/Calculation/FormulaParser.php

-
message: "#^Binary operation \"/\" between float and array\\|float\\|int\\|string results in an error\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php

-
message: "#^Offset 2 does not exist on array\\{int, int, int, int\\}\\|array\\{int, int\\}\\.$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/Validations.php

-
message: "#^Offset 3 does not exist on array\\{int, int, int, int\\}\\|array\\{int, int\\}\\.$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/Validations.php

-
message: "#^Parameter \\#2 \\$value of function ini_set expects string, int given\\.$#"
count: 1
path: tests/bootstrap.php
2 changes: 1 addition & 1 deletion src/PhpSpreadsheet/Calculation/Calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4715,7 +4715,7 @@ private function processTokenStack(mixed $tokens, $cellID = null, ?Cell $cell =
if (($operand2Data = $stack->pop()) === null) {
return $this->raiseFormulaError('Internal error - Operand value missing from stack');
}
if (($operand1Data = $stack->pop()) === null) {
if (($operand1Data = $stack->pop()) === null) { // @phpstan-ignore-line
return $this->raiseFormulaError('Internal error - Operand value missing from stack');
}

Expand Down
24 changes: 12 additions & 12 deletions src/PhpSpreadsheet/Calculation/FormulaParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,12 +530,12 @@ private function parseToTokens(): void
if ($i == 0) {
$token->setTokenType(FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
} elseif (
(($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION)
&& ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP))
|| (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION)
&& ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP))
|| ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX)
|| ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)
(($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION)
&& ($previousToken?->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP))
|| (($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION)
&& ($previousToken?->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP))
|| ($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX)
|| ($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)
) {
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH);
} else {
Expand All @@ -551,12 +551,12 @@ private function parseToTokens(): void
if ($i == 0) {
continue;
} elseif (
(($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION)
&& ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP))
|| (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION)
&& ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP))
|| ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX)
|| ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)
(($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION)
&& ($previousToken?->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP))
|| (($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION)
&& ($previousToken?->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP))
|| ($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX)
|| ($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)
) {
$token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH);
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/PhpSpreadsheet/Worksheet/Validations.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ public static function validateCellRange(AddressRange|array|string $cellRange):

if (is_array($cellRange)) {
switch (count($cellRange)) {
case 2:
case 4:
$from = [$cellRange[0], $cellRange[1]];
$to = [$cellRange[0], $cellRange[1]];
$to = [$cellRange[2], $cellRange[3]];

break;
case 4:
case 2:
$from = [$cellRange[0], $cellRange[1]];
$to = [$cellRange[2], $cellRange[3]];
$to = [$cellRange[0], $cellRange[1]];

break;
default:
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ function phpunit10ErrorHandler(int $errno, string $errstr, string $filename, int
}

if (!method_exists(\PHPUnit\Framework\TestCase::class, 'setOutputCallback')) {
ini_set('error_reporting', E_ALL);
ini_set('error_reporting', (string) E_ALL);
set_error_handler('phpunit10ErrorHandler');
}

0 comments on commit 7fbf5c4

Please sign in to comment.