On 2 December 2016 at 14:46, Andrey Andreev <n...@devilix.net> wrote:

> It enables magic behavior, that's the opposite of enforcement ... If you
> want to enFORCE something, you force the developer to do something, you
> don't auto-magically do the thing for them.


This magic behaviour would be for enforcement, because you are now
enforcing that the passed in type is acceptable to the contract of
Collection. It can be an array, because arrays can be converted to a
Collection, and it is down to the __cast() method to determine whether that
is a suitable conversion, but it allows you to enforce a suitable parameter
is passed in. Currently, to accept bot ha Collection and an array, you
would have to not enforce anything, and inside of the method handle the
conversion or exceptions.

Reply via email to