Skip to content

Commit de658b4

Browse files
committed
Rector RemoveUnusedVariableInCatchRector
1 parent f6f1e27 commit de658b4

28 files changed

+65
-65
lines changed

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,7 +3204,7 @@ public function setLocale(string $locale): bool
32043204

32053205
try {
32063206
$configFile = $this->getLocaleFile($localeDir, $locale, $language, 'config');
3207-
} catch (Exception $e) {
3207+
} catch (Exception) {
32083208
return false;
32093209
}
32103210

@@ -4814,7 +4814,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $cell = null)
48144814
$oCR = Coordinate::coordinateFromString($oDatum);
48154815
$oCol[] = Coordinate::columnIndexFromString($oCR[0]) - 1;
48164816
$oRow[] = $oCR[1];
4817-
} catch (\Exception $e) {
4817+
} catch (\Exception) {
48184818
$stack->push('Error', Information\ExcelError::REF(), null);
48194819
$breakNeeded = true;
48204820

src/PhpSpreadsheet/Calculation/Engineering/Complex.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static function IMAGINARY($complexNumber): array|string|float
8282

8383
try {
8484
$complex = new ComplexObject($complexNumber);
85-
} catch (ComplexException $e) {
85+
} catch (ComplexException) {
8686
return ExcelError::NAN();
8787
}
8888

@@ -112,7 +112,7 @@ public static function IMREAL($complexNumber): array|string|float
112112

113113
try {
114114
$complex = new ComplexObject($complexNumber);
115-
} catch (ComplexException $e) {
115+
} catch (ComplexException) {
116116
return ExcelError::NAN();
117117
}
118118

src/PhpSpreadsheet/Calculation/Engineering/ComplexFunctions.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static function IMABS($complexNumber)
3434

3535
try {
3636
$complex = new ComplexObject($complexNumber);
37-
} catch (ComplexException $e) {
37+
} catch (ComplexException) {
3838
return ExcelError::NAN();
3939
}
4040

@@ -65,7 +65,7 @@ public static function IMARGUMENT($complexNumber)
6565

6666
try {
6767
$complex = new ComplexObject($complexNumber);
68-
} catch (ComplexException $e) {
68+
} catch (ComplexException) {
6969
return ExcelError::NAN();
7070
}
7171

@@ -99,7 +99,7 @@ public static function IMCONJUGATE($complexNumber): array|string
9999

100100
try {
101101
$complex = new ComplexObject($complexNumber);
102-
} catch (ComplexException $e) {
102+
} catch (ComplexException) {
103103
return ExcelError::NAN();
104104
}
105105

@@ -129,7 +129,7 @@ public static function IMCOS($complexNumber): array|string
129129

130130
try {
131131
$complex = new ComplexObject($complexNumber);
132-
} catch (ComplexException $e) {
132+
} catch (ComplexException) {
133133
return ExcelError::NAN();
134134
}
135135

@@ -159,7 +159,7 @@ public static function IMCOSH($complexNumber): array|string
159159

160160
try {
161161
$complex = new ComplexObject($complexNumber);
162-
} catch (ComplexException $e) {
162+
} catch (ComplexException) {
163163
return ExcelError::NAN();
164164
}
165165

@@ -189,7 +189,7 @@ public static function IMCOT($complexNumber): array|string
189189

190190
try {
191191
$complex = new ComplexObject($complexNumber);
192-
} catch (ComplexException $e) {
192+
} catch (ComplexException) {
193193
return ExcelError::NAN();
194194
}
195195

@@ -219,7 +219,7 @@ public static function IMCSC($complexNumber): array|string
219219

220220
try {
221221
$complex = new ComplexObject($complexNumber);
222-
} catch (ComplexException $e) {
222+
} catch (ComplexException) {
223223
return ExcelError::NAN();
224224
}
225225

@@ -249,7 +249,7 @@ public static function IMCSCH($complexNumber): array|string
249249

250250
try {
251251
$complex = new ComplexObject($complexNumber);
252-
} catch (ComplexException $e) {
252+
} catch (ComplexException) {
253253
return ExcelError::NAN();
254254
}
255255

@@ -279,7 +279,7 @@ public static function IMSIN($complexNumber): array|string
279279

280280
try {
281281
$complex = new ComplexObject($complexNumber);
282-
} catch (ComplexException $e) {
282+
} catch (ComplexException) {
283283
return ExcelError::NAN();
284284
}
285285

@@ -309,7 +309,7 @@ public static function IMSINH($complexNumber): array|string
309309

310310
try {
311311
$complex = new ComplexObject($complexNumber);
312-
} catch (ComplexException $e) {
312+
} catch (ComplexException) {
313313
return ExcelError::NAN();
314314
}
315315

@@ -339,7 +339,7 @@ public static function IMSEC($complexNumber): array|string
339339

340340
try {
341341
$complex = new ComplexObject($complexNumber);
342-
} catch (ComplexException $e) {
342+
} catch (ComplexException) {
343343
return ExcelError::NAN();
344344
}
345345

@@ -369,7 +369,7 @@ public static function IMSECH($complexNumber): array|string
369369

370370
try {
371371
$complex = new ComplexObject($complexNumber);
372-
} catch (ComplexException $e) {
372+
} catch (ComplexException) {
373373
return ExcelError::NAN();
374374
}
375375

@@ -399,7 +399,7 @@ public static function IMTAN($complexNumber): array|string
399399

400400
try {
401401
$complex = new ComplexObject($complexNumber);
402-
} catch (ComplexException $e) {
402+
} catch (ComplexException) {
403403
return ExcelError::NAN();
404404
}
405405

@@ -429,7 +429,7 @@ public static function IMSQRT($complexNumber): array|string
429429

430430
try {
431431
$complex = new ComplexObject($complexNumber);
432-
} catch (ComplexException $e) {
432+
} catch (ComplexException) {
433433
return ExcelError::NAN();
434434
}
435435

@@ -464,7 +464,7 @@ public static function IMLN($complexNumber): array|string
464464

465465
try {
466466
$complex = new ComplexObject($complexNumber);
467-
} catch (ComplexException $e) {
467+
} catch (ComplexException) {
468468
return ExcelError::NAN();
469469
}
470470

@@ -498,7 +498,7 @@ public static function IMLOG10($complexNumber): array|string
498498

499499
try {
500500
$complex = new ComplexObject($complexNumber);
501-
} catch (ComplexException $e) {
501+
} catch (ComplexException) {
502502
return ExcelError::NAN();
503503
}
504504

@@ -532,7 +532,7 @@ public static function IMLOG2($complexNumber): array|string
532532

533533
try {
534534
$complex = new ComplexObject($complexNumber);
535-
} catch (ComplexException $e) {
535+
} catch (ComplexException) {
536536
return ExcelError::NAN();
537537
}
538538

@@ -566,7 +566,7 @@ public static function IMEXP($complexNumber): array|string
566566

567567
try {
568568
$complex = new ComplexObject($complexNumber);
569-
} catch (ComplexException $e) {
569+
} catch (ComplexException) {
570570
return ExcelError::NAN();
571571
}
572572

@@ -598,7 +598,7 @@ public static function IMPOWER($complexNumber, $realNumber): array|string
598598

599599
try {
600600
$complex = new ComplexObject($complexNumber);
601-
} catch (ComplexException $e) {
601+
} catch (ComplexException) {
602602
return ExcelError::NAN();
603603
}
604604

src/PhpSpreadsheet/Calculation/Engineering/ComplexOperations.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static function IMDIV($complexDividend, $complexDivisor): array|string
3737

3838
try {
3939
return (string) (new ComplexObject($complexDividend))->divideby(new ComplexObject($complexDivisor));
40-
} catch (ComplexException $e) {
40+
} catch (ComplexException) {
4141
return ExcelError::NAN();
4242
}
4343
}
@@ -67,7 +67,7 @@ public static function IMSUB($complexNumber1, $complexNumber2): array|string
6767

6868
try {
6969
return (string) (new ComplexObject($complexNumber1))->subtract(new ComplexObject($complexNumber2));
70-
} catch (ComplexException $e) {
70+
} catch (ComplexException) {
7171
return ExcelError::NAN();
7272
}
7373
}
@@ -93,7 +93,7 @@ public static function IMSUM(...$complexNumbers): string
9393
foreach ($aArgs as $complex) {
9494
$returnValue = $returnValue->add(new ComplexObject($complex));
9595
}
96-
} catch (ComplexException $e) {
96+
} catch (ComplexException) {
9797
return ExcelError::NAN();
9898
}
9999

@@ -121,7 +121,7 @@ public static function IMPRODUCT(...$complexNumbers): string
121121
foreach ($aArgs as $complex) {
122122
$returnValue = $returnValue->multiply(new ComplexObject($complex));
123123
}
124-
} catch (ComplexException $e) {
124+
} catch (ComplexException) {
125125
return ExcelError::NAN();
126126
}
127127

src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ public static function CONVERT($value, $fromUOM, $toUOM)
540540
try {
541541
[$fromUOM, $fromCategory, $fromMultiplier] = self::getUOMDetails($fromUOM);
542542
[$toUOM, $toCategory, $toMultiplier] = self::getUOMDetails($toUOM);
543-
} catch (Exception $e) {
543+
} catch (Exception) {
544544
return ExcelError::NA();
545545
}
546546

src/PhpSpreadsheet/Calculation/LookupRef/Indirect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function INDIRECT($cellAddress, $a1fmt, Cell $cell): string|array
8484

8585
try {
8686
[$cellAddress1, $cellAddress2, $cellAddress] = Helpers::extractCellAddresses($cellAddress, $a1, $cell->getWorkSheet(), $sheetName, $baseRow, $baseCol);
87-
} catch (Exception $e) {
87+
} catch (Exception) {
8888
return ExcelError::REF();
8989
}
9090

src/PhpSpreadsheet/Calculation/MathTrig/Arabic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static function evaluate($roman)
9999

100100
try {
101101
$arabic = self::calculateArabic(self::strSplit($roman));
102-
} catch (Exception $e) {
102+
} catch (Exception) {
103103
return ExcelError::VALUE(); // Invalid character detected
104104
}
105105

src/PhpSpreadsheet/Calculation/MathTrig/MatrixFunctions.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static function determinant($matrixValues)
101101
$matrix = self::getMatrix($matrixValues);
102102

103103
return $matrix->determinant();
104-
} catch (MatrixException $ex) {
104+
} catch (MatrixException) {
105105
return ExcelError::VALUE();
106106
} catch (Exception $e) {
107107
return $e->getMessage();
@@ -126,9 +126,9 @@ public static function inverse($matrixValues): array|string
126126
$matrix = self::getMatrix($matrixValues);
127127

128128
return $matrix->inverse()->toArray();
129-
} catch (MatrixDiv0Exception $e) {
129+
} catch (MatrixDiv0Exception) {
130130
return ExcelError::NAN();
131-
} catch (MatrixException $e) {
131+
} catch (MatrixException) {
132132
return ExcelError::VALUE();
133133
} catch (Exception $e) {
134134
return $e->getMessage();
@@ -150,7 +150,7 @@ public static function multiply($matrixData1, $matrixData2): array|string
150150
$matrixB = self::getMatrix($matrixData2);
151151

152152
return $matrixA->multiply($matrixB)->toArray();
153-
} catch (MatrixException $ex) {
153+
} catch (MatrixException) {
154154
return ExcelError::VALUE();
155155
} catch (Exception $e) {
156156
return $e->getMessage();

src/PhpSpreadsheet/Calculation/Web/Service.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static function webService(string $url)
3636

3737
try {
3838
$response = $client->sendRequest($request);
39-
} catch (ClientExceptionInterface $e) {
39+
} catch (ClientExceptionInterface) {
4040
return ExcelError::VALUE(); // cURL error
4141
}
4242

src/PhpSpreadsheet/Cell/DataValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private function isValueInList(Cell $cell): bool
106106
}
107107

108108
return $result !== ExcelError::NA();
109-
} catch (Exception $ex) {
109+
} catch (Exception) {
110110
return false;
111111
}
112112
}

0 commit comments

Comments
 (0)