-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make nullable parameter types explicit #34
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. afaik this is a BC break for anything implementing the promise, right? if it is, we should bump the major version number. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the code is 100% equivalent. This has always been a nullable type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's an example where I examine the type with reflection: One parameter is declared There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks. i also added a class that implements the interface and changes thanks for the clarification, then we can savely merge this. |
||
|
||
/** | ||
* Returns the state of the promise, one of PENDING, FULFILLED or REJECTED. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this going to be a BC break of PHP 8.4, or only become deprecated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP 8.4 triggers a
E_DEPRECATED
error when it loads a file with this kind of parameter type declaration.