Re: Ensure correct signatures for PHP magic methods
| From: | Gabriel Caruso | Date: | Mon, 06 Jan 2020 09:29:17 +0000 |
| Subject: | Re: Ensure correct signatures for PHP magic methods | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108004@lists.php.net to get a copy of this message | ||
Hello George
On Mon, 6 Jan 2020 at 01:28, G. P. B. <george.banyard@gmail.com> wrote:
> On Sun, 5 Jan 2020 at 18:44, Gabriel Caruso <carusogabriel34@gmail.com>
> wrote:
>
>> Hello Internals,
>>
>> I have a PR proposing to start checking the signatures for PHP magic
>> methods in the next major version of PHP:
>> https://github.com/php/php-src/pull/4177. The idea for this
>> PR came from
>> https://bugs.php.net/bug.php?id=69718.
>>
>> I'd like to hear your opinion before putting more effort into this :)
>>
>> Best regards.
>>
>
> Hello Gabriel,
>
> I do like the idea, but I would agree that I'd want void as the return
> type instead of a no return compile error.
> Other than that +1 from my side.
>
The reason why I didn't want to go with
__construct(): void, for example,
is because some articles that I've read say that Constructors and
Destructors do not return anything:
- https://www.geeksforgeeks.org/php-constructors-and-destructors/
- https://docs.phpdoc.org/references/phpdoc/tags/return.html
- https://stackoverflow.com/questions/11904255/constructor-returning-value
Also, the community has pushing this standard, as it can be seen in
https://github.com/slevomat/coding-standard#slevomatcodingstandardtypehintsreturntypehint-
.
Best regards,
>
> Best regards
>
> George P. Banyard
>