isset()やproperty_exists()では正しく検出できないので
defined()を使う。
if(!defined('className::CONSTANT_NAME')){
// className::CONSTANT_NAMEが存在しないときのエラー処理
return null;
}
return className::CONSTANT_NAME;
参考
https://stackoverflow.com/questions/24159178/check-if-a-class-constant-exists/50697766