Use getPhobjectClassConstant() to access class constants
Summary: Ref T9494. Depends on D14216. Remove 10 copies of this code. Test Plan: Ran `arc unit --everything`, browsed Config > Modules, clicked around Herald / etc. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9494 Differential Revision: https://secure.phabricator.com/D14217
This commit is contained in:
@@ -3,17 +3,7 @@
|
||||
abstract class PhabricatorPHIDType extends Phobject {
|
||||
|
||||
final public function getTypeConstant() {
|
||||
$class = new ReflectionClass($this);
|
||||
|
||||
$const = $class->getConstant('TYPECONST');
|
||||
if ($const === false) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'%s class "%s" must define a %s property.',
|
||||
__CLASS__,
|
||||
get_class($this),
|
||||
'TYPECONST'));
|
||||
}
|
||||
$const = $this->getPhobjectClassConstant('TYPECONST');
|
||||
|
||||
if (!is_string($const) || !preg_match('/^[A-Z]{4}$/', $const)) {
|
||||
throw new Exception(
|
||||
|
||||
Reference in New Issue
Block a user