Re: Proposal for RFC: get_class_constants()

From: Date: Sat, 14 Dec 2013 13:51:05 +0000
Subject: Re: Proposal for RFC: get_class_constants()
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-70637@lists.php.net to get a copy of this message
On 14 December 2013 14:33, Lester Caine <lester@lsces.co.uk> wrote: If it is the only reason you are having to activate reflections? Reflections would seem to have a place, but is it really necessary to add yet another layer when most of the time it's function is provided better by IDE tools anyway? This is a simple example of a current hole in the core PHP tools which would help a section of developers who don't need the overheads of additional layers. @Lester additional layer is still better than *yet another shortcut*. Since we already have the feature, introducing another flavor for it seems a bit of an overkill, especially if it also has to be maintained. Any userland implementation can handle this by also being fast enuff: function get_class_constants($className) { static $cached = []; if (isset($cached[$className])) { return $cached[$className]; } return $cached[$class] = (new \ReflectionClass($class))->getConstants(); } Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/

« previous php.internals (#70637) next »