A class constant must not be called class. it is reserved for class name fetching¶
Description¶
Class constants can use a lot of names, but not the name ‘class’. This is used by default to fetch the full name of the class, and there is no need to defined it.
Hence, it is not possible to define a class constant called ‘class’, case non-withstanding, as it conflict with the default constant.
Example¶
<?php
class X {
const CLASS = 1;
// the problem is case insensitive: class, Class, CLass... are all forbidden
}
?>
Solutions¶
Use another name for that constant.