Skip to content

Commit

Permalink
Merge pull request #4031 from oleibman/powernullarg
Browse files Browse the repository at this point in the history
POWER Needs to Accept NULL Args
  • Loading branch information
oleibman committed May 16, 2024
2 parents 1314f82 + 989a44d commit f5c1e87
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com)
and this project adheres to [Semantic Versioning](https://semver.org).

## TBD - 2.2.0

### Added

- Nothing

### Changed

- Nothing

### Deprecated

- Nothing

### Moved

- Nothing

### Fixed

- Incorrect Reader CSV with BOM. [Issue #4028](https://github.com/PHPOffice/PhpSpreadsheet/issues/4028) [PR #4029](https://github.com/PHPOffice/PhpSpreadsheet/pull/4029)
- POWER Null/Bool Args. [PR #4031](https://github.com/PHPOffice/PhpSpreadsheet/pull/4031)

## 2024-05-11 - 2.1.0

### MINOR BREAKING CHANGE
Expand Down
6 changes: 3 additions & 3 deletions src/PhpSpreadsheet/Calculation/MathTrig/Operations.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ public static function mod(mixed $dividend, mixed $divisor): array|string|float
*
* Computes x raised to the power y.
*
* @param array|float|int|string $x Or can be an array of values
* @param array|float|int|string $y Or can be an array of values
* @param null|array|bool|float|int|string $x Or can be an array of values
* @param null|array|bool|float|int|string $y Or can be an array of values
*
* @return array|float|int|string The result, or a string containing an error
* If an array of numbers is passed as an argument, then the returned result will also be an array
* with the same dimensions
*/
public static function power(array|float|int|string $x, array|float|int|string $y): array|float|int|string
public static function power(null|array|bool|float|int|string $x, null|array|bool|float|int|string $y): array|float|int|string
{
if (is_array($x) || is_array($y)) {
return self::evaluateArrayArguments([self::class, __FUNCTION__], $x, $y);
Expand Down
5 changes: 5 additions & 0 deletions tests/data/Calculation/MathTrig/POWER.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,9 @@
],
['#VALUE!', 'x', 2],
['#VALUE!', 2, 'x'],
'exponent is null' => [1, 2, null],
'base is null' => [0, null, 2],
'both null' => ['#NUM!', null, null],
'exponent is bool' => [2, 2, true],
'base is bool' => [0, false, 2],
];

0 comments on commit f5c1e87

Please sign in to comment.