Re: [RFC][DISCUSSION] Object type hint
| From: | Michał Brzuchalski | Date: | Mon, 24 Oct 2016 05:24:17 +0000 |
| Subject: | Re: [RFC][DISCUSSION] Object type hint | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96575@lists.php.net to get a copy of this message | ||
24.10.2016 07:05 "Stanislav Malyshev" <smalyshev@gmail.com> napisał(a):
>
> Hi!
>
> > In the same way that Iterable type hint allows you to safely do a
> > foreach on an argument, object allows you to safely use property
> > accessor syntax (i.e. ->). For me it would be most useful in lower
> > level utility classes.
>
> Not sure I get this point. How you can safely use -> if you have no idea
> what object you've got? You certainly don't expect every object to have
> the same properties?
You don't need is_object any more you can safely check instanceof, use
Reflection, serialize etc.
>
> --
> Stas Malyshev
> smalyshev@gmail.com