On Thu, May 12, 2016 at 9:02 PM, Rasmus Schultz <ras...@mindplay.dk> wrote:
> My problem with this PSR is you've created something that strongly > resembles function or constructor calls, but in reality is just > key/value pairs. > Its actually function calls, not constructors calls :-) > > That's confusing in itself, but also puts an unnecessary burden on > consumers who have to figure out how to map this apparently > "something" to "something real" - since it really isn't anything other > than pretty syntax for arrays associated with source-code elements. > > Did anybody look at my notes here? > > https://gist.github.com/mindplay-dk/ebd5e4f7da51da3c4e56232adef41b46 > > I think this is much simpler and far more flexible - it lets you do > what you're proposing with attributes (by annotating with simple > arrays) and also lets you create annotation classes. > > Would anyone care to comment? > What happens if you say <<$x>> and then call $reflection->getAttributes() in your eample? what is $x? That is the problem with immediately evaluating everything non "constant". There is no context. > > > On Thu, May 12, 2016 at 4:53 PM, Marco Pivetta <ocram...@gmail.com> wrote: > > On 12 May 2016 at 16:29, Benjamin Eberlei <kont...@beberlei.de> wrote: > > > >> On Tue, May 10, 2016 at 8:29 PM, Dmitry Stogov <dmi...@zend.com> wrote: > >> > >> > Hi internals, > >> > > >> > > >> > I've started voting on "PHP Attributes" RFC. > >> > > >> > > >> > https://wiki.php.net/rfc/attributes > >> > > >> > > >> > In my opinion, "PHP Attributes" might be a smart tool for PHP > extension, > >> > but it's not going to be the end of the world, if we decided to live > with > >> > doc-comments only. > >> > > >> > > >> > Thanks. Dmitry. > >> > > >> > >> I voted -1 > >> > >> Reasons: from a Doctrine Annotations maintainer perspective, either > getting > >> a list (without keys) of strings back or ast\nodes are not enough or way > >> too advanced for our use-case. The middle ground is missing where a > >> <php-constant> (Name borrowed from the RFC) can be an arbitrarily deep > >> nested array, that means getAttributes() does should not only return > >> "string" or ast\node as result for each attribute, to there should be a > way > >> to get arrays back. > >> > >> Example: > >> > >> https://gist.github.com/beberlei/18db9f7d5f6157b817348a58fa2aee25 > >> > >> greetings > >> Benjamin > >> > > > > Urgh, that is indeed quirky, and makes it unusable. > > > > Is that an implementation or a spec issue? I know PHP 5.6+ allows array > > constants, but I am not aware of whether that is in the specification. > > > > Indeed, show-stopper here. I'll have to vote "-1" for now, and wait for a > > version that either explicitly contains any constant expression or just > > supports arrays as constants. > > > > I'll also need to compile the branch and try it out myself before voting > > further: my bad for being hasty. > > > > Marco Pivetta > > > > http://twitter.com/Ocramius > > > > http://ocramius.github.com/ >