Skip to content

Commit 2da8515

Browse files
committed
Fix PHPStan errors
1 parent 7079e58 commit 2da8515

File tree

2 files changed

+6
-29
lines changed

2 files changed

+6
-29
lines changed

phpstan-baseline.neon

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,7 @@ parameters:
77

88
-
99
message: "#^Cannot call method getTokenType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#"
10-
count: 9
11-
path: src/PhpSpreadsheet/Calculation/FormulaParser.php
12-
13-
-
14-
message: "#^Cannot call method setTokenSubType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#"
15-
count: 5
16-
path: src/PhpSpreadsheet/Calculation/FormulaParser.php
17-
18-
-
19-
message: "#^Cannot call method setValue\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#"
20-
count: 5
21-
path: src/PhpSpreadsheet/Calculation/FormulaParser.php
22-
23-
-
24-
message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken and null will always evaluate to false\\.$#"
25-
count: 1
10+
count: 8
2611
path: src/PhpSpreadsheet/Calculation/FormulaParser.php
2712

2813
-

src/PhpSpreadsheet/Calculation/FormulaParser.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ private function parseToTokens(): void
299299
$value = '';
300300
}
301301

302+
/** @var FormulaToken $tmp */
302303
$tmp = array_pop($stack);
303304
$tmp->setValue('');
304305
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
@@ -322,11 +323,13 @@ private function parseToTokens(): void
322323
$value = '';
323324
}
324325

326+
/** @var FormulaToken $tmp */
325327
$tmp = array_pop($stack);
326328
$tmp->setValue('');
327329
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
328330
$tokens1[] = $tmp;
329331

332+
/** @var FormulaToken $tmp */
330333
$tmp = array_pop($stack);
331334
$tmp->setValue('');
332335
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
@@ -414,6 +417,7 @@ private function parseToTokens(): void
414417
$value = '';
415418
}
416419

420+
/** @var FormulaToken $tmp */
417421
$tmp = array_pop($stack);
418422
$tmp->setValue('');
419423
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
@@ -436,6 +440,7 @@ private function parseToTokens(): void
436440
$value = '';
437441
}
438442

443+
/** @var FormulaToken $tmp */
439444
$tmp = array_pop($stack);
440445
$tmp->setValue('');
441446
$tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP);
@@ -471,10 +476,6 @@ private function parseToTokens(): void
471476
$nextToken = null;
472477
}
473478

474-
if ($token === null) {
475-
continue;
476-
}
477-
478479
if ($token->getTokenType() != FormulaToken::TOKEN_TYPE_WHITESPACE) {
479480
$tokens2[] = $token;
480481

@@ -524,15 +525,6 @@ private function parseToTokens(): void
524525
} else {
525526
$previousToken = null;
526527
}
527-
//if (isset($tokens2[$i + 1])) {
528-
// $nextToken = $tokens2[$i + 1];
529-
//} else {
530-
// $nextToken = null;
531-
//}
532-
533-
if ($token === null) {
534-
continue;
535-
}
536528

537529
if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == '-') {
538530
if ($i == 0) {

0 commit comments

Comments
 (0)