Skip to content

Commit ff655bd

Browse files
committed
Resolve merge conflicts for master -> 2.0-dev
1 parent 541bf0f commit ff655bd

File tree

15 files changed

+12
-784
lines changed

15 files changed

+12
-784
lines changed

phpstan-baseline.neon

-720
Large diffs are not rendered by default.

src/PhpSpreadsheet/Helper/Sample.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function getSamples()
8585
foreach ($regex as $file) {
8686
$file = str_replace(str_replace('\\', '/', $baseDir) . '/', '', str_replace('\\', '/', $file[0]));
8787
$info = pathinfo($file);
88-
$category = str_replace('_', ' ', $info['dirname']);
88+
$category = str_replace('_', ' ', $info['dirname'] ?? '');
8989
$name = str_replace('_', ' ', (string) preg_replace('/(|\.php)/', '', $info['filename']));
9090
if (!in_array($category, ['.', 'boostrap', 'templates'])) {
9191
if (!isset($files[$category])) {

src/PhpSpreadsheet/Reader/Xlsx.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,12 @@ private static function castToString(?SimpleXMLElement $c): ?string
320320
* @param mixed $value
321321
* @param mixed $calculatedValue
322322
*/
323-
private function castToFormula(?SimpleXMLElement $c, string $r, string &$cellDataType, &$value, &$calculatedValue, array &$sharedFormulas, string $castBaseType): void
323+
private function castToFormula(Worksheet $docSheet, ?SimpleXMLElement $c, string $r, string &$cellDataType, &$value, &$calculatedValue, array &$sharedFormulas, string $castBaseType): void
324324
{
325325
if ($c === null) {
326326
return;
327327
}
328+
328329
$formulaAttributes = $c->f->attributes();
329330
$cellDataType = 'f';
330331
$value = "={$c->f}";
@@ -1615,7 +1616,7 @@ protected function loadSpreadsheetFromFile(string $filename): Spreadsheet
16151616
if (strpos((string) $definedName, '!') !== false) {
16161617
$range[0] = str_replace("''", "'", $range[0]);
16171618
$range[0] = str_replace("'", '', $range[0]);
1618-
if ($worksheet = $excel->getSheetByName($range[0])) { // @phpstan-ignore-line
1619+
if ($worksheet = $excel->getSheetByName($range[0])) {
16191620
$excel->addDefinedName(DefinedName::createInstance((string) $definedName['name'], $worksheet, $extractedRange, true, $scope));
16201621
} else {
16211622
$excel->addDefinedName(DefinedName::createInstance((string) $definedName['name'], $scope, $extractedRange, true, $scope));

tests/PhpSpreadsheetTests/Calculation/ArrayFormulaTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -260,27 +260,27 @@ public function providerArrayArithmetic(): array
260260
],
261261
'Division: row vector / column vector' => [
262262
'={1,2,3} / {4;5;6}',
263-
[[0.25, 0.5, 0.75], [0.2, 0.4, 0.6], [0.16666666666667, 0.33333333333333, 0.5]],
263+
[[0.25, 0.5, 0.75], [0.2, 0.4, 0.6], [0.16666666666666667, 0.3333333333333333, 0.5]],
264264
],
265265
'Division: column vector / row vector' => [
266266
'={1;2;3} / {4,5,6}',
267-
[[0.25, 0.2, 0.16666666666667], [0.5, 0.4, 0.33333333333333], [0.75, 0.6, 0.5]],
267+
[[0.25, 0.2, 0.16666666666666667], [0.5, 0.4, 0.3333333333333333], [0.75, 0.6, 0.5]],
268268
],
269269
'Division: matrix 3x2 / 3x2' => [
270270
'={1,2,3;4,5,6} / {7,8,9;10,11,12}',
271-
[[0.142857142857143, 0.25, 0.33333333333333], [0.4, 0.45454545454545, 0.5]],
271+
[[0.14285714285714285, 0.25, 0.3333333333333333], [0.4, 0.45454545454545453, 0.5]],
272272
],
273273
'Division: matrix 2x3 / 2x3' => [
274274
'={1,4;2,5;3,6} / {7,10;8,11;9,12}',
275-
[[0.142857142857143, 0.4], [0.25, 0.45454545454545], [0.33333333333333, 0.5]],
275+
[[0.14285714285714285, 0.4], [0.25, 0.45454545454545453], [0.3333333333333333, 0.5]],
276276
],
277277
'Division: row vector 2 / column vector 2' => [
278278
'={2,3} / {4;5}',
279279
[[0.5, 0.75], [0.4, 0.6]],
280280
],
281281
'Division: matrix 3x2 / 2x3' => [
282282
'={1,2,3;4,5,6} / {7,10;8,11;9,12}',
283-
[[0.14285714285714, 0.2], [0.5, 0.45454545454545]],
283+
[[0.14285714285714285, 0.2], [0.5, 0.45454545454545453]],
284284
],
285285
'Division: matrix 2x3 / 3x2' => [
286286
'={7,10;8,11;9,12} / {1,2,3;4,5,6}',
@@ -289,7 +289,7 @@ public function providerArrayArithmetic(): array
289289
// Power
290290
'Power: square matrix 2x2 ^ 2x2' => [
291291
'={1,2;3,4} ^ {-2,4;-6,8}',
292-
[[1, 16], [0.00137174211248, 65536]],
292+
[[1, 16], [0.0013717421124828531, 65536]],
293293
],
294294
'Power: square matrix 2x2 ^ scalar' => [
295295
'={1,2;3,4} ^ 2',

tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
66
use PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertUOM;
7-
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
8-
use PhpOffice\PhpSpreadsheet\Calculation\Engineering;
97
use PHPUnit\Framework\TestCase;
108

119
class ConvertUoMTest extends TestCase

tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
66
use PhpOffice\PhpSpreadsheet\Calculation\Engineering\ErfC;
7-
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
8-
use PhpOffice\PhpSpreadsheet\Calculation\Engineering;
97
use PHPUnit\Framework\TestCase;
108

119
class ErfCTest extends TestCase

tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
66
use PhpOffice\PhpSpreadsheet\Calculation\Engineering\Erf;
7-
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
8-
use PhpOffice\PhpSpreadsheet\Calculation\Engineering;
97
use PHPUnit\Framework\TestCase;
108

119
class ErfPreciseTest extends TestCase

tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
66
use PhpOffice\PhpSpreadsheet\Calculation\Engineering\Erf;
7-
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
8-
use PhpOffice\PhpSpreadsheet\Calculation\Engineering;
97
use PHPUnit\Framework\TestCase;
108

119
class ErfTest extends TestCase

tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ParseComplexTest.php

-22
This file was deleted.

tests/PhpSpreadsheetTests/Calculation/Functions/Financial/IrrTest.php

-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Financial;
44

5-
use PhpOffice\PhpSpreadsheet\Calculation\Financial\CashFlow\Variable\Periodic;
6-
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
7-
use PHPUnit\Framework\TestCase;
8-
9-
class IrrTest extends TestCase
105
class IrrTest extends AllSetupTeardown
116
{
127
/**

tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/AddressTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
44

55
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
6-
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
76
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Address;
8-
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
97
use PHPUnit\Framework\TestCase;
108

119
class AddressTest extends TestCase

tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/ColumnsTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
44

55
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
6-
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
76
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef\RowColumnInformation;
8-
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
97
use PHPUnit\Framework\TestCase;
108

119
class ColumnsTest extends TestCase

tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/IndexTest.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
44

55
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
6-
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
76
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef\Matrix;
8-
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
97
use PHPUnit\Framework\TestCase;
108

119
class IndexTest extends TestCase
@@ -17,7 +15,7 @@ class IndexTest extends TestCase
1715
*/
1816
public function testINDEX($expectedResult, ...$args): void
1917
{
20-
$result = LookupRef::INDEX(/** @scrutinizer ignore-type */ ...$args);
18+
$result = Matrix::index(/** @scrutinizer ignore-type */ ...$args);
2119
self::assertEquals($expectedResult, $result);
2220
}
2321

tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/IndirectTest.php

-10
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,6 @@ public function testIndirectFile2(): void
123123
}
124124
}
125125

126-
public function testDeprecatedCall(): void
127-
{
128-
$sheet = $this->getSheet();
129-
$sheet->getCell('A1')->setValue('A2');
130-
$sheet->getCell('A2')->setValue('This is it');
131-
$result = \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::INDIRECT('A2', $sheet->getCell('A1'));
132-
$result = \PhpOffice\PhpSpreadsheet\Calculation\Functions::flattenSingleValue($result);
133-
self::assertSame('This is it', $result);
134-
}
135-
136126
/**
137127
* @param null|int|string $expectedResult
138128
*

tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef;
44

55
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
6-
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
76
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef\RowColumnInformation;
8-
use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
97
use PHPUnit\Framework\TestCase;
108

119
class RowsTest extends TestCase
@@ -17,7 +15,7 @@ class RowsTest extends TestCase
1715
*/
1816
public function testROWS($expectedResult, ...$args): void
1917
{
20-
$result = LookupRef::ROWS(/** @scrutinizer ignore-type */ ...$args);
18+
$result = RowColumnInformation::rows(/** @scrutinizer ignore-type */ ...$args);
2119
self::assertEquals($expectedResult, $result);
2220
}
2321

0 commit comments

Comments
 (0)