An initial \ is only necessary if you add a namespace to the top of the
file.
Changing a class to use a namespace also completely changes it's class
name and breaks all code depending on that class, namely extensions. And
there is absolutely no good reason to add a namespace to existing code
strong enough to outweigh the fact that we'll be breaking extensions.
So I see absolutely no reason to go adding \ into files.
--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [
]
On Thu, 17 May 2012 10:00:28 -0700, Terry Chay <tchay(a)wikimedia.org> wrote:
We probably should consider prefixing TLD classes
(like SPL Iterators
and such) with a \ just to be compatible with namespacing down the road.
On May 17, 2012, at 3:13 AM, Niklas Laxström wrote:
> On 17 May 2012 01:36, Jeroen De Dauw <jeroendedauw(a)gmail.com> wrote:
>> Hey,
>>
>> I am not aware of any guidelines regarding the usage of PHP namespaces
>> in
>> MediaWiki and di not find any on
MediaWiki.org. Not surprising since
>> 1.20
>> is the first release in which we can actually use it. So I'm curious on
>> peoples thoughts on how to use this new features, if at all, in core
>> and in
>> extensions. As far as I get it, we cannot simply put it into core
>> without
>> breaking compat all over he place, but could gradually introduce it
>> for new
>> components. For new extensions it's a lot easier of course, which
>> happens
>> to be the use case I'm currently facing, and wondering what to best do.
>> MediaWiki\ExtensionName seems like a reasonable NS for extension
>> classes.
>
> I just came across to a reference to PSR-0 while researching another
> unrelated thing.
> Little bit of googling gives this:
https://gist.github.com/1234504
>
> Seems to be somewhat relevant to this discussion, although pretty much
> incompatible with what we do in MediaWiki currently.
> -Niklas
>
> --
> Niklas Laxström