Skip to content

Commit a6e2e71

Browse files
authored
Merge branch 'master' into issue1425
2 parents 45fe36e + e16571e commit a6e2e71

File tree

279 files changed

+2192
-833
lines changed

Some content is hidden

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

279 files changed

+2192
-833
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ and this project adheres to [Semantic Versioning](https://semver.org).
3030
### Fixed
3131

3232
- Micro-optimization for excelToDateTimeObject. [Issue #4438](https://github.com/PHPOffice/PhpSpreadsheet/issues/4438) [PR #4442](https://github.com/PHPOffice/PhpSpreadsheet/pull/4442)
33+
- Removing Columns/Rows Containing Merged Cells. [Issue #282](https://github.com/PHPOffice/PhpSpreadsheet/issues/282) [PR #4465](https://github.com/PHPOffice/PhpSpreadsheet/pull/4465)
3334
- Print Area and Row Break. [Issue #1275](https://github.com/PHPOffice/PhpSpreadsheet/issues/1275) [PR #4450](https://github.com/PHPOffice/PhpSpreadsheet/pull/4450)
3435
- Copy Styles after insertNewColumnBefore. [Issue #1425](https://github.com/PHPOffice/PhpSpreadsheet/issues/1425) [PR #4468](https://github.com/PHPOffice/PhpSpreadsheet/pull/4468)
3536
- Xls Writer Treat Hyperlink Starting with # as Internal. [Issue #56](https://github.com/PHPOffice/PhpSpreadsheet/issues/56) [PR #4453](https://github.com/PHPOffice/PhpSpreadsheet/pull/4453)
37+
- ODS Handling of Ceiling and Floor. [Issue #407](https://github.com/PHPOffice/PhpSpreadsheet/issues/407) [PR #4466](https://github.com/PHPOffice/PhpSpreadsheet/pull/4466)
3638

3739
## 2025-04-16 - 4.2.0
3840

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Use [composer](https://getcomposer.org) to install PhpSpreadsheet into your proj
5151
composer require phpoffice/phpspreadsheet
5252
```
5353

54-
Or also download the documentation and samples if you plan to use them:
54+
Or also download the documentation and samples if you plan to use them (note that `git` must be in your path for this to work):
5555

5656
```sh
5757
composer require phpoffice/phpspreadsheet --prefer-source

infra/DocumentGenerator.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99

1010
class DocumentGenerator
1111
{
12+
private const EXCLUDED_FUNCTIONS = [
13+
'CEILING.ODS',
14+
'CEILING.XCL',
15+
'FLOOR.ODS',
16+
'FLOOR.XCL',
17+
];
18+
1219
/**
1320
* @param array<string, array{category: string, functionCall: string|string[], argumentCount: string, passCellReference?: bool, passByReference?: bool[], custom?: bool}> $phpSpreadsheetFunctions
1421
*/
@@ -23,6 +30,9 @@ public static function generateFunctionListByCategory($phpSpreadsheetFunctions):
2330
$result .= self::tableRow($lengths, ['Excel Function', 'PhpSpreadsheet Function']) . "\n";
2431
$result .= self::tableRow($lengths, null) . "\n";
2532
foreach ($phpSpreadsheetFunctions as $excelFunction => $functionInfo) {
33+
if (in_array($excelFunction, self::EXCLUDED_FUNCTIONS, true)) {
34+
continue;
35+
}
2636
if ($category === $functionInfo['category']) {
2737
$phpFunction = self::getPhpSpreadsheetFunctionText($functionInfo['functionCall']);
2838
$result .= self::tableRow($lengths, [$excelFunction, $phpFunction]) . "\n";
@@ -87,6 +97,9 @@ public static function generateFunctionListByName(array $phpSpreadsheetFunctions
8797
$result = "# Function list by name\n";
8898
$lastAlphabet = null;
8999
foreach ($phpSpreadsheetFunctions as $excelFunction => $functionInfo) {
100+
if (in_array($excelFunction, self::EXCLUDED_FUNCTIONS, true)) {
101+
continue;
102+
}
90103
$lengths = [25, 31, 37];
91104
if ($lastAlphabet !== $excelFunction[0]) {
92105
$lastAlphabet = $excelFunction[0];

phpstan-baseline.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
parameters:
2-
ignoreErrors: []
2+
ignoreErrors:

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ parameters:
2929
- '~^Parameter \#2 .* of static method PHPUnit\\Framework\\Assert\:\:assert\w+\(\) expects .*, .* given\.$~'
3030
#- '~Method .*rovider.* return type has no value type specified in iterable type array\.$~'
3131
#- '~Method .*rovider.* should return array but returns mixed\.$~'
32+
#- '~.* has parameter \$expectedResult with no value type specified in iterable type array\.$~'
3233
- identifier: missingType.iterableValue

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 53 additions & 16 deletions
Large diffs are not rendered by default.

src/PhpSpreadsheet/Calculation/Database/DGet.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public static function evaluate(array $database, array|null|int|string $field, a
4242
return ExcelError::NAN();
4343
}
4444

45+
/** @var array<null|float|int|string> */
4546
$row = array_pop($columnData);
4647

4748
return array_pop($row);

src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ protected static function fieldExtract(array $database, mixed $field): ?int
5353

5454
/** @var callable */
5555
$callable = 'strtoupper';
56-
/** @var non-empty-array $database */
57-
$fieldNames = array_map($callable, array_shift($database));
56+
$fieldNames = array_map($callable, array_shift($database)); //* @phpstan-ignore-line
5857
if (is_numeric($field)) {
5958
$field = (int) $field - 1;
6059
if ($field < 0 || $field >= count($fieldNames)) {
@@ -88,21 +87,24 @@ protected static function fieldExtract(array $database, mixed $field): ?int
8887
*/
8988
protected static function filter(array $database, array $criteria): array
9089
{
91-
/** @var array */
90+
/** @var mixed[] */
9291
$fieldNames = array_shift($database);
93-
/** @var array */
9492
$criteriaNames = array_shift($criteria);
9593

9694
// Convert the criteria into a set of AND/OR conditions with [:placeholders]
95+
/** @var string[] $criteriaNames */
9796
$query = self::buildQuery($criteriaNames, $criteria);
9897

9998
// Loop through each row of the database
99+
/** @var mixed[][] $criteriaNames */
100100
return self::executeQuery($database, $query, $criteriaNames, $fieldNames);
101101
}
102102

103103
/**
104104
* @param mixed[] $database The range of cells that makes up the list or database
105105
* @param mixed[][] $criteria
106+
*
107+
* @return mixed[]
106108
*/
107109
protected static function getFilteredColumn(array $database, ?int $field, array $criteria): array
108110
{
@@ -112,7 +114,7 @@ protected static function getFilteredColumn(array $database, ?int $field, array
112114

113115
// extract an array of values for the requested column
114116
$columnData = [];
115-
/** @var array $row */
117+
/** @var mixed[] $row */
116118
foreach ($database as $rowKey => $row) {
117119
$keys = array_keys($row);
118120
$key = $keys[$field] ?? null;

src/PhpSpreadsheet/Calculation/DateTimeExcel/Date.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Date
2828
* A Month name or abbreviation (English only at this point) such as 'January' or 'Jan' will still be accepted,
2929
* as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language.
3030
*
31-
* @param array|float|int|string $year The value of the year argument can include one to four digits.
31+
* @param array<mixed>|float|int|string $year The value of the year argument can include one to four digits.
3232
* Excel interprets the year argument according to the configured
3333
* date system: 1900 or 1904.
3434
* If year is between 0 (zero) and 1899 (inclusive), Excel adds that
@@ -39,7 +39,7 @@ class Date
3939
* 2008.
4040
* If year is less than 0 or is 10000 or greater, Excel returns the
4141
* #NUM! error value.
42-
* @param array|float|int|string $month A positive or negative integer representing the month of the year
42+
* @param array<mixed>|float|int|string $month A positive or negative integer representing the month of the year
4343
* from 1 to 12 (January to December).
4444
* If month is greater than 12, month adds that number of months to
4545
* the first month in the year specified. For example, DATE(2008,14,2)
@@ -48,7 +48,7 @@ class Date
4848
* number of months, plus 1, from the first month in the year
4949
* specified. For example, DATE(2008,-3,2) returns the serial number
5050
* representing September 2, 2007.
51-
* @param array|float|int|string $day A positive or negative integer representing the day of the month
51+
* @param array<mixed>|float|int|string $day A positive or negative integer representing the day of the month
5252
* from 1 to 31.
5353
* If day is greater than the number of days in the month specified,
5454
* day adds that number of days to the first day in the month. For
@@ -59,7 +59,7 @@ class Date
5959
* example, DATE(2008,1,-15) returns the serial number representing
6060
* December 16, 2007.
6161
*
62-
* @return array|DateTime|float|int|string Excel date/time serial value, PHP date/time serial value or PHP date/time object,
62+
* @return array<mixed>|DateTime|float|int|string Excel date/time serial value, PHP date/time serial value or PHP date/time object,
6363
* depending on the value of the ReturnDateType flag
6464
* If an array of numbers is passed as the argument, then the returned result will also be an array
6565
* with the same dimensions

src/PhpSpreadsheet/Calculation/DateTimeExcel/DateParts.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DateParts
2424
* PHP DateTime object, or a standard date string
2525
* Or can be an array of date values
2626
*
27-
* @return array|int|string Day of the month
27+
* @return array<mixed>|int|string Day of the month
2828
* If an array of numbers is passed as the argument, then the returned result will also be an array
2929
* with the same dimensions
3030
*/
@@ -65,7 +65,7 @@ public static function day(mixed $dateValue): array|int|string
6565
* PHP DateTime object, or a standard date string
6666
* Or can be an array of date values
6767
*
68-
* @return array|int|string Month of the year
68+
* @return array<mixed>|int|string Month of the year
6969
* If an array of numbers is passed as the argument, then the returned result will also be an array
7070
* with the same dimensions
7171
*/
@@ -104,7 +104,7 @@ public static function month(mixed $dateValue): array|string|int
104104
* PHP DateTime object, or a standard date string
105105
* Or can be an array of date values
106106
*
107-
* @return array|int|string Year
107+
* @return array<mixed>|int|string Year
108108
* If an array of numbers is passed as the argument, then the returned result will also be an array
109109
* with the same dimensions
110110
*/

0 commit comments

Comments
 (0)