Hello Gabriel,

>>> https://wiki.php.net/rfc/magic-methods-signature
>
> RFC and implementation have been updated.
>

There are a few things I don't understand from the RFC, let me list from
the examples.

> This RFC proposes to introduce the following signatures checks when magic
methods are typed:

My general question is: what does this mean exactly?


> /** @return mixed */
> Foo::__call(string $name, array $arguments);

> /** @return mixed */
> Foo::__callStatic(string $name, array $arguments);

> /** @return mixed */
> Foo::__get(string $name);


Does this mean we won't be allowed to declare __call($name, $arguments);?

This looks against LSP to me.


> Foo::__clone(): void;

> /** @param mixed $args */
> Foo::__construct($args): void;

> Foo::__destruct(): void;

Is void going to be mandatory now? This should be specified in the RFC I
think.

If it's about to allow void where it wasn't allowed, I'm personally not
convinced it's a good idea to open one more code-style war on this topic.
When there is only one way to declare something, there is no need to come
to any agreement about the code style. That's a win.


> Foo::__isset(string $name): bool;
> Foo::__unset(string $name): void;

Same comment about LSP, but also about the type: isn't it allowed to have
integers as keys? How does this play with strict_type and array access?


> /** @param mixed $value */
> Foo::__set(string $name, $value): void;


Is the return now going to be mandatory?

And the BIG question: is all this worth the BC break?

Thanks,

Nicolas

Reply via email to