Re: [RFC] Amendments to Attributes

From: Date: Wed, 20 May 2020 22:13:18 +0000
Subject: Re: [RFC] Amendments to Attributes
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-110225@lists.php.net to get a copy of this message
On Wed, May 20, 2020 at 7:53 PM Ben Ramsey <ben@benramsey.com> wrote: > > On May 20, 2020, at 12:07, Benjamin Eberlei <kontakt@beberlei.de> wrote: > > > > 2. Rename PhpAttribute to Attribute in global namespace (independent of > the > > namespace RFC) > > > I suggested in a previous thread that we consider renaming > PhpAttribute > to UserlandAttribute, since this is the intent of the > attribute, and it > helps distinguish it from CompilerAttribute. > > I noticed that the compiler attribute is actually named > PhpCompilerAttribute, so unless we change its name to > CompilerAttribute, I don’t think it makes sense to change > PhpAttribute > to Attribute. Perhaps we change it to > PhpUserlandAttribute, for clarity? > Ah that's a good point that still needs to be clarified. We realized that PhpAttribute and PhpCompilerAttribute should be merged, because the difference doesn't make a difference to userland code and it complicates things. For example enforcing that PhpCompilerAttribute is just on internal classes would not work for generated stub code in Phan/Psalm and so on that "describe" internal code by imitating it in userland. This would not be allowed by the current implementation and lead to a compiler error, lets say if we imitated Deprecated for documentation purposes: <?php <<PhpCompilerAttribute>> class Deprecated {} This file could not be compiled by current implementation as an error would prevent Userland Deprecated class from using PhpCompilerAttribute. > > Cheers, > Ben >

« previous php.internals (#110225) next »