@@ -4426,11 +4426,10 @@ private function internalParseFormula(string $formula, ?Cell $cell = null): bool
44264426 if (ctype_digit ($ val ) && $ val <= 1048576 ) {
44274427 // Row range
44284428 $ stackItemType = 'Row Reference ' ;
4429- /** @var int $valx */
44304429 $ valx = $ val ;
44314430 $ endRowColRef = ($ refSheet !== null ) ? $ refSheet ->getHighestDataColumn ($ valx ) : AddressRange::MAX_COLUMN ; // Max 16,384 columns for Excel2007
44324431 $ val = "{$ rangeWS2 }{$ endRowColRef }{$ val }" ;
4433- } elseif (ctype_alpha ($ val ) && is_string ( $ val ) && strlen ($ val ) <= 3 ) {
4432+ } elseif (ctype_alpha ($ val ) && strlen ($ val ) <= 3 ) {
44344433 // Column range
44354434 $ stackItemType = 'Column Reference ' ;
44364435 $ 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
45644563
45654564 while (($ op = $ stack ->pop ()) !== null ) {
45664565 // pop everything off the stack and push onto output
4567- if (( is_array ( $ op) && $ op ['value ' ] == '( ' ) ) {
4566+ if ($ op ['value ' ] == '( ' ) {
45684567 return $ this ->raiseFormulaError ("Formula Error: Expecting ')' " ); // if there are any opening braces on the stack, then braces were unbalanced
45694568 }
45704569 $ output [] = $ op ;
@@ -4821,7 +4820,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
48214820 if ($ breakNeeded ) {
48224821 break ;
48234822 }
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
48254824 if ($ pCellParent !== null && $ this ->spreadsheet !== null ) {
48264825 $ cellValue = $ this ->extractCellRange ($ cellRef , $ this ->spreadsheet ->getSheetByName ($ sheet1 ), false );
48274826 } else {
@@ -4919,8 +4918,8 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
49194918 $ this ->debugLog ->writeDebugLog ('Evaluation Result is %s ' , $ this ->showTypeDetails ($ cellIntersect ));
49204919 $ stack ->push ('Error ' , ExcelError::null (), null );
49214920 } 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
49244923 $ this ->debugLog ->writeDebugLog ('Evaluation Result is %s ' , $ this ->showTypeDetails ($ cellIntersect ));
49254924 $ stack ->push ('Value ' , $ cellIntersect , $ cellRef );
49264925 }
@@ -5060,6 +5059,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
50605059 }
50615060
50625061 $ functionName = $ matches [1 ];
5062+ /** @var array $argCount */
50635063 $ argCount = $ stack ->pop ();
50645064 $ argCount = $ argCount ['value ' ];
50655065 if ($ functionName !== 'MKMATRIX ' ) {
@@ -5090,9 +5090,10 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
50905090 && (isset (self ::$ phpSpreadsheetFunctions [$ functionName ]['passByReference ' ][$ a ]))
50915091 && (self ::$ phpSpreadsheetFunctions [$ functionName ]['passByReference ' ][$ a ])
50925092 ) {
5093+ /** @var array $arg */
50935094 if ($ arg ['reference ' ] === null ) {
50945095 $ nextArg = $ cellID ;
5095- if ($ functionName === 'ISREF ' && is_array ( $ arg ) && ($ arg ['type ' ] ?? '' ) === 'Value ' ) {
5096+ if ($ functionName === 'ISREF ' && ($ arg ['type ' ] ?? '' ) === 'Value ' ) {
50965097 if (array_key_exists ('value ' , $ arg )) {
50975098 $ argValue = $ arg ['value ' ];
50985099 if (is_scalar ($ argValue )) {
@@ -5113,6 +5114,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
51135114 }
51145115 }
51155116 } else {
5117+ /** @var array $arg */
51165118 if ($ arg ['type ' ] === 'Empty Argument ' && in_array ($ functionName , ['MIN ' , 'MINA ' , 'MAX ' , 'MAXA ' , 'IF ' ], true )) {
51175119 $ emptyArguments [] = false ;
51185120 $ args [] = $ arg ['value ' ] = 0 ;
@@ -5235,6 +5237,7 @@ private function processTokenStack(mixed $tokens, ?string $cellID = null, ?Cell
52355237 if ($ stack ->count () != 1 ) {
52365238 return $ this ->raiseFormulaError ('internal error ' );
52375239 }
5240+ /** @var array $output */
52385241 $ output = $ stack ->pop ();
52395242 $ output = $ output ['value ' ];
52405243
@@ -5287,6 +5290,7 @@ private function executeArrayComparison(mixed $operand1, mixed $operand2, string
52875290 foreach ($ operand1 as $ x => $ operandData ) {
52885291 $ this ->debugLog ->writeDebugLog ('Evaluating Comparison %s %s %s ' , $ this ->showValue ($ operandData ), $ operation , $ this ->showValue ($ operand2 ));
52895292 $ this ->executeBinaryComparisonOperation ($ operandData , $ operand2 , $ operation , $ stack );
5293+ /** @var array $r */
52905294 $ r = $ stack ->pop ();
52915295 $ result [$ x ] = $ r ['value ' ];
52925296 }
@@ -5295,6 +5299,7 @@ private function executeArrayComparison(mixed $operand1, mixed $operand2, string
52955299 foreach ($ operand2 as $ x => $ operandData ) {
52965300 $ this ->debugLog ->writeDebugLog ('Evaluating Comparison %s %s %s ' , $ this ->showValue ($ operand1 ), $ operation , $ this ->showValue ($ operandData ));
52975301 $ this ->executeBinaryComparisonOperation ($ operand1 , $ operandData , $ operation , $ stack );
5302+ /** @var array $r */
52985303 $ r = $ stack ->pop ();
52995304 $ result [$ x ] = $ r ['value ' ];
53005305 }
@@ -5306,6 +5311,7 @@ private function executeArrayComparison(mixed $operand1, mixed $operand2, string
53065311 foreach ($ operand1 as $ x => $ operandData ) {
53075312 $ this ->debugLog ->writeDebugLog ('Evaluating Comparison %s %s %s ' , $ this ->showValue ($ operandData ), $ operation , $ this ->showValue ($ operand2 [$ x ]));
53085313 $ this ->executeBinaryComparisonOperation ($ operandData , $ operand2 [$ x ], $ operation , $ stack , true );
5314+ /** @var array $r */
53095315 $ r = $ stack ->pop ();
53105316 $ result [$ x ] = $ r ['value ' ];
53115317 }
0 commit comments