-
-
Save Danack/aee8c9b6bd87a086b704a5aa6da29530 to your computer and use it in GitHub Desktop.
changes_magic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s/ | |
"Ensure correct magic methods' signatures when typed" | |
/ | |
"Ensure correct signatures of magic methods" | |
/ | |
Introduction | |
It is currently possible to write magic methods that have signatures that don't match the signature expected, such as `__toString() : float` or `__isset() : Closure`. | |
This behaviour of allowing incorrect signatures was reported as [a bug](https://bugs.php.net/69718). | |
As ensuring magic methods have correct signatures is a backward compatible break for code that currently has incorrect signatures, this change would only be appropriate in a major PHP release. | |
s/ | |
This RFC proposes to introduce the following signatures checks when magic methods are typed. | |
Important: only, and only if, any of the listed magic methods use type hints and/or return types, these checks will be performed. In case they don't have types declared, nothing specific will happen. | |
/ | |
This RFC proposes to add parameter and return types per the following details. Other magic methods will be not modified. | |
/ | |
s/ | |
The __construct and __destruct methods won't suffer any change. | |
/ | |
The __construct and __destruct methods won't be changed. | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment