Skip to content

Commit 5caa0bc

Browse files
authored
Merge pull request #34 from derrabus/bugfix/implicit-nullable
Make nullable parameter types explicit
2 parents 13d7636 + 35fa82d commit 5caa0bc

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 1.3.1 - unreleased
4+
5+
- Made nullable parameter types explicit (PHP 8.4 compatibility)
6+
37
## 1.3.0 - 2024-01-04
48

59
### Fixed

Diff for: src/FulfilledPromise.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct($result)
2222
$this->result = $result;
2323
}
2424

25-
public function then(callable $onFulfilled = null, callable $onRejected = null)
25+
public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
2626
{
2727
if (null === $onFulfilled) {
2828
return $this;

Diff for: src/Promise.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ interface Promise
4141
*
4242
* @return Promise a new resolved promise with value of the executed callback (onFulfilled / onRejected)
4343
*/
44-
public function then(callable $onFulfilled = null, callable $onRejected = null);
44+
public function then(?callable $onFulfilled = null, ?callable $onRejected = null);
4545

4646
/**
4747
* Returns the state of the promise, one of PENDING, FULFILLED or REJECTED.

Diff for: src/RejectedPromise.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct(\Throwable $exception)
1919
$this->exception = $exception;
2020
}
2121

22-
public function then(callable $onFulfilled = null, callable $onRejected = null)
22+
public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
2323
{
2424
if (null === $onRejected) {
2525
return $this;

0 commit comments

Comments
 (0)