2

If the class name a is a abreviation in UPPER case like "CORS", the class name must still be in StudlyCaps like that:

class Cors
{
}

Below is the way of my preference, but i would to know if it is an anti-pattern:

class CORS
{
}
Daniel Faria
  • 1,476
  • 5
  • 24
  • 45

1 Answers1

2

This is clearly stated:

Class names MUST be declared in StudlyCaps.

Class constants MUST be declared in all upper case with underscore separators.

There are no exceptions granted in either case. CORS is a constant, Cors is a class. This is, by definition, an absolute requirement of the specification. If you want to adhere to a standard, you don't get to pick and choose which parts.

user229044
  • 232,980
  • 40
  • 330
  • 338
  • Maybe you dont understand the question. CORS is not a constant, is an abreviation like SWAT. – Daniel Faria Jan 09 '15 at 19:46
  • 1
    E's not suggesting that your CORS class is a constant, but rather that under the PSR-1 standard the identifier 'CORS' *must be* a constant. The equivalent class name is (and must be) 'Cors'. – Sam Wilson Feb 27 '15 at 02:07