What I want to achieve:
abstract final class NoticeTypes {
const ERROR = "error";
const WARNING = "warning";
const INFO = "info";
const SUCCESS = "success";
static function getAll() {
$oClass = new ReflectionClass(__CLASS__);
return $oClass->getConstants();
}
}
The interpreter does not allow this:
Fatal error: Cannot use the final modifier on an abstract class in ...
However I want to use this as kind of a "constant never-modifiable enum". It should:
- not be allowed to be extended
- not be allowed to be instantiated
Why does the Interpreter dissallow this and how shall I implement it?