It would be beneficial to not reduce this to stringly-typed programmer
(again), as Dan mentioned.

Returning something like a ReflectionType instance (which then implements
__toString) would be much simpler, efficient and easy to use.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 4 June 2016 at 18:05, Fleshgrinder <p...@fleshgrinder.com> wrote:

> On 6/4/2016 4:34 PM, Dan Ackroyd wrote:
> > Hello FG,
> >
> > Having a standard way to get the type of a variable, that matches the
> > name of how it appears in PHP is a good idea.
> >
> > The 'extended' parameter is not such a good idea, for various reasons
> > but mainly because it's simpler for people to call is_callable() as
> > well as typeof, rather than having to interpret the extended string to
> > tell if a string represents a callable.
> >
> > The same is true for floats; it is easier for people to call
> > is_infinite or is_nan rather than searching inside a string for
> > 'infinite' or 'invalid'.
> >
> > cheers
> > Dan
> >
>
> Hi Dan,
>
> many thanks for your feedback. This is definitely NOT the purpose of the
> extended mode, and I tried to emphasize this in the RFC. I also think it
> would be very bad to introduce anything that would compete with any of
> the existing is_* functions. It is also the reason why the strings are
> very verbose and human readable: they are meant for debug and error
> messages.
>
>   // complicated code ...
>   // error branch {{{
>
>     $type = typeof($v, true);
>     throw new Ex('Expected Foo but got ' . $type);
>
>   // }}}
>   // complicated code ...
>
> This matches the main usage -- according to my research -- of the
> existing gettype() function in userland software. :)
>
> --
> Richard "Fleshgrinder" Fussenegger
>
>

Reply via email to