Re: Renaming PhpAttribute to Attribute
| From: | Derick Rethans | Date: | Wed, 29 Apr 2020 14:03:15 +0000 |
| Subject: | Re: Renaming PhpAttribute to Attribute | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109925@lists.php.net to get a copy of this message | ||
On Wed, 29 Apr 2020, Nikita Popov wrote:
> On Wed, Apr 29, 2020 at 3:24 PM Côme Chilliet <
> come.chilliet@fusiondirectory.org> wrote:
>
> > Le mercredi 29 avril 2020, 14:58:02 CEST Nikita Popov a écrit :
> > > On Wed, Apr 29, 2020 at 2:51 PM Côme Chilliet <
> > > come.chilliet@fusiondirectory.org> wrote:
> > > > Le mardi 28 avril 2020, 18:59:22 CEST Benas IML a écrit :
> > > >
> > > > > Could you provide any examples as to where '\Attribute' is
> > > > > being used in the wild? I haven't seen a single project that
> > > > > has an Attribute class and uses the global namespace.
> > > >
> > > > We do use an Attribute class in FusionDirectory:
> > > >
> > > > https://gitlab.fusiondirectory.org/fusiondirectory/fd/-/blob/1.4-dev/include/simpleplugin/class_Attribute.inc
> > > >
> > > > I’d expect a lot of projects to have an Attribute class, since
> > > > there are things named attributes in lots of contexts.
> > >
> > > Great! You have discovered a nice opportunity to finally move your
> > > code into the FusionDirectory namespace.
> > >
> > > PHP reserves (de facto if not de jure) the global namespace for
> > > it's own purposes. If you want to place classes in the global
> > > namespace, without prefixing them, that's fine, but please don't
> > > complain if there are clashes.
> >
> > This is a bit harsh, I did not complain, I provided an example of
> > project to someone who wrote «Could you provide any examples». I
> > can, so I did.
>
> Sorry for the snark!
>
> To rephrase my mail in a more neutral fashion: I don't think we should
> be taking potential naming clashes *in the global namespace* into
> account at all, independently of whether we know that specific clashes
> exist or not.
This is also documented already in the manual:
https://www.php.net/manual/en/userlandnaming.rules.php
"PHP owns the top-level namespace but tries to find decent descriptive
names and avoid any obvious clashes."
cheers,
Derick
--
PHP 7.4 Release Manager
Host of PHP Internals News: https://phpinternals.news
Like Xdebug? Consider supporting me: https://xdebug.org/support
https://derickrethans.nl | https://xdebug.org | https://dram.io
twitter: @derickr and @xdebug