@@ -4424,11 +4424,10 @@ private function internalParseFormula(string $formula, ?Cell $cell = null): bool
44244424 if (ctype_digit ($ val ) && $ val <= 1048576 ) {
44254425 // Row range
44264426 $ stackItemType = 'Row Reference ' ;
4427- /** @var int $valx */
44284427 $ valx = $ val ;
44294428 $ endRowColRef = ($ refSheet !== null ) ? $ refSheet ->getHighestDataColumn ($ valx ) : AddressRange::MAX_COLUMN ; // Max 16,384 columns for Excel2007
44304429 $ val = "{$ rangeWS2 }{$ endRowColRef }{$ val }" ;
4431- } elseif (ctype_alpha ($ val ) && is_string ( $ val ) && strlen ($ val ) <= 3 ) {
4430+ } elseif (ctype_alpha ($ val ) && strlen ($ val ) <= 3 ) {
44324431 // Column range
44334432 $ stackItemType = 'Column Reference ' ;
44344433 $ endRowColRef = ($ refSheet !== null ) ? $ refSheet ->getHighestDataRow ($ val ) : AddressRange::MAX_ROW ; // Max 1,048,576 rows for Excel2007
@@ -4562,7 +4561,7 @@ private function internalParseFormula(string $formula, ?Cell $cell = null): bool
45624561
45634562 while (($ op = $ stack ->pop ()) !== null ) {
45644563 // pop everything off the stack and push onto output
4565- if (( is_array ( $ op) && $ op ['value ' ] == '( ' ) ) {
4564+ if ($ op ['value ' ] == '( ' ) {
45664565 return $ this ->raiseFormulaError ("Formula Error: Expecting ')' " ); // if there are any opening braces on the stack, then braces were unbalanced
45674566 }
45684567 $ output [] = $ op ;
@@ -4819,7 +4818,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
48194818 if ($ breakNeeded ) {
48204819 break ;
48214820 }
4822- $ cellRef = Coordinate::stringFromColumnIndex (min ($ oCol ) + 1 ) . min ($ oRow ) . ': ' . Coordinate::stringFromColumnIndex (max ($ oCol ) + 1 ) . max ($ oRow );
4821+ $ cellRef = Coordinate::stringFromColumnIndex (min ($ oCol ) + 1 ) . min ($ oRow ) . ': ' . Coordinate::stringFromColumnIndex (max ($ oCol ) + 1 ) . max ($ oRow ); // @phpstan-ignore-line
48234822 if ($ pCellParent !== null && $ this ->spreadsheet !== null ) {
48244823 $ cellValue = $ this ->extractCellRange ($ cellRef , $ this ->spreadsheet ->getSheetByName ($ sheet1 ), false );
48254824 } else {
@@ -4917,8 +4916,8 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
49174916 $ this ->debugLog ->writeDebugLog ('Evaluation Result is %s ' , $ this ->showTypeDetails ($ cellIntersect ));
49184917 $ stack ->push ('Error ' , ExcelError::null (), null );
49194918 } else {
4920- $ cellRef = Coordinate::stringFromColumnIndex (min ($ oCol ) + 1 ) . min ($ oRow ) . ': '
4921- . Coordinate::stringFromColumnIndex (max ($ oCol ) + 1 ) . max ($ oRow );
4919+ $ cellRef = Coordinate::stringFromColumnIndex (min ($ oCol ) + 1 ) . min ($ oRow ) . ': ' // @phpstan-ignore-line
4920+ . Coordinate::stringFromColumnIndex (max ($ oCol ) + 1 ) . max ($ oRow ); // @phpstan-ignore-line
49224921 $ this ->debugLog ->writeDebugLog ('Evaluation Result is %s ' , $ this ->showTypeDetails ($ cellIntersect ));
49234922 $ stack ->push ('Value ' , $ cellIntersect , $ cellRef );
49244923 }
@@ -5058,6 +5057,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
50585057 }
50595058
50605059 $ functionName = $ matches [1 ];
5060+ /** @var array $argCount */
50615061 $ argCount = $ stack ->pop ();
50625062 $ argCount = $ argCount ['value ' ];
50635063 if ($ functionName !== 'MKMATRIX ' ) {
@@ -5088,9 +5088,10 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
50885088 && (isset (self ::$ phpSpreadsheetFunctions [$ functionName ]['passByReference ' ][$ a ]))
50895089 && (self ::$ phpSpreadsheetFunctions [$ functionName ]['passByReference ' ][$ a ])
50905090 ) {
5091+ /** @var array $arg */
50915092 if ($ arg ['reference ' ] === null ) {
50925093 $ nextArg = $ cellID ;
5093- if ($ functionName === 'ISREF ' && is_array ( $ arg ) && ($ arg ['type ' ] ?? '' ) === 'Value ' ) {
5094+ if ($ functionName === 'ISREF ' && ($ arg ['type ' ] ?? '' ) === 'Value ' ) {
50945095 if (array_key_exists ('value ' , $ arg )) {
50955096 $ argValue = $ arg ['value ' ];
50965097 if (is_scalar ($ argValue )) {
@@ -5111,6 +5112,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
51115112 }
51125113 }
51135114 } else {
5115+ /** @var array $arg */
51145116 if ($ arg ['type ' ] === 'Empty Argument ' && in_array ($ functionName , ['MIN ' , 'MINA ' , 'MAX ' , 'MAXA ' , 'IF ' ], true )) {
51155117 $ emptyArguments [] = false ;
51165118 $ args [] = $ arg ['value ' ] = 0 ;
@@ -5233,6 +5235,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
52335235 if ($ stack ->count () != 1 ) {
52345236 return $ this ->raiseFormulaError ('internal error ' );
52355237 }
5238+ /** @var array $output */
52365239 $ output = $ stack ->pop ();
52375240 $ output = $ output ['value ' ];
52385241
@@ -5285,6 +5288,7 @@ private function executeArrayComparison(mixed $operand1, mixed $operand2, string
52855288 foreach ($ operand1 as $ x => $ operandData ) {
52865289 $ this ->debugLog ->writeDebugLog ('Evaluating Comparison %s %s %s ' , $ this ->showValue ($ operandData ), $ operation , $ this ->showValue ($ operand2 ));
52875290 $ this ->executeBinaryComparisonOperation ($ operandData , $ operand2 , $ operation , $ stack );
5291+ /** @var array $r */
52885292 $ r = $ stack ->pop ();
52895293 $ result [$ x ] = $ r ['value ' ];
52905294 }
@@ -5293,6 +5297,7 @@ private function executeArrayComparison(mixed $operand1, mixed $operand2, string
52935297 foreach ($ operand2 as $ x => $ operandData ) {
52945298 $ this ->debugLog ->writeDebugLog ('Evaluating Comparison %s %s %s ' , $ this ->showValue ($ operand1 ), $ operation , $ this ->showValue ($ operandData ));
52955299 $ this ->executeBinaryComparisonOperation ($ operand1 , $ operandData , $ operation , $ stack );
5300+ /** @var array $r */
52965301 $ r = $ stack ->pop ();
52975302 $ result [$ x ] = $ r ['value ' ];
52985303 }
@@ -5304,6 +5309,7 @@ private function executeArrayComparison(mixed $operand1, mixed $operand2, string
53045309 foreach ($ operand1 as $ x => $ operandData ) {
53055310 $ this ->debugLog ->writeDebugLog ('Evaluating Comparison %s %s %s ' , $ this ->showValue ($ operandData ), $ operation , $ this ->showValue ($ operand2 [$ x ]));
53065311 $ this ->executeBinaryComparisonOperation ($ operandData , $ operand2 [$ x ], $ operation , $ stack , true );
5312+ /** @var array $r */
53075313 $ r = $ stack ->pop ();
53085314 $ result [$ x ] = $ r ['value ' ];
53095315 }
0 commit comments