These are only examples. They’re not even recommendations - standard does not say anything about case of namespaces.
These are only examples. They’re not even recommendations - standard does not say anything about case of namespaces.
I said they are examples and I didnt say they are recommendations. But to me, the point is that, for some reason, they preffer to use StudlyCaps and they show that in all namespaces of all PSRs. Is not that the place where php devs are looking for examples and recommendations of standards? I think so.
This is example of consistency. Treating this as an recommendation is just overinterpretation.
I am wondering why not consistency examples in lowercase or camelCase. Other vendors probably looked at those consistency examples and realized that all they need is exactly “consistency”, even although it was not a recommendation (till now).
Furthermore, if PHP-FIG would decide to make a recommendation about this in some moment, it is easy to see what would be the more consistent choice they would pick.
Here’s preliminary decision:
Not set in stone yet.
If we’re going with yiisoft, I’d rather use YiiSoft if that’s okay with you.
Doesn’t it require the package names to be yii-soft/xxx
?
True that
They didn’t explained. Maybe there was not reason (they flipped a coin) or reason is no longer valid.
Why Yiisoft/DI
and Yiisoft/Db/MySQL
instead of Yiisoft/Di
and Yiisoft/Db/Mysql
?
Because it makes sense not to lowercase in some cases such as MySQL.
For me, it does not make sense at all. It just adds another weird rule which is hard to follow. Now you need to think twice what case you should use for this word in a namespace (Is it acronym? Or maybe just weird variation like MySQL
or SQLite
)? It is all much simpler with strict pascal/camel case, when the case of words is ignored and uppercase letters are used only to indicate word separators. It is also consistent with convention used so far for class names (MysqlMutex
instead of MySQLMutex
)
After some practical application I tend to agree.
Hi everyone!
Well, I’m pretty late to add something valuable to this duscussion, but I still want to share my point of view, because I didn’t see this argument in messages above.
Personally I vote for PascalCase, because of:
This\Is\My\Very\Concrete\Class
- so, it’s more for detailed class nameservices\ConcreteService
That’s why I’m also against plural form for PascalCase namespaces and singular form for camelCase ones.