On 28 June 2016 20:10:15 GMT+01:00, Pedro Cordeiro <pedronar...@gmail.com> wrote: >> << HttpMethod::post() >> // equivalent to static method-call >> HttpMethod::post() >> > >What would this, specifically, do? Would it call HttpMethod::post() >when >the class gets instantiated and return its return on a >ReflectionClass::getAnnotations()? Why is it necessary to be able to >evaluate expressions on annotations?
I'm not sure if it's definitely necessary, but the stated use case was for factories / named constructors. PHP only has one constructor per class, so it's not uncommon to have static createFromX methods. Since this will eventually evaluate as "new Foo(42)": << Foo(42) >> The idea is that this would be available to call a factory instead: << Foo::fromRoman('XLII') >> The neat thing being that by limiting the options to this, you can still extract a class name for every annotation. I say "eventually", because as proposed, this won't actually happen until you explicitly ask for the "instance" of the annotation. See previous examples. Regards, -- Rowan Collins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php