Re: Inline typecasting / typehinting for classes and interfaces

From: Date: Tue, 14 Aug 2012 13:51:20 +0000
Subject: Re: Inline typecasting / typehinting for classes and interfaces
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-62143@lists.php.net to get a copy of this message
On Tue, Aug 14, 2012 at 1:46 AM, Stan Vass <sv_forums@fmethod.com> wrote: > I've felt the need for this for some time. > > Proposed syntax: > ------------------------- > > $x = (InterfaceName) $container->service; I'm against this. Let's be honest, how different is this that an optionally static type? InterfaceName $x = $container->service; To be clear, I WANT optionally static typing. For the most part, type-hinting in class methods solves the static typing needs, but if we were able to declare a class member to be a certain type that would be another significant improvement. I have a proposal in the works, but I don't want to hijack your thread. To sum up: I think we need something LIKE what you are proposing, but I'm against this particular proposal.

« previous php.internals (#62143) next »