Fix PHPStan errors

This commit is contained in:
Adrien Crivelli
2023-09-21 11:13:50 +08:00
parent 7079e58054
commit 2da85155bd
2 changed files with 6 additions and 29 deletions
+1 -16
View File
@@ -7,22 +7,7 @@ parameters:
-
message: "#^Cannot call method getTokenType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#"
count: 9
path: src/PhpSpreadsheet/Calculation/FormulaParser.php
-
message: "#^Cannot call method setTokenSubType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#"
count: 5
path: src/PhpSpreadsheet/Calculation/FormulaParser.php
-
message: "#^Cannot call method setValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#"
count: 5
path: src/PhpSpreadsheet/Calculation/FormulaParser.php
-
message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken and null will always evaluate to false\\.$#"
count: 1
count: 8
path: src/PhpSpreadsheet/Calculation/FormulaParser.php
-
@@ -299,6 +299,7 @@ class FormulaParser
$value = '';
}
/** @var FormulaToken $tmp */
$tmp = array_pop($stack);
$tmp->setValue('');
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
@@ -322,11 +323,13 @@ class FormulaParser
$value = '';
}
/** @var FormulaToken $tmp */
$tmp = array_pop($stack);
$tmp->setValue('');
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
$tokens1[] = $tmp;
/** @var FormulaToken $tmp */
$tmp = array_pop($stack);
$tmp->setValue('');
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
@@ -414,6 +417,7 @@ class FormulaParser
$value = '';
}
/** @var FormulaToken $tmp */
$tmp = array_pop($stack);
$tmp->setValue('');
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
@@ -436,6 +440,7 @@ class FormulaParser
$value = '';
}
/** @var FormulaToken $tmp */
$tmp = array_pop($stack);
$tmp->setValue('');
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
@@ -471,10 +476,6 @@ class FormulaParser
$nextToken = null;
}
if ($token === null) {
continue;
}
if ($token->getTokenType() != FormulaToken::TOKEN_TYPE_WHITESPACE) {
$tokens2[] = $token;
@@ -524,15 +525,6 @@ class FormulaParser
} else {
$previousToken = null;
}
//if (isset($tokens2[$i + 1])) {
// $nextToken = $tokens2[$i + 1];
//} else {
// $nextToken = null;
//}
if ($token === null) {
continue;
}
if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == '-') {
if ($i == 0) {