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:
epriestley
2015-10-01 16:56:21 -07:00
parent c95fcb8970
commit e431ab2189
10 changed files with 12 additions and 196 deletions

View File

@@ -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(