Skip to content

Commit 77eaac2

Browse files
authored
Merge branch 'master' into wakeup
2 parents e49d7a9 + c07675a commit 77eaac2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+568
-48
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ and this project adheres to [Semantic Versioning](https://semver.org). Thia is a
3030

3131
### Fixed
3232

33+
- Performance improvement when working with large amounts of cells. [Issue #4607](https://github.com/PHPOffice/PhpSpreadsheet/issues/4607) [PR #4609](https://github.com/PHPOffice/PhpSpreadsheet/pull/4609)
34+
- Minor improvements to Calculation coverage. [PR #4624](https://github.com/PHPOffice/PhpSpreadsheet/pull/4624)
35+
- Conditional formatting in extLst. [Issue #4629](https://github.com/PHPOffice/PhpSpreadsheet/issues/4629) [PR #4633](https://github.com/PHPOffice/PhpSpreadsheet/pull/4633)
3336
- Php8.5 deprecates use of null as array index. [PR #4634](https://github.com/PHPOffice/PhpSpreadsheet/pull/4634)
3437
- For Php8.5, replace one of our two uses of `__wakeup` with `__unserialize`, and eliminate the other. [PR #4639](https://github.com/PHPOffice/PhpSpreadsheet/pull/4639)
38+
- Use prefix _xlfn for BASE function. [Issue #4638](https://github.com/PHPOffice/PhpSpreadsheet/issues/4638) [PR #4641](https://github.com/PHPOffice/PhpSpreadsheet/pull/4641)
3539

3640
## 2025-09-03 - 5.1.0
3741

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infra/LocaleGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ protected function mapErrorCodeRows(): void
327327
foreach ($cells as $cell) {
328328
if ($cell->getValue() != '') {
329329
$this->log($cell->getRow() . ' -> ' . $cell->getValueString());
330-
$this->errorCodeMap[$cell->getValue()] = $cell->getRow();
330+
$this->errorCodeMap[$cell->getValueString()] = $cell->getRow();
331331
}
332332
}
333333
}
@@ -345,7 +345,7 @@ protected function mapFunctionNameRows(): void
345345
if ($this->isFunctionCategoryEntry($cell)) {
346346
if (!empty($cell->getValue())) {
347347
$this->log('CATEGORY: ' . $cell->getValueString());
348-
$this->functionNameMap[$cell->getValue()] = $cell->getRow();
348+
$this->functionNameMap[$cell->getValueString()] = $cell->getRow();
349349
}
350350

351351
continue;
@@ -356,7 +356,7 @@ protected function mapFunctionNameRows(): void
356356
$this->functionNameMap[($cell->getValue() ? 'TRUE' : 'FALSE')] = $cell->getRow();
357357
} else {
358358
$this->log($cell->getRow() . ' -> ' . $cell->getValueString());
359-
$this->functionNameMap[$cell->getValue()] = $cell->getRow();
359+
$this->functionNameMap[$cell->getValueString()] = $cell->getRow();
360360
}
361361
}
362362
}

samples/Wizards/NumberFormat/Currency.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
$helper->log('Unrecognized currency symbol');
105105
} else {
106106
try {
107-
$negative = $negatives[$_POST['negative']] ?? CurrencyNegative::minus;
107+
$negative = $negatives[$_POST['negative']] ?? CurrencyNegative::minus; //* @phpstan-ignore-line
108108
$wizard = new Wizard\Currency($_POST['currency'], (int) $_POST['decimals'], isset($_POST['thousands']), (bool) $_POST['position']);
109109
$wizard->setNegative($negative);
110110
$mask = $wizard->format();
@@ -118,7 +118,7 @@
118118
. ', Wizard\Currency::' . (((bool) $_POST['position']) ? 'LEADING_SYMBOL' : 'TRAILING_SYMBOL')
119119
. ');'
120120
);
121-
$helper->log('$wizard->setNegative(' . $negativesString[$_POST['negative']] . ');');
121+
$helper->log('$wizard->setNegative(' . $negativesString[$_POST['negative']] . ');'); //* @phpstan-ignore-line
122122
$helper->log('$mask = $wizard->format();');
123123
$helper->log('<br />echo (string) $mask;');
124124
$helper->log('<hr /><b>Mask:</b><br />');

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ private static function resizeMatricesExtend(array &$matrix1, array &$matrix2, i
888888
}
889889
}
890890
if ($matrix1Rows < $matrix2Rows) {
891-
$x = ($matrix1Rows === 1) ? $matrix1[0] : array_fill(0, $matrix1Columns, null);
891+
$x = ($matrix1Rows === 1) ? $matrix1[0] : array_fill(0, $matrix2Columns, null);
892892
for ($i = $matrix1Rows; $i < $matrix2Rows; ++$i) {
893893
$matrix1[$i] = $x;
894894
}
@@ -1699,7 +1699,7 @@ private function processTokenStack(false|array $tokens, ?string $cellID = null,
16991699
return $this->raiseFormulaError($e->getMessage(), $e->getCode(), $e);
17001700
}
17011701
}
1702-
} elseif (!is_numeric($token) && !is_object($token) && isset($token, self::BINARY_OPERATORS[$token])) {
1702+
} elseif (!is_numeric($token) && !is_object($token) && isset($token, self::BINARY_OPERATORS[$token])) { //* @phpstan-ignore-line
17031703
// if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack
17041704
// We must have two operands, error if we don't
17051705
$operand2Data = $stack->pop();
@@ -2879,6 +2879,7 @@ private static function swapOperands(Stack $stack, string $opCharacter): bool
28792879
if ($stack->count() > 0) {
28802880
$o2 = $stack->last();
28812881
if ($o2) {
2882+
/** @var array{value: string} $o2 */
28822883
if (isset(self::CALCULATION_OPERATORS[$o2['value']])) {
28832884
$retVal = (self::OPERATOR_PRECEDENCE[$opCharacter] ?? 0) <= self::OPERATOR_PRECEDENCE[$o2['value']];
28842885
}

src/PhpSpreadsheet/Calculation/CalculationLocale.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ protected static function loadLocales(): void
6363
$filename = substr($filename, strlen($localeFileDirectory));
6464
if ($filename != 'en') {
6565
self::$validLocaleLanguages[] = $filename;
66+
$subdirs = glob("$localeFileDirectory$filename/*", GLOB_ONLYDIR) ?: [];
67+
foreach ($subdirs as $subdir) {
68+
$subdirx = basename($subdir);
69+
self::$validLocaleLanguages[] = "{$filename}_{$subdirx}";
70+
}
6671
}
6772
}
6873
}

src/PhpSpreadsheet/Calculation/Engine/ArrayArgumentProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private static function evaluateVectorMatrixPair(callable $method, array $matrix
102102
}
103103

104104
/**
105-
* @param mixed[] $matrixIndexes
105+
* @param array<int|string> $matrixIndexes
106106
*
107107
* @return mixed[]
108108
*/

src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ public function count(): int
2121

2222
/**
2323
* Push a new entry onto the stack.
24+
*
25+
* @param int|string $value The value to test
2426
*/
25-
public function push(mixed $value): void
27+
public function push($value): void
2628
{
2729
$this->stack[$value] = $value;
2830
}
@@ -38,9 +40,9 @@ public function pop(): mixed
3840
/**
3941
* Test to see if a specified entry exists on the stack.
4042
*
41-
* @param mixed $value The value to test
43+
* @param int|string $value The value to test
4244
*/
43-
public function onStack(mixed $value): bool
45+
public function onStack($value): bool
4446
{
4547
return isset($this->stack[$value]);
4648
}

src/PhpSpreadsheet/Calculation/LookupRef/Matrix.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ public static function index(mixed $matrix, mixed $rowNum = 0, mixed $columnNum
135135
return self::extractRowValue($matrix, $rowKeys, $rowNum);
136136
}
137137

138-
$columnNum = $columnKeys[--$columnNum];
138+
$columnNum = $columnKeys[--$columnNum]; //* @phpstan-ignore-line
139139
if ($rowNum === 0) {
140140
return array_map(
141141
fn ($value): array => [$value],
142142
array_column($matrix, $columnNum)
143143
);
144144
}
145-
$rowNum = $rowKeys[--$rowNum];
145+
$rowNum = $rowKeys[--$rowNum]; //* @phpstan-ignore-line
146146
/** @var mixed[][] $matrix */
147147

148148
return $matrix[$rowNum][$columnNum];
@@ -159,7 +159,7 @@ private static function extractRowValue(array $matrix, array $rowKeys, int $rowN
159159
}
160160

161161
$rowNum = $rowKeys[--$rowNum];
162-
$row = $matrix[$rowNum];
162+
$row = $matrix[$rowNum]; //* @phpstan-ignore-line
163163
if (is_array($row)) {
164164
return [$rowNum => $row];
165165
}

src/PhpSpreadsheet/Calculation/LookupRef/Sort.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ private static function sortLookupArrayFromVector(array $sortArray, array $sortV
335335
// Building a new array in the correct (sorted) order works; but may be memory heavy for larger arrays
336336
$sortedArray = [];
337337
foreach ($sortVector as $index) {
338+
/** @var int|string $index */
338339
$sortedArray[] = $sortArray[$index];
339340
}
340341

0 commit comments

Comments
 (0)