From 73ca0e5f1181fb2e830409a89e062d8dd69e1ab9 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sun, 25 Sep 2022 17:31:58 +0200 Subject: [PATCH] Resolve merge conflicts for master -> 2.0-dev --- src/PhpSpreadsheet/Reader/Xlsx.php | 3 ++- .../Calculation/ArrayFormulaTest.php | 12 +++++----- .../Functions/Engineering/ConvertUoMTest.php | 2 -- .../Functions/Engineering/ErfCTest.php | 2 -- .../Functions/Engineering/ErfPreciseTest.php | 2 -- .../Functions/Engineering/ErfTest.php | 2 -- .../Engineering/ParseComplexTest.php | 22 ------------------- .../Functions/Financial/IrrTest.php | 1 - .../Functions/LookupRef/AddressTest.php | 2 -- .../Functions/LookupRef/ColumnsTest.php | 2 -- .../Functions/LookupRef/IndexTest.php | 4 +--- .../Functions/LookupRef/IndirectTest.php | 12 ++-------- .../Functions/LookupRef/RowsTest.php | 4 +--- 13 files changed, 12 insertions(+), 58 deletions(-) delete mode 100644 tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ParseComplexTest.php diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index 7c98c230a4..8c5253bcb2 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -320,11 +320,12 @@ private static function castToString(?SimpleXMLElement $c): ?string * @param mixed $value * @param mixed $calculatedValue */ - private function castToFormula(?SimpleXMLElement $c, string $r, string &$cellDataType, &$value, &$calculatedValue, array &$sharedFormulas, string $castBaseType): void + private function castToFormula(Worksheet $docSheet, ?SimpleXMLElement $c, string $r, string &$cellDataType, &$value, &$calculatedValue, array &$sharedFormulas, string $castBaseType): void { if ($c === null) { return; } + $formulaAttributes = $c->f->attributes(); $cellDataType = 'f'; $value = "={$c->f}"; diff --git a/tests/PhpSpreadsheetTests/Calculation/ArrayFormulaTest.php b/tests/PhpSpreadsheetTests/Calculation/ArrayFormulaTest.php index 8bccde185a..f962aa7926 100644 --- a/tests/PhpSpreadsheetTests/Calculation/ArrayFormulaTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/ArrayFormulaTest.php @@ -260,19 +260,19 @@ public function providerArrayArithmetic(): array ], 'Division: row vector / column vector' => [ '={1,2,3} / {4;5;6}', - [[0.25, 0.5, 0.75], [0.2, 0.4, 0.6], [0.16666666666667, 0.33333333333333, 0.5]], + [[0.25, 0.5, 0.75], [0.2, 0.4, 0.6], [0.16666666666666667, 0.3333333333333333, 0.5]], ], 'Division: column vector / row vector' => [ '={1;2;3} / {4,5,6}', - [[0.25, 0.2, 0.16666666666667], [0.5, 0.4, 0.33333333333333], [0.75, 0.6, 0.5]], + [[0.25, 0.2, 0.16666666666666667], [0.5, 0.4, 0.3333333333333333], [0.75, 0.6, 0.5]], ], 'Division: matrix 3x2 / 3x2' => [ '={1,2,3;4,5,6} / {7,8,9;10,11,12}', - [[0.142857142857143, 0.25, 0.33333333333333], [0.4, 0.45454545454545, 0.5]], + [[0.14285714285714285, 0.25, 0.3333333333333333], [0.4, 0.45454545454545453, 0.5]], ], 'Division: matrix 2x3 / 2x3' => [ '={1,4;2,5;3,6} / {7,10;8,11;9,12}', - [[0.142857142857143, 0.4], [0.25, 0.45454545454545], [0.33333333333333, 0.5]], + [[0.14285714285714285, 0.4], [0.25, 0.45454545454545453], [0.3333333333333333, 0.5]], ], 'Division: row vector 2 / column vector 2' => [ '={2,3} / {4;5}', @@ -280,7 +280,7 @@ public function providerArrayArithmetic(): array ], 'Division: matrix 3x2 / 2x3' => [ '={1,2,3;4,5,6} / {7,10;8,11;9,12}', - [[0.14285714285714, 0.2], [0.5, 0.45454545454545]], + [[0.14285714285714285, 0.2], [0.5, 0.45454545454545453]], ], 'Division: matrix 2x3 / 3x2' => [ '={7,10;8,11;9,12} / {1,2,3;4,5,6}', @@ -289,7 +289,7 @@ public function providerArrayArithmetic(): array // Power 'Power: square matrix 2x2 ^ 2x2' => [ '={1,2;3,4} ^ {-2,4;-6,8}', - [[1, 16], [0.00137174211248, 65536]], + [[1, 16], [0.0013717421124828531, 65536]], ], 'Power: square matrix 2x2 ^ scalar' => [ '={1,2;3,4} ^ 2', diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php index 034d269eac..9675b20994 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php @@ -4,8 +4,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertUOM; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; use PHPUnit\Framework\TestCase; class ConvertUoMTest extends TestCase diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php index b505f560e4..ee38626672 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php @@ -4,8 +4,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Engineering\ErfC; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; use PHPUnit\Framework\TestCase; class ErfCTest extends TestCase diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php index 42b031241d..a4fc9dfda1 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php @@ -4,8 +4,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Engineering\Erf; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; use PHPUnit\Framework\TestCase; class ErfPreciseTest extends TestCase diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php index 6e1d0a0a5a..26d0290ad9 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php @@ -4,8 +4,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Engineering\Erf; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; use PHPUnit\Framework\TestCase; class ErfTest extends TestCase diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ParseComplexTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ParseComplexTest.php deleted file mode 100644 index a32d946f59..0000000000 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ParseComplexTest.php +++ /dev/null @@ -1,22 +0,0 @@ -getSheet(); - $sheet->getCell('A1')->setValue('A2'); - $sheet->getCell('A2')->setValue('This is it'); - $result = \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::INDIRECT('A2', $sheet->getCell('A1')); - $result = \PhpOffice\PhpSpreadsheet\Calculation\Functions::flattenSingleValue($result); - self::assertSame('This is it', $result); - } - /** * @param null|int|string $expectedResult * diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php index 8fd1ef37b0..31b941013d 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/LookupRef/RowsTest.php @@ -3,9 +3,7 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\LookupRef; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; use PhpOffice\PhpSpreadsheet\Calculation\LookupRef\RowColumnInformation; -use PhpOffice\PhpSpreadsheet\Calculation\LookupRef; use PHPUnit\Framework\TestCase; class RowsTest extends TestCase @@ -17,7 +15,7 @@ class RowsTest extends TestCase */ public function testROWS($expectedResult, ...$args): void { - $result = LookupRef::ROWS(/** @scrutinizer ignore-type */ ...$args); + $result = RowColumnInformation::rows(/** @scrutinizer ignore-type */ ...$args); self::assertEquals($expectedResult, $result); }