@@ -4426,11 +4426,10 @@ private function internalParseFormula(string $formula, ?Cell $cell = null): bool
4426
4426
if (ctype_digit ($ val ) && $ val <= 1048576 ) {
4427
4427
// Row range
4428
4428
$ stackItemType = 'Row Reference ' ;
4429
- /** @var int $valx */
4430
4429
$ valx = $ val ;
4431
4430
$ endRowColRef = ($ refSheet !== null ) ? $ refSheet ->getHighestDataColumn ($ valx ) : AddressRange::MAX_COLUMN ; // Max 16,384 columns for Excel2007
4432
4431
$ val = "{$ rangeWS2 }{$ endRowColRef }{$ val }" ;
4433
- } elseif (ctype_alpha ($ val ) && is_string ( $ val ) && strlen ($ val ) <= 3 ) {
4432
+ } elseif (ctype_alpha ($ val ) && strlen ($ val ) <= 3 ) {
4434
4433
// Column range
4435
4434
$ stackItemType = 'Column Reference ' ;
4436
4435
$ endRowColRef = ($ refSheet !== null ) ? $ refSheet ->getHighestDataRow ($ val ) : AddressRange::MAX_ROW ; // Max 1,048,576 rows for Excel2007
@@ -4564,7 +4563,7 @@ private function internalParseFormula(string $formula, ?Cell $cell = null): bool
4564
4563
4565
4564
while (($ op = $ stack ->pop ()) !== null ) {
4566
4565
// pop everything off the stack and push onto output
4567
- if (( is_array ( $ op) && $ op ['value ' ] == '( ' ) ) {
4566
+ if ($ op ['value ' ] == '( ' ) {
4568
4567
return $ this ->raiseFormulaError ("Formula Error: Expecting ')' " ); // if there are any opening braces on the stack, then braces were unbalanced
4569
4568
}
4570
4569
$ output [] = $ op ;
@@ -4821,7 +4820,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
4821
4820
if ($ breakNeeded ) {
4822
4821
break ;
4823
4822
}
4824
- $ cellRef = Coordinate::stringFromColumnIndex (min ($ oCol ) + 1 ) . min ($ oRow ) . ': ' . Coordinate::stringFromColumnIndex (max ($ oCol ) + 1 ) . max ($ oRow );
4823
+ $ cellRef = Coordinate::stringFromColumnIndex (min ($ oCol ) + 1 ) . min ($ oRow ) . ': ' . Coordinate::stringFromColumnIndex (max ($ oCol ) + 1 ) . max ($ oRow ); // @phpstan-ignore-line
4825
4824
if ($ pCellParent !== null && $ this ->spreadsheet !== null ) {
4826
4825
$ cellValue = $ this ->extractCellRange ($ cellRef , $ this ->spreadsheet ->getSheetByName ($ sheet1 ), false );
4827
4826
} else {
@@ -4919,8 +4918,8 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
4919
4918
$ this ->debugLog ->writeDebugLog ('Evaluation Result is %s ' , $ this ->showTypeDetails ($ cellIntersect ));
4920
4919
$ stack ->push ('Error ' , ExcelError::null (), null );
4921
4920
} else {
4922
- $ cellRef = Coordinate::stringFromColumnIndex (min ($ oCol ) + 1 ) . min ($ oRow ) . ': '
4923
- . Coordinate::stringFromColumnIndex (max ($ oCol ) + 1 ) . max ($ oRow );
4921
+ $ cellRef = Coordinate::stringFromColumnIndex (min ($ oCol ) + 1 ) . min ($ oRow ) . ': ' // @phpstan-ignore-line
4922
+ . Coordinate::stringFromColumnIndex (max ($ oCol ) + 1 ) . max ($ oRow ); // @phpstan-ignore-line
4924
4923
$ this ->debugLog ->writeDebugLog ('Evaluation Result is %s ' , $ this ->showTypeDetails ($ cellIntersect ));
4925
4924
$ stack ->push ('Value ' , $ cellIntersect , $ cellRef );
4926
4925
}
@@ -5060,6 +5059,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
5060
5059
}
5061
5060
5062
5061
$ functionName = $ matches [1 ];
5062
+ /** @var array $argCount */
5063
5063
$ argCount = $ stack ->pop ();
5064
5064
$ argCount = $ argCount ['value ' ];
5065
5065
if ($ functionName !== 'MKMATRIX ' ) {
@@ -5090,9 +5090,10 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
5090
5090
&& (isset (self ::$ phpSpreadsheetFunctions [$ functionName ]['passByReference ' ][$ a ]))
5091
5091
&& (self ::$ phpSpreadsheetFunctions [$ functionName ]['passByReference ' ][$ a ])
5092
5092
) {
5093
+ /** @var array $arg */
5093
5094
if ($ arg ['reference ' ] === null ) {
5094
5095
$ nextArg = $ cellID ;
5095
- if ($ functionName === 'ISREF ' && is_array ( $ arg ) && ($ arg ['type ' ] ?? '' ) === 'Value ' ) {
5096
+ if ($ functionName === 'ISREF ' && ($ arg ['type ' ] ?? '' ) === 'Value ' ) {
5096
5097
if (array_key_exists ('value ' , $ arg )) {
5097
5098
$ argValue = $ arg ['value ' ];
5098
5099
if (is_scalar ($ argValue )) {
@@ -5113,6 +5114,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
5113
5114
}
5114
5115
}
5115
5116
} else {
5117
+ /** @var array $arg */
5116
5118
if ($ arg ['type ' ] === 'Empty Argument ' && in_array ($ functionName , ['MIN ' , 'MINA ' , 'MAX ' , 'MAXA ' , 'IF ' ], true )) {
5117
5119
$ emptyArguments [] = false ;
5118
5120
$ args [] = $ arg ['value ' ] = 0 ;
@@ -5235,6 +5237,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
5235
5237
if ($ stack ->count () != 1 ) {
5236
5238
return $ this ->raiseFormulaError ('internal error ' );
5237
5239
}
5240
+ /** @var array $output */
5238
5241
$ output = $ stack ->pop ();
5239
5242
$ output = $ output ['value ' ];
5240
5243
@@ -5287,6 +5290,7 @@ private function executeArrayComparison(mixed $operand1, mixed $operand2, string
5287
5290
foreach ($ operand1 as $ x => $ operandData ) {
5288
5291
$ this ->debugLog ->writeDebugLog ('Evaluating Comparison %s %s %s ' , $ this ->showValue ($ operandData ), $ operation , $ this ->showValue ($ operand2 ));
5289
5292
$ this ->executeBinaryComparisonOperation ($ operandData , $ operand2 , $ operation , $ stack );
5293
+ /** @var array $r */
5290
5294
$ r = $ stack ->pop ();
5291
5295
$ result [$ x ] = $ r ['value ' ];
5292
5296
}
@@ -5295,6 +5299,7 @@ private function executeArrayComparison(mixed $operand1, mixed $operand2, string
5295
5299
foreach ($ operand2 as $ x => $ operandData ) {
5296
5300
$ this ->debugLog ->writeDebugLog ('Evaluating Comparison %s %s %s ' , $ this ->showValue ($ operand1 ), $ operation , $ this ->showValue ($ operandData ));
5297
5301
$ this ->executeBinaryComparisonOperation ($ operand1 , $ operandData , $ operation , $ stack );
5302
+ /** @var array $r */
5298
5303
$ r = $ stack ->pop ();
5299
5304
$ result [$ x ] = $ r ['value ' ];
5300
5305
}
@@ -5306,6 +5311,7 @@ private function executeArrayComparison(mixed $operand1, mixed $operand2, string
5306
5311
foreach ($ operand1 as $ x => $ operandData ) {
5307
5312
$ this ->debugLog ->writeDebugLog ('Evaluating Comparison %s %s %s ' , $ this ->showValue ($ operandData ), $ operation , $ this ->showValue ($ operand2 [$ x ]));
5308
5313
$ this ->executeBinaryComparisonOperation ($ operandData , $ operand2 [$ x ], $ operation , $ stack , true );
5314
+ /** @var array $r */
5309
5315
$ r = $ stack ->pop ();
5310
5316
$ result [$ x ] = $ r ['value ' ];
5311
5317
}
0 commit comments