Skip to content

Commit

Permalink
Merge pull request #34 from derrabus/bugfix/implicit-nullable
Browse files Browse the repository at this point in the history
Make nullable parameter types explicit
  • Loading branch information
dbu authored Mar 15, 2024
2 parents 13d7636 + 35fa82d commit 5caa0bc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 1.3.1 - unreleased

- Made nullable parameter types explicit (PHP 8.4 compatibility)

## 1.3.0 - 2024-01-04

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/FulfilledPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct($result)
$this->result = $result;
}

public function then(callable $onFulfilled = null, callable $onRejected = null)
public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
{
if (null === $onFulfilled) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface Promise
*
* @return Promise a new resolved promise with value of the executed callback (onFulfilled / onRejected)
*/
public function then(callable $onFulfilled = null, callable $onRejected = null);
public function then(?callable $onFulfilled = null, ?callable $onRejected = null);

/**
* Returns the state of the promise, one of PENDING, FULFILLED or REJECTED.
Expand Down
2 changes: 1 addition & 1 deletion src/RejectedPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(\Throwable $exception)
$this->exception = $exception;
}

public function then(callable $onFulfilled = null, callable $onRejected = null)
public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
{
if (null === $onRejected) {
return $this;
Expand Down

0 comments on commit 5caa0bc

Please sign in to comment.