On 29/04/2020 13:50, Côme Chilliet 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


Thanks. I clicked through a few results on GitHub (most of which were incorrect matches) and all 220 results from this search (nearly all of which were in a namespace, so unaffected): https://grep.app/search?q=class%20Attribute&case=true&words=true&filter[lang][0]=PHP

That yielded these further examples:

* https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/WikiLexicalData/+/master/OmegaWiki/Attribute.php * https://github.com/opensourcepos/opensourcepos/blob/master/application/models/Attribute.php * https://github.com/yupe/yupe/blob/master/protected/modules/store/models/Attribute.php
* https://github.com/leenooks/phpLDAPadmin/blob/master/lib/Attribute.php
* https://github.com/swipestripe/silverstripe-swipestripe/blob/master/code/product/Attribute.php
* https://github.com/Nerdmind/Blog/blob/master/core/namespace/Attribute.php
* https://github.com/MISP/MISP/blob/2.4/app/Model/Attribute.php

FWIW, most of these seem to be one-to-one mappings from a database table name to a data object.

There's also some hints that PrestaShop has a class name that would be affected; the actual file shipped is called "AttributeCore" (https://github.com/PrestaShop/PrestaShop/blob/develop/classes/Attribute.php), but there's some magic in the autoloader which may explain some of the references I'm seeing (https://github.com/PrestaShop/PrestaShop/blob/develop/classes/PrestaShopAutoload.php).


I’d expect a lot of projects to have an Attribute class, since there are things 
named attributes in lots of contexts.


The reason I wouldn't expect it to be that common is precisely because it's such a generic term, so projects might well avoid it as a) too vague; and b) too likely to conflict across the application.

It's certainly going to affect some people, but I'm not convinced it's more likely to conflict than any of the dozens of previous classes that have been added to core over the years. I imagine claiming it in the root namespace will have a similar impact to claiming "Error" in PHP 7.0, which I don't remember a big debate about that at the time.


Regards,

--
Rowan Tommins (né Collins)
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to