class name always StudlyCaps or there's exceptions on PSR-1?

1.1k Views Asked by At

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
{
}
1

There are 1 best solutions below

2
On

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.