1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Use __CLASS__ instead of hard-coding class names

Summary: Use `__CLASS__` instead of hard-coding class names. Depends on D12605.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: hach-que, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12806
This commit is contained in:
Joshua Spence 2015-05-14 06:50:28 +10:00
parent f3d5e22a45
commit acb45968d8
78 changed files with 268 additions and 233 deletions

View file

@ -650,7 +650,7 @@ final class AphrontRequest {
* safe. * safe.
*/ */
public function isProxiedClusterRequest() { public function isProxiedClusterRequest() {
return (bool)AphrontRequest::getHTTPHeader('X-Phabricator-Cluster'); return (bool)self::getHTTPHeader('X-Phabricator-Cluster');
} }

View file

@ -65,7 +65,10 @@ abstract class AphrontProxyResponse extends AphrontResponse {
final public function buildResponseString() { final public function buildResponseString() {
throw new Exception( throw new Exception(
'AphrontProxyResponse must implement reduceProxyResponse().'); pht(
'%s must implement %s.',
__CLASS__,
'reduceProxyResponse()'));
} }
} }

View file

@ -154,7 +154,7 @@ abstract class AphrontResponse {
array_walk_recursive( array_walk_recursive(
$object, $object,
array('AphrontResponse', 'processValueForJSONEncoding')); array(__CLASS__, 'processValueForJSONEncoding'));
$response = json_encode($object); $response = json_encode($object);

View file

@ -60,19 +60,19 @@ final class PhabricatorAuditStatusConstants {
public static function getStatusIcon($code) { public static function getStatusIcon($code) {
switch ($code) { switch ($code) {
case PhabricatorAuditStatusConstants::AUDIT_NOT_REQUIRED: case self::AUDIT_NOT_REQUIRED:
case PhabricatorAuditStatusConstants::RESIGNED: case self::RESIGNED:
$icon = PHUIStatusItemView::ICON_OPEN; $icon = PHUIStatusItemView::ICON_OPEN;
break; break;
case PhabricatorAuditStatusConstants::AUDIT_REQUIRED: case self::AUDIT_REQUIRED:
case PhabricatorAuditStatusConstants::AUDIT_REQUESTED: case self::AUDIT_REQUESTED:
$icon = PHUIStatusItemView::ICON_WARNING; $icon = PHUIStatusItemView::ICON_WARNING;
break; break;
case PhabricatorAuditStatusConstants::CONCERNED: case self::CONCERNED:
$icon = PHUIStatusItemView::ICON_REJECT; $icon = PHUIStatusItemView::ICON_REJECT;
break; break;
case PhabricatorAuditStatusConstants::ACCEPTED: case self::ACCEPTED:
case PhabricatorAuditStatusConstants::CLOSED: case self::CLOSED:
$icon = PHUIStatusItemView::ICON_ACCEPT; $icon = PHUIStatusItemView::ICON_ACCEPT;
break; break;
default: default:

View file

@ -115,7 +115,7 @@ final class PhabricatorAuditInlineComment
private static function buildProxies(array $inlines) { private static function buildProxies(array $inlines) {
$results = array(); $results = array();
foreach ($inlines as $key => $inline) { foreach ($inlines as $key => $inline) {
$results[$key] = PhabricatorAuditInlineComment::newFromModernComment( $results[$key] = self::newFromModernComment(
$inline); $inline);
} }
return $results; return $results;

View file

@ -361,7 +361,7 @@ abstract class PhabricatorApplication implements PhabricatorPolicyInterface {
public static function getByClass($class_name) { public static function getByClass($class_name) {
$selected = null; $selected = null;
$applications = PhabricatorApplication::getAllApplications(); $applications = self::getAllApplications();
foreach ($applications as $application) { foreach ($applications as $application) {
if (get_class($application) == $class_name) { if (get_class($application) == $class_name) {

View file

@ -270,7 +270,7 @@ final class PhabricatorCaches {
} }
private static function addNamespaceToCaches(array $caches) { private static function addNamespaceToCaches(array $caches) {
$namespace = PhabricatorCaches::getNamespace(); $namespace = self::getNamespace();
if (!$namespace) { if (!$namespace) {
return $caches; return $caches;
} }

View file

@ -200,7 +200,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
public function getTerseSummary(PhabricatorUser $viewer) { public function getTerseSummary(PhabricatorUser $viewer) {
$until = phabricator_date($this->dateTo, $viewer); $until = phabricator_date($this->dateTo, $viewer);
if ($this->status == PhabricatorCalendarEvent::STATUS_SPORADIC) { if ($this->status == self::STATUS_SPORADIC) {
return pht('Sporadic until %s', $until); return pht('Sporadic until %s', $until);
} else { } else {
return pht('Away until %s', $until); return pht('Away until %s', $until);

View file

@ -25,7 +25,7 @@ abstract class CelerityPhysicalResources extends CelerityResources {
$resources_map = array(); $resources_map = array();
$resources_list = id(new PhutilSymbolLoader()) $resources_list = id(new PhutilSymbolLoader())
->setAncestorClass('CelerityPhysicalResources') ->setAncestorClass(__CLASS__)
->loadObjects(); ->loadObjects();
foreach ($resources_list as $resources) { foreach ($resources_list as $resources) {

View file

@ -100,9 +100,9 @@ abstract class ConduitAPIMethod
$name = $this->getAPIMethodName(); $name = $this->getAPIMethodName();
$map = array( $map = array(
ConduitAPIMethod::METHOD_STATUS_STABLE => 0, self::METHOD_STATUS_STABLE => 0,
ConduitAPIMethod::METHOD_STATUS_UNSTABLE => 1, self::METHOD_STATUS_UNSTABLE => 1,
ConduitAPIMethod::METHOD_STATUS_DEPRECATED => 2, self::METHOD_STATUS_DEPRECATED => 2,
); );
$ord = idx($map, $this->getMethodStatus(), 0); $ord = idx($map, $this->getMethodStatus(), 0);

View file

@ -22,7 +22,7 @@ final class PhabricatorConduitLogQuery
$this->buildOrderClause($conn_r), $this->buildOrderClause($conn_r),
$this->buildLimitClause($conn_r)); $this->buildLimitClause($conn_r));
return $table->loadAllFromArray($data);; return $table->loadAllFromArray($data);
} }
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {

View file

@ -46,7 +46,7 @@ final class PhabricatorConduitTokenQuery
$this->buildOrderClause($conn_r), $this->buildOrderClause($conn_r),
$this->buildLimitClause($conn_r)); $this->buildLimitClause($conn_r));
return $table->loadAllFromArray($data);; return $table->loadAllFromArray($data);
} }
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {

View file

@ -65,7 +65,7 @@ final class PhabricatorConduitToken
// to expire) so generate a new token. // to expire) so generate a new token.
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
$token = PhabricatorConduitToken::initializeNewToken( $token = self::initializeNewToken(
$user->getPHID(), $user->getPHID(),
self::TYPE_CLUSTER); self::TYPE_CLUSTER);
$token->save(); $token->save();

View file

@ -113,7 +113,7 @@ abstract class PhabricatorSetupCheck {
final public static function runAllChecks() { final public static function runAllChecks() {
$symbols = id(new PhutilSymbolLoader()) $symbols = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorSetupCheck') ->setAncestorClass(__CLASS__)
->setConcreteOnly(true) ->setConcreteOnly(true)
->selectAndLoadSymbols(); ->selectAndLoadSymbols();

View file

@ -187,7 +187,7 @@ abstract class PhabricatorApplicationConfigOptions extends Phobject {
final public static function loadAll($external_only = false) { final public static function loadAll($external_only = false) {
$symbols = id(new PhutilSymbolLoader()) $symbols = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorApplicationConfigOptions') ->setAncestorClass(__CLASS__)
->setConcreteOnly(true) ->setConcreteOnly(true)
->selectAndLoadSymbols(); ->selectAndLoadSymbols();
@ -204,8 +204,12 @@ abstract class PhabricatorApplicationConfigOptions extends Phobject {
$nclass = $symbol['name']; $nclass = $symbol['name'];
throw new Exception( throw new Exception(
"Multiple PhabricatorApplicationConfigOptions subclasses have the ". pht(
"same key ('{$key}'): {$pclass}, {$nclass}."); "Multiple %s subclasses have the same key ('%s'): %s, %s.",
__CLASS__,
$key,
$pclass,
$nclass));
} }
$groups[$key] = $obj; $groups[$key] = $obj;
} }
@ -222,8 +226,10 @@ abstract class PhabricatorApplicationConfigOptions extends Phobject {
$key = $option->getKey(); $key = $option->getKey();
if (isset($options[$key])) { if (isset($options[$key])) {
throw new Exception( throw new Exception(
"Mulitple PhabricatorApplicationConfigOptions subclasses contain ". pht(
"an option named '{$key}'!"); "Mulitple % subclasses contain an option named '%s'!",
__CLASS__,
$key));
} }
$options[$key] = $option; $options[$key] = $option;
} }

View file

@ -407,7 +407,7 @@ final class ConpherenceThread extends ConpherenceDAO
PhabricatorUser $viewer, PhabricatorUser $viewer,
array $conpherences) { array $conpherences) {
assert_instances_of($conpherences, 'ConpherenceThread'); assert_instances_of($conpherences, __CLASS__);
$grouped = mgroup($conpherences, 'getIsRoom'); $grouped = mgroup($conpherences, 'getIsRoom');
$rooms = idx($grouped, 1, array()); $rooms = idx($grouped, 1, array());

View file

@ -12,7 +12,7 @@ final class DarkConsoleErrorLogPluginAPI {
// reenter autoloaders). // reenter autoloaders).
PhutilReadableSerializer::printableValue(null); PhutilReadableSerializer::printableValue(null);
PhutilErrorHandler::setErrorListener( PhutilErrorHandler::setErrorListener(
array('DarkConsoleErrorLogPluginAPI', 'handleErrors')); array(__CLASS__, 'handleErrors'));
} }
public static function enableDiscardMode() { public static function enableDiscardMode() {

View file

@ -68,8 +68,8 @@ final class PhabricatorDaemonLogQuery
} }
protected function willFilterPage(array $daemons) { protected function willFilterPage(array $daemons) {
$unknown_delay = PhabricatorDaemonLogQuery::getTimeUntilUnknown(); $unknown_delay = self::getTimeUntilUnknown();
$dead_delay = PhabricatorDaemonLogQuery::getTimeUntilDead(); $dead_delay = self::getTimeUntilDead();
$status_running = PhabricatorDaemonLog::STATUS_RUNNING; $status_running = PhabricatorDaemonLog::STATUS_RUNNING;
$status_unknown = PhabricatorDaemonLog::STATUS_UNKNOWN; $status_unknown = PhabricatorDaemonLog::STATUS_UNKNOWN;

View file

@ -22,71 +22,71 @@ final class DifferentialAction {
public static function getBasicStoryText($action, $author_name) { public static function getBasicStoryText($action, $author_name) {
switch ($action) { switch ($action) {
case DifferentialAction::ACTION_COMMENT: case self::ACTION_COMMENT:
$title = pht('%s commented on this revision.', $title = pht('%s commented on this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_ACCEPT: case self::ACTION_ACCEPT:
$title = pht('%s accepted this revision.', $title = pht('%s accepted this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_REJECT: case self::ACTION_REJECT:
$title = pht('%s requested changes to this revision.', $title = pht('%s requested changes to this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_RETHINK: case self::ACTION_RETHINK:
$title = pht('%s planned changes to this revision.', $title = pht('%s planned changes to this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_ABANDON: case self::ACTION_ABANDON:
$title = pht('%s abandoned this revision.', $title = pht('%s abandoned this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_CLOSE: case self::ACTION_CLOSE:
$title = pht('%s closed this revision.', $title = pht('%s closed this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_REQUEST: case self::ACTION_REQUEST:
$title = pht('%s requested a review of this revision.', $title = pht('%s requested a review of this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_RECLAIM: case self::ACTION_RECLAIM:
$title = pht('%s reclaimed this revision.', $title = pht('%s reclaimed this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_UPDATE: case self::ACTION_UPDATE:
$title = pht('%s updated this revision.', $title = pht('%s updated this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_RESIGN: case self::ACTION_RESIGN:
$title = pht('%s resigned from this revision.', $title = pht('%s resigned from this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_SUMMARIZE: case self::ACTION_SUMMARIZE:
$title = pht('%s summarized this revision.', $title = pht('%s summarized this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_TESTPLAN: case self::ACTION_TESTPLAN:
$title = pht('%s explained the test plan for this revision.', $title = pht('%s explained the test plan for this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_CREATE: case self::ACTION_CREATE:
$title = pht('%s created this revision.', $title = pht('%s created this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_ADDREVIEWERS: case self::ACTION_ADDREVIEWERS:
$title = pht('%s added reviewers to this revision.', $title = pht('%s added reviewers to this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_ADDCCS: case self::ACTION_ADDCCS:
$title = pht('%s added CCs to this revision.', $title = pht('%s added CCs to this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_CLAIM: case self::ACTION_CLAIM:
$title = pht('%s commandeered this revision.', $title = pht('%s commandeered this revision.',
$author_name); $author_name);
break; break;
case DifferentialAction::ACTION_REOPEN: case self::ACTION_REOPEN:
$title = pht('%s reopened this revision.', $title = pht('%s reopened this revision.',
$author_name); $author_name);
break; break;
@ -127,9 +127,9 @@ final class DifferentialAction {
} }
public static function allowReviewers($action) { public static function allowReviewers($action) {
if ($action == DifferentialAction::ACTION_ADDREVIEWERS || if ($action == self::ACTION_ADDREVIEWERS ||
$action == DifferentialAction::ACTION_REQUEST || $action == self::ACTION_REQUEST ||
$action == DifferentialAction::ACTION_RESIGN) { $action == self::ACTION_RESIGN) {
return true; return true;
} }
return false; return false;

View file

@ -52,42 +52,42 @@ final class DifferentialChangeType {
public static function isOldLocationChangeType($type) { public static function isOldLocationChangeType($type) {
static $types = array( static $types = array(
DifferentialChangeType::TYPE_MOVE_AWAY => true, self::TYPE_MOVE_AWAY => true,
DifferentialChangeType::TYPE_COPY_AWAY => true, self::TYPE_COPY_AWAY => true,
DifferentialChangeType::TYPE_MULTICOPY => true, self::TYPE_MULTICOPY => true,
); );
return isset($types[$type]); return isset($types[$type]);
} }
public static function isNewLocationChangeType($type) { public static function isNewLocationChangeType($type) {
static $types = array( static $types = array(
DifferentialChangeType::TYPE_MOVE_HERE => true, self::TYPE_MOVE_HERE => true,
DifferentialChangeType::TYPE_COPY_HERE => true, self::TYPE_COPY_HERE => true,
); );
return isset($types[$type]); return isset($types[$type]);
} }
public static function isDeleteChangeType($type) { public static function isDeleteChangeType($type) {
static $types = array( static $types = array(
DifferentialChangeType::TYPE_DELETE => true, self::TYPE_DELETE => true,
DifferentialChangeType::TYPE_MOVE_AWAY => true, self::TYPE_MOVE_AWAY => true,
DifferentialChangeType::TYPE_MULTICOPY => true, self::TYPE_MULTICOPY => true,
); );
return isset($types[$type]); return isset($types[$type]);
} }
public static function isCreateChangeType($type) { public static function isCreateChangeType($type) {
static $types = array( static $types = array(
DifferentialChangeType::TYPE_ADD => true, self::TYPE_ADD => true,
DifferentialChangeType::TYPE_COPY_HERE => true, self::TYPE_COPY_HERE => true,
DifferentialChangeType::TYPE_MOVE_HERE => true, self::TYPE_MOVE_HERE => true,
); );
return isset($types[$type]); return isset($types[$type]);
} }
public static function isModifyChangeType($type) { public static function isModifyChangeType($type) {
static $types = array( static $types = array(
DifferentialChangeType::TYPE_CHANGE => true, self::TYPE_CHANGE => true,
); );
return isset($types[$type]); return isset($types[$type]);
} }

View file

@ -568,7 +568,7 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
'this revision.'); 'this revision.');
} }
break; break;
case DifferentialTransaction::TYPE_ACTION: case self::TYPE_ACTION:
switch ($this->getNewValue()) { switch ($this->getNewValue()) {
case DifferentialAction::ACTION_CLOSE: case DifferentialAction::ACTION_CLOSE:
return pht('This revision is already closed.'); return pht('This revision is already closed.');

View file

@ -119,7 +119,7 @@ final class DiffusionPathChange {
} }
final public static function convertToArcanistChanges(array $changes) { final public static function convertToArcanistChanges(array $changes) {
assert_instances_of($changes, 'DiffusionPathChange'); assert_instances_of($changes, __CLASS__);
$direct = array(); $direct = array();
$result = array(); $result = array();
foreach ($changes as $path) { foreach ($changes as $path) {
@ -145,7 +145,7 @@ final class DiffusionPathChange {
final public static function convertToDifferentialChangesets( final public static function convertToDifferentialChangesets(
PhabricatorUser $user, PhabricatorUser $user,
array $changes) { array $changes) {
assert_instances_of($changes, 'DiffusionPathChange'); assert_instances_of($changes, __CLASS__);
$arcanist_changes = self::convertToArcanistChanges($changes); $arcanist_changes = self::convertToArcanistChanges($changes);
$diff = DifferentialDiff::newEphemeralFromRawChanges( $diff = DifferentialDiff::newEphemeralFromRawChanges(
$arcanist_changes); $arcanist_changes);

View file

@ -174,7 +174,7 @@ final class DivinerLiveSymbol extends DivinerDAO
} }
public function attachExtends(array $extends) { public function attachExtends(array $extends) {
assert_instances_of($extends, 'DivinerLiveSymbol'); assert_instances_of($extends, __CLASS__);
$this->extends = $extends; $this->extends = $extends;
return $this; return $this;
} }
@ -184,7 +184,7 @@ final class DivinerLiveSymbol extends DivinerDAO
} }
public function attachChildren(array $children) { public function attachChildren(array $children) {
assert_instances_of($children, 'DivinerLiveSymbol'); assert_instances_of($children, __CLASS__);
$this->children = $children; $this->children = $children;
return $this; return $this;
} }

View file

@ -377,7 +377,7 @@ abstract class DrydockBlueprintImplementation {
if ($list === null) { if ($list === null) {
$blueprints = id(new PhutilSymbolLoader()) $blueprints = id(new PhutilSymbolLoader())
->setType('class') ->setType('class')
->setAncestorClass('DrydockBlueprintImplementation') ->setAncestorClass(__CLASS__)
->setConcreteOnly(true) ->setConcreteOnly(true)
->selectAndLoadSymbols(); ->selectAndLoadSymbols();
$list = ipull($blueprints, 'name', 'name'); $list = ipull($blueprints, 'name', 'name');

View file

@ -149,7 +149,7 @@ final class DrydockLease extends DrydockDAO
} }
public static function waitForLeases(array $leases) { public static function waitForLeases(array $leases) {
assert_instances_of($leases, 'DrydockLease'); assert_instances_of($leases, __CLASS__);
$task_ids = array_filter(mpull($leases, 'getTaskID')); $task_ids = array_filter(mpull($leases, 'getTaskID'));

View file

@ -48,7 +48,7 @@ abstract class PhabricatorFeedStory
try { try {
$ok = $ok =
class_exists($class) && class_exists($class) &&
is_subclass_of($class, 'PhabricatorFeedStory'); is_subclass_of($class, __CLASS__);
} catch (PhutilMissingSymbolException $ex) { } catch (PhutilMissingSymbolException $ex) {
$ok = false; $ok = false;
} }

View file

@ -242,7 +242,7 @@ final class PhabricatorFileComposeController
} }
$dialog_id = celerity_generate_unique_node_id(); $dialog_id = celerity_generate_unique_node_id();
$color_input_id = celerity_generate_unique_node_id();; $color_input_id = celerity_generate_unique_node_id();
$icon_input_id = celerity_generate_unique_node_id(); $icon_input_id = celerity_generate_unique_node_id();
$preview_id = celerity_generate_unique_node_id(); $preview_id = celerity_generate_unique_node_id();

View file

@ -215,7 +215,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
if (!$file) { if (!$file) {
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
$file = PhabricatorFile::newFromFileData($data, $params); $file = self::newFromFileData($data, $params);
unset($unguarded); unset($unguarded);
} }
@ -236,7 +236,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
$copy_of_byte_size = $file->getByteSize(); $copy_of_byte_size = $file->getByteSize();
$copy_of_mime_type = $file->getMimeType(); $copy_of_mime_type = $file->getMimeType();
$new_file = PhabricatorFile::initializeNewFile(); $new_file = self::initializeNewFile();
$new_file->setByteSize($copy_of_byte_size); $new_file->setByteSize($copy_of_byte_size);
@ -262,7 +262,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
$length, $length,
array $params) { array $params) {
$file = PhabricatorFile::initializeNewFile(); $file = self::initializeNewFile();
$file->setByteSize($length); $file->setByteSize($length);
@ -316,7 +316,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
throw new Exception(pht('No valid storage engines are available!')); throw new Exception(pht('No valid storage engines are available!'));
} }
$file = PhabricatorFile::initializeNewFile(); $file = self::initializeNewFile();
$data_handle = null; $data_handle = null;
$engine_identifier = null; $engine_identifier = null;
@ -1017,7 +1017,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
); );
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
$file = PhabricatorFile::newFromFileData($data, $params); $file = self::newFromFileData($data, $params);
$xform = id(new PhabricatorTransformedFile()) $xform = id(new PhabricatorTransformedFile())
->setOriginalPHID(PhabricatorPHIDConstants::PHID_VOID) ->setOriginalPHID(PhabricatorPHIDConstants::PHID_VOID)
->setTransform('builtin:'.$name) ->setTransform('builtin:'.$name)

View file

@ -38,7 +38,7 @@ final class FundInitiativeTransaction
$type = $this->getTransactionType(); $type = $this->getTransactionType();
switch ($type) { switch ($type) {
case FundInitiativeTransaction::TYPE_MERCHANT: case self::TYPE_MERCHANT:
if ($old) { if ($old) {
$phids[] = $old; $phids[] = $old;
} }
@ -46,7 +46,7 @@ final class FundInitiativeTransaction
$phids[] = $new; $phids[] = $new;
} }
break; break;
case FundInitiativeTransaction::TYPE_REFUND: case self::TYPE_REFUND:
$phids[] = $this->getMetadataValue(self::PROPERTY_BACKER); $phids[] = $this->getMetadataValue(self::PROPERTY_BACKER);
break; break;
} }
@ -63,7 +63,7 @@ final class FundInitiativeTransaction
$type = $this->getTransactionType(); $type = $this->getTransactionType();
switch ($type) { switch ($type) {
case FundInitiativeTransaction::TYPE_NAME: case self::TYPE_NAME:
if ($old === null) { if ($old === null) {
return pht( return pht(
'%s created this initiative.', '%s created this initiative.',
@ -76,15 +76,15 @@ final class FundInitiativeTransaction
$new); $new);
} }
break; break;
case FundInitiativeTransaction::TYPE_RISKS: case self::TYPE_RISKS:
return pht( return pht(
'%s edited the risks for this initiative.', '%s edited the risks for this initiative.',
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
case FundInitiativeTransaction::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
return pht( return pht(
'%s edited the description of this initiative.', '%s edited the description of this initiative.',
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
case FundInitiativeTransaction::TYPE_STATUS: case self::TYPE_STATUS:
switch ($new) { switch ($new) {
case FundInitiative::STATUS_OPEN: case FundInitiative::STATUS_OPEN:
return pht( return pht(
@ -96,14 +96,14 @@ final class FundInitiativeTransaction
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
} }
break; break;
case FundInitiativeTransaction::TYPE_BACKER: case self::TYPE_BACKER:
$amount = $this->getMetadataValue(self::PROPERTY_AMOUNT); $amount = $this->getMetadataValue(self::PROPERTY_AMOUNT);
$amount = PhortuneCurrency::newFromString($amount); $amount = PhortuneCurrency::newFromString($amount);
return pht( return pht(
'%s backed this initiative with %s.', '%s backed this initiative with %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$amount->formatForDisplay()); $amount->formatForDisplay());
case FundInitiativeTransaction::TYPE_REFUND: case self::TYPE_REFUND:
$amount = $this->getMetadataValue(self::PROPERTY_AMOUNT); $amount = $this->getMetadataValue(self::PROPERTY_AMOUNT);
$amount = PhortuneCurrency::newFromString($amount); $amount = PhortuneCurrency::newFromString($amount);
@ -114,7 +114,7 @@ final class FundInitiativeTransaction
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$amount->formatForDisplay(), $amount->formatForDisplay(),
$this->renderHandleLink($backer_phid)); $this->renderHandleLink($backer_phid));
case FundInitiativeTransaction::TYPE_MERCHANT: case self::TYPE_MERCHANT:
if ($old === null) { if ($old === null) {
return pht( return pht(
'%s set this initiative to pay to %s.', '%s set this initiative to pay to %s.',
@ -142,7 +142,7 @@ final class FundInitiativeTransaction
$type = $this->getTransactionType(); $type = $this->getTransactionType();
switch ($type) { switch ($type) {
case FundInitiativeTransaction::TYPE_NAME: case self::TYPE_NAME:
if ($old === null) { if ($old === null) {
return pht( return pht(
'%s created %s.', '%s created %s.',
@ -156,12 +156,12 @@ final class FundInitiativeTransaction
$this->renderHandleLink($object_phid)); $this->renderHandleLink($object_phid));
} }
break; break;
case FundInitiativeTransaction::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
return pht( return pht(
'%s updated the description for %s.', '%s updated the description for %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid)); $this->renderHandleLink($object_phid));
case FundInitiativeTransaction::TYPE_STATUS: case self::TYPE_STATUS:
switch ($new) { switch ($new) {
case FundInitiative::STATUS_OPEN: case FundInitiative::STATUS_OPEN:
return pht( return pht(
@ -175,7 +175,7 @@ final class FundInitiativeTransaction
$this->renderHandleLink($object_phid)); $this->renderHandleLink($object_phid));
} }
break; break;
case FundInitiativeTransaction::TYPE_BACKER: case self::TYPE_BACKER:
$amount = $this->getMetadataValue(self::PROPERTY_AMOUNT); $amount = $this->getMetadataValue(self::PROPERTY_AMOUNT);
$amount = PhortuneCurrency::newFromString($amount); $amount = PhortuneCurrency::newFromString($amount);
return pht( return pht(
@ -183,7 +183,7 @@ final class FundInitiativeTransaction
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid), $this->renderHandleLink($object_phid),
$amount->formatForDisplay()); $amount->formatForDisplay());
case FundInitiativeTransaction::TYPE_REFUND: case self::TYPE_REFUND:
$amount = $this->getMetadataValue(self::PROPERTY_AMOUNT); $amount = $this->getMetadataValue(self::PROPERTY_AMOUNT);
$amount = PhortuneCurrency::newFromString($amount); $amount = PhortuneCurrency::newFromString($amount);
@ -223,8 +223,8 @@ final class FundInitiativeTransaction
public function shouldHide() { public function shouldHide() {
$old = $this->getOldValue(); $old = $this->getOldValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case FundInitiativeTransaction::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
case FundInitiativeTransaction::TYPE_RISKS: case self::TYPE_RISKS:
return ($old === null); return ($old === null);
} }
return parent::shouldHide(); return parent::shouldHide();
@ -232,8 +232,8 @@ final class FundInitiativeTransaction
public function hasChangeDetails() { public function hasChangeDetails() {
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case FundInitiativeTransaction::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
case FundInitiativeTransaction::TYPE_RISKS: case self::TYPE_RISKS:
return ($this->getOldValue() !== null); return ($this->getOldValue() !== null);
} }

View file

@ -4,7 +4,7 @@ abstract class HarbormasterBuildStepImplementation {
public static function getImplementations() { public static function getImplementations() {
return id(new PhutilSymbolLoader()) return id(new PhutilSymbolLoader())
->setAncestorClass('HarbormasterBuildStepImplementation') ->setAncestorClass(__CLASS__)
->loadObjects(); ->loadObjects();
} }

View file

@ -88,7 +88,7 @@ final class HarbormasterBuildable extends HarbormasterDAO
if ($buildable) { if ($buildable) {
return $buildable; return $buildable;
} }
$buildable = HarbormasterBuildable::initializeNewBuildable($actor) $buildable = self::initializeNewBuildable($actor)
->setBuildablePHID($buildable_object_phid) ->setBuildablePHID($buildable_object_phid)
->setContainerPHID($container_object_phid); ->setContainerPHID($container_object_phid);
$buildable->save(); $buildable->save();
@ -116,7 +116,7 @@ final class HarbormasterBuildable extends HarbormasterDAO
return; return;
} }
$buildable = HarbormasterBuildable::createOrLoadExisting( $buildable = self::createOrLoadExisting(
PhabricatorUser::getOmnipotentUser(), PhabricatorUser::getOmnipotentUser(),
$phid, $phid,
$container_phid); $container_phid);

View file

@ -43,7 +43,7 @@ final class PhabricatorHelpApplication extends PhabricatorApplication {
array( array(
'bubbleID' => $help_id, 'bubbleID' => $help_id,
'dropdownID' => 'phabricator-help-menu', 'dropdownID' => 'phabricator-help-menu',
'applicationClass' => 'PhabricatorHelpApplication', 'applicationClass' => __CLASS__,
'local' => true, 'local' => true,
'desktop' => true, 'desktop' => true,
'right' => true, 'right' => true,

View file

@ -1083,7 +1083,7 @@ abstract class HeraldAdapter {
public static function getEnabledAdapterMap(PhabricatorUser $viewer) { public static function getEnabledAdapterMap(PhabricatorUser $viewer) {
$map = array(); $map = array();
$adapters = HeraldAdapter::getAllAdapters(); $adapters = self::getAllAdapters();
foreach ($adapters as $adapter) { foreach ($adapters as $adapter) {
if (!$adapter->isAvailableToUser($viewer)) { if (!$adapter->isAvailableToUser($viewer)) {
continue; continue;

View file

@ -14,7 +14,7 @@ final class PhabricatorMacroMemeController
$lower_text = $request->getStr('lowertext'); $lower_text = $request->getStr('lowertext');
$user = $request->getUser(); $user = $request->getUser();
$uri = PhabricatorMacroMemeController::generateMacro($user, $macro_name, $uri = self::generateMacro($user, $macro_name,
$upper_text, $lower_text); $upper_text, $lower_text);
if ($uri === false) { if ($uri === false) {
return new Aphront404Response(); return new Aphront404Response();

View file

@ -754,7 +754,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
$id = $result->getID(); $id = $result->getID();
if ($this->groupBy == self::GROUP_PROJECT) { if ($this->groupBy == self::GROUP_PROJECT) {
return rtrim($id.'.'.$result->getGroupByProjectPHID(), '.');; return rtrim($id.'.'.$result->getGroupByProjectPHID(), '.');
} }
return $id; return $id;

View file

@ -91,7 +91,7 @@ abstract class MetaMTAEmailTransactionCommand extends Phobject {
} }
public static function getCommandMap(array $commands) { public static function getCommandMap(array $commands) {
assert_instances_of($commands, 'MetaMTAEmailTransactionCommand'); assert_instances_of($commands, __CLASS__);
$map = array(); $map = array();
foreach ($commands as $command) { foreach ($commands as $command) {

View file

@ -46,13 +46,13 @@ final class PhabricatorContentSource {
public static function newConsoleSource() { public static function newConsoleSource() {
return self::newForSource( return self::newForSource(
PhabricatorContentSource::SOURCE_CONSOLE, self::SOURCE_CONSOLE,
array()); array());
} }
public static function newFromRequest(AphrontRequest $request) { public static function newFromRequest(AphrontRequest $request) {
return self::newForSource( return self::newForSource(
PhabricatorContentSource::SOURCE_WEB, self::SOURCE_WEB,
array( array(
'ip' => $request->getRemoteAddr(), 'ip' => $request->getRemoteAddr(),
)); ));
@ -60,7 +60,7 @@ final class PhabricatorContentSource {
public static function newFromConduitRequest(ConduitAPIRequest $request) { public static function newFromConduitRequest(ConduitAPIRequest $request) {
return self::newForSource( return self::newForSource(
PhabricatorContentSource::SOURCE_CONDUIT, self::SOURCE_CONDUIT,
array()); array());
} }

View file

@ -20,7 +20,7 @@ final class NuanceItem
public static function initializeNewItem(PhabricatorUser $user) { public static function initializeNewItem(PhabricatorUser $user) {
return id(new NuanceItem()) return id(new NuanceItem())
->setDateNuanced(time()) ->setDateNuanced(time())
->setStatus(NuanceItem::STATUS_OPEN); ->setStatus(self::STATUS_OPEN);
} }
protected function getConfiguration() { protected function getConfiguration() {

View file

@ -67,7 +67,7 @@ final class PhabricatorPasteTransaction
$type = $this->getTransactionType(); $type = $this->getTransactionType();
switch ($type) { switch ($type) {
case PhabricatorPasteTransaction::TYPE_CONTENT: case self::TYPE_CONTENT:
if ($old === null) { if ($old === null) {
return pht( return pht(
'%s created this paste.', '%s created this paste.',
@ -78,13 +78,13 @@ final class PhabricatorPasteTransaction
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
} }
break; break;
case PhabricatorPasteTransaction::TYPE_TITLE: case self::TYPE_TITLE:
return pht( return pht(
'%s updated the paste\'s title to "%s".', '%s updated the paste\'s title to "%s".',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$new); $new);
break; break;
case PhabricatorPasteTransaction::TYPE_LANGUAGE: case self::TYPE_LANGUAGE:
return pht( return pht(
"%s updated the paste's language.", "%s updated the paste's language.",
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
@ -103,7 +103,7 @@ final class PhabricatorPasteTransaction
$type = $this->getTransactionType(); $type = $this->getTransactionType();
switch ($type) { switch ($type) {
case PhabricatorPasteTransaction::TYPE_CONTENT: case self::TYPE_CONTENT:
if ($old === null) { if ($old === null) {
return pht( return pht(
'%s created %s.', '%s created %s.',
@ -116,13 +116,13 @@ final class PhabricatorPasteTransaction
$this->renderHandleLink($object_phid)); $this->renderHandleLink($object_phid));
} }
break; break;
case PhabricatorPasteTransaction::TYPE_TITLE: case self::TYPE_TITLE:
return pht( return pht(
'%s updated the title for %s.', '%s updated the title for %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid)); $this->renderHandleLink($object_phid));
break; break;
case PhabricatorPasteTransaction::TYPE_LANGUAGE: case self::TYPE_LANGUAGE:
return pht( return pht(
'%s updated the language for %s.', '%s updated the language for %s.',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),

View file

@ -14,7 +14,7 @@ final class PhabricatorUserEditorTestCase extends PhabricatorTestCase {
$this->registerUser( $this->registerUser(
'PhabricatorUserEditorTestCaseOK', 'PhabricatorUserEditorTestCaseOK',
'PhabricatorUserEditorTestCase@example.com'); 'PhabricatorUserEditorTest@example.com');
$this->assertTrue(true); $this->assertTrue(true);
} }
@ -45,7 +45,7 @@ final class PhabricatorUserEditorTestCase extends PhabricatorTestCase {
try { try {
$this->registerUser( $this->registerUser(
'PhabricatorUserEditorTestCaseDomain', 'PhabricatorUserEditorTestCaseDomain',
'PhabricatorUserEditorTestCase@whitehouse.gov'); 'PhabricatorUserEditorTest@whitehouse.gov');
} catch (Exception $ex) { } catch (Exception $ex) {
$caught = $ex; $caught = $ex;
} }

View file

@ -158,8 +158,9 @@ final class PhabricatorHandleList
private function raiseImmutableException() { private function raiseImmutableException() {
throw new Exception( throw new Exception(
pht( pht(
'Trying to mutate a PhabricatorHandleList, but this is not permitted; '. 'Trying to mutate a %s, but this is not permitted; '.
'handle lists are immutable.')); 'handle lists are immutable.',
__CLASS__));
} }

View file

@ -169,9 +169,13 @@ abstract class PhabricatorPHIDType {
$that_class = $original[$type]; $that_class = $original[$type];
$this_class = get_class($object); $this_class = get_class($object);
throw new Exception( throw new Exception(
"Two PhabricatorPHIDType classes ({$that_class}, {$this_class}) ". pht(
"both handle PHID type '{$type}'. A type may be handled by only ". "Two %s classes (%s, %s) both handle PHID type '%s'. ".
"one class."); "A type may be handled by only one class.",
__CLASS__,
$that_class,
$this_class,
$type));
} }
$original[$type] = get_class($object); $original[$type] = get_class($object);

View file

@ -68,10 +68,10 @@ final class PhortuneCurrency extends Phobject {
} }
public static function newFromList(array $list) { public static function newFromList(array $list) {
assert_instances_of($list, 'PhortuneCurrency'); assert_instances_of($list, __CLASS__);
if (!$list) { if (!$list) {
return PhortuneCurrency::newEmptyCurrency(); return self::newEmptyCurrency();
} }
$total = null; $total = null;
@ -201,8 +201,8 @@ final class PhortuneCurrency extends Phobject {
*/ */
public function assertInRange($minimum, $maximum) { public function assertInRange($minimum, $maximum) {
if ($minimum !== null && $maximum !== null) { if ($minimum !== null && $maximum !== null) {
$min = PhortuneCurrency::newFromString($minimum); $min = self::newFromString($minimum);
$max = PhortuneCurrency::newFromString($maximum); $max = self::newFromString($maximum);
if ($min->value > $max->value) { if ($min->value > $max->value) {
throw new Exception( throw new Exception(
pht( pht(
@ -213,7 +213,7 @@ final class PhortuneCurrency extends Phobject {
} }
if ($minimum !== null) { if ($minimum !== null) {
$min = PhortuneCurrency::newFromString($minimum); $min = self::newFromString($minimum);
if ($min->value > $this->value) { if ($min->value > $this->value) {
throw new Exception( throw new Exception(
pht( pht(
@ -223,7 +223,7 @@ final class PhortuneCurrency extends Phobject {
} }
if ($maximum !== null) { if ($maximum !== null) {
$max = PhortuneCurrency::newFromString($maximum); $max = self::newFromString($maximum);
if ($max->value < $this->value) { if ($max->value < $this->value) {
throw new Exception( throw new Exception(
pht( pht(

View file

@ -118,7 +118,7 @@ abstract class PhortunePaymentProvider {
public static function getAllProviders() { public static function getAllProviders() {
return id(new PhutilSymbolLoader()) return id(new PhutilSymbolLoader())
->setAncestorClass('PhortunePaymentProvider') ->setAncestorClass(__CLASS__)
->loadObjects(); ->loadObjects();
} }

View file

@ -27,7 +27,7 @@ final class PhortuneAccount extends PhortuneDAO
PhabricatorUser $actor, PhabricatorUser $actor,
PhabricatorContentSource $content_source) { PhabricatorContentSource $content_source) {
$account = PhortuneAccount::initializeNewAccount($actor); $account = self::initializeNewAccount($actor);
$xactions = array(); $xactions = array();
$xactions[] = id(new PhortuneAccountTransaction()) $xactions[] = id(new PhortuneAccountTransaction())

View file

@ -136,7 +136,7 @@ final class PhortuneCart extends PhortuneDAO
} }
$charge->save(); $charge->save();
$this->setStatus(PhortuneCart::STATUS_PURCHASING)->save(); $this->setStatus(self::STATUS_PURCHASING)->save();
$this->endReadLocking(); $this->endReadLocking();
$this->saveTransaction(); $this->saveTransaction();

View file

@ -256,7 +256,7 @@ final class PhragmentFragment extends PhragmentDAO
$mappings[$path], $mappings[$path],
array('name' => basename($path))); array('name' => basename($path)));
} }
PhragmentFragment::createFromFile( self::createFromFile(
$viewer, $viewer,
$file, $file,
$base_path.'/'.$path, $base_path.'/'.$path,

View file

@ -15,9 +15,9 @@ final class PhabricatorPolicies extends PhabricatorPolicyConstants {
*/ */
public static function getMostOpenPolicy() { public static function getMostOpenPolicy() {
if (PhabricatorEnv::getEnvConfig('policy.allow-public')) { if (PhabricatorEnv::getEnvConfig('policy.allow-public')) {
return PhabricatorPolicies::POLICY_PUBLIC; return self::POLICY_PUBLIC;
} else { } else {
return PhabricatorPolicies::POLICY_USER; return self::POLICY_USER;
} }
} }

View file

@ -44,7 +44,7 @@ final class PhabricatorProjectIcon extends Phobject {
} }
public static function renderIconForChooser($icon) { public static function renderIconForChooser($icon) {
$project_icons = PhabricatorProjectIcon::getIconMap(); $project_icons = self::getIconMap();
return phutil_tag( return phutil_tag(
'span', 'span',

View file

@ -111,7 +111,7 @@ final class PhabricatorProjectColumn
->setMetadata( ->setMetadata(
array( array(
'tip' => $text, 'tip' => $text,
));; ));
} }
return null; return null;

View file

@ -21,7 +21,7 @@ final class PhabricatorProjectColumnTransaction
$author_handle = $this->renderHandleLink($this->getAuthorPHID()); $author_handle = $this->renderHandleLink($this->getAuthorPHID());
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorProjectColumnTransaction::TYPE_NAME: case self::TYPE_NAME:
if ($old === null) { if ($old === null) {
return pht( return pht(
'%s created this column.', '%s created this column.',
@ -44,7 +44,7 @@ final class PhabricatorProjectColumnTransaction
$author_handle); $author_handle);
} }
} }
case PhabricatorProjectColumnTransaction::TYPE_LIMIT: case self::TYPE_LIMIT:
if (!$old) { if (!$old) {
return pht( return pht(
'%s set the point limit for this column to %s.', '%s set the point limit for this column to %s.',
@ -62,7 +62,7 @@ final class PhabricatorProjectColumnTransaction
$new); $new);
} }
case PhabricatorProjectColumnTransaction::TYPE_STATUS: case self::TYPE_STATUS:
switch ($new) { switch ($new) {
case PhabricatorProjectColumn::STATUS_ACTIVE: case PhabricatorProjectColumn::STATUS_ACTIVE:
return pht( return pht(

View file

@ -28,12 +28,12 @@ final class PhabricatorProjectTransaction
$req_phids = array(); $req_phids = array();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorProjectTransaction::TYPE_MEMBERS: case self::TYPE_MEMBERS:
$add = array_diff($new, $old); $add = array_diff($new, $old);
$rem = array_diff($old, $new); $rem = array_diff($old, $new);
$req_phids = array_merge($add, $rem); $req_phids = array_merge($add, $rem);
break; break;
case PhabricatorProjectTransaction::TYPE_IMAGE: case self::TYPE_IMAGE:
$req_phids[] = $old; $req_phids[] = $old;
$req_phids[] = $new; $req_phids[] = $new;
break; break;
@ -48,7 +48,7 @@ final class PhabricatorProjectTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorProjectTransaction::TYPE_STATUS: case self::TYPE_STATUS:
if ($old == 0) { if ($old == 0) {
return 'red'; return 'red';
} else { } else {
@ -64,25 +64,25 @@ final class PhabricatorProjectTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorProjectTransaction::TYPE_STATUS: case self::TYPE_STATUS:
if ($old == 0) { if ($old == 0) {
return 'fa-ban'; return 'fa-ban';
} else { } else {
return 'fa-check'; return 'fa-check';
} }
case PhabricatorProjectTransaction::TYPE_LOCKED: case self::TYPE_LOCKED:
if ($new) { if ($new) {
return 'fa-lock'; return 'fa-lock';
} else { } else {
return 'fa-unlock'; return 'fa-unlock';
} }
case PhabricatorProjectTransaction::TYPE_ICON: case self::TYPE_ICON:
return $new; return $new;
case PhabricatorProjectTransaction::TYPE_IMAGE: case self::TYPE_IMAGE:
return 'fa-photo'; return 'fa-photo';
case PhabricatorProjectTransaction::TYPE_MEMBERS: case self::TYPE_MEMBERS:
return 'fa-user'; return 'fa-user';
case PhabricatorProjectTransaction::TYPE_SLUGS: case self::TYPE_SLUGS:
return 'fa-tag'; return 'fa-tag';
} }
return parent::getIcon(); return parent::getIcon();
@ -94,7 +94,7 @@ final class PhabricatorProjectTransaction
$author_handle = $this->renderHandleLink($this->getAuthorPHID()); $author_handle = $this->renderHandleLink($this->getAuthorPHID());
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorProjectTransaction::TYPE_NAME: case self::TYPE_NAME:
if ($old === null) { if ($old === null) {
return pht( return pht(
'%s created this project.', '%s created this project.',
@ -106,7 +106,7 @@ final class PhabricatorProjectTransaction
$old, $old,
$new); $new);
} }
case PhabricatorProjectTransaction::TYPE_STATUS: case self::TYPE_STATUS:
if ($old == 0) { if ($old == 0) {
return pht( return pht(
'%s archived this project.', '%s archived this project.',
@ -116,7 +116,7 @@ final class PhabricatorProjectTransaction
'%s activated this project.', '%s activated this project.',
$author_handle); $author_handle);
} }
case PhabricatorProjectTransaction::TYPE_IMAGE: case self::TYPE_IMAGE:
// TODO: Some day, it would be nice to show the images. // TODO: Some day, it would be nice to show the images.
if (!$old) { if (!$old) {
return pht( return pht(
@ -135,19 +135,19 @@ final class PhabricatorProjectTransaction
$this->renderHandleLink($new)); $this->renderHandleLink($new));
} }
case PhabricatorProjectTransaction::TYPE_ICON: case self::TYPE_ICON:
return pht( return pht(
'%s set this project\'s icon to %s.', '%s set this project\'s icon to %s.',
$author_handle, $author_handle,
PhabricatorProjectIcon::getLabel($new)); PhabricatorProjectIcon::getLabel($new));
case PhabricatorProjectTransaction::TYPE_COLOR: case self::TYPE_COLOR:
return pht( return pht(
'%s set this project\'s color to %s.', '%s set this project\'s color to %s.',
$author_handle, $author_handle,
PHUITagView::getShadeName($new)); PHUITagView::getShadeName($new));
case PhabricatorProjectTransaction::TYPE_LOCKED: case self::TYPE_LOCKED:
if ($new) { if ($new) {
return pht( return pht(
'%s locked this project\'s membership.', '%s locked this project\'s membership.',
@ -158,7 +158,7 @@ final class PhabricatorProjectTransaction
$author_handle); $author_handle);
} }
case PhabricatorProjectTransaction::TYPE_SLUGS: case self::TYPE_SLUGS:
$add = array_diff($new, $old); $add = array_diff($new, $old);
$rem = array_diff($old, $new); $rem = array_diff($old, $new);
@ -184,7 +184,7 @@ final class PhabricatorProjectTransaction
$this->renderSlugList($rem)); $this->renderSlugList($rem));
} }
case PhabricatorProjectTransaction::TYPE_MEMBERS: case self::TYPE_MEMBERS:
$add = array_diff($new, $old); $add = array_diff($new, $old);
$rem = array_diff($old, $new); $rem = array_diff($old, $new);

View file

@ -127,8 +127,8 @@ final class ReleephRequest extends ReleephDAO
if ($this->getInBranch()) { if ($this->getInBranch()) {
return ReleephRequestStatus::STATUS_NEEDS_REVERT; return ReleephRequestStatus::STATUS_NEEDS_REVERT;
} else { } else {
$intent_pass = ReleephRequest::INTENT_PASS; $intent_pass = self::INTENT_PASS;
$intent_want = ReleephRequest::INTENT_WANT; $intent_want = self::INTENT_WANT;
$has_been_in_branch = $this->getCommitIdentifier(); $has_been_in_branch = $this->getCommitIdentifier();
// Regardless of why we reverted something, always say reverted if it // Regardless of why we reverted something, always say reverted if it

View file

@ -38,12 +38,12 @@ final class ReleephRequestTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case ReleephRequestTransaction::TYPE_REQUEST: case self::TYPE_REQUEST:
case ReleephRequestTransaction::TYPE_DISCOVERY: case self::TYPE_DISCOVERY:
$phids[] = $new; $phids[] = $new;
break; break;
case ReleephRequestTransaction::TYPE_EDIT_FIELD: case self::TYPE_EDIT_FIELD:
self::searchForPHIDs($this->getOldValue(), $phids); self::searchForPHIDs($this->getOldValue(), $phids);
self::searchForPHIDs($this->getNewValue(), $phids); self::searchForPHIDs($this->getNewValue(), $phids);
break; break;
@ -60,18 +60,18 @@ final class ReleephRequestTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case ReleephRequestTransaction::TYPE_REQUEST: case self::TYPE_REQUEST:
return pht( return pht(
'%s requested %s', '%s requested %s',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$this->renderHandleLink($new)); $this->renderHandleLink($new));
break; break;
case ReleephRequestTransaction::TYPE_USER_INTENT: case self::TYPE_USER_INTENT:
return $this->getIntentTitle(); return $this->getIntentTitle();
break; break;
case ReleephRequestTransaction::TYPE_EDIT_FIELD: case self::TYPE_EDIT_FIELD:
$field = newv($this->getMetadataValue('fieldClass'), array()); $field = newv($this->getMetadataValue('fieldClass'), array());
$name = $field->getName(); $name = $field->getName();
@ -89,7 +89,7 @@ final class ReleephRequestTransaction
$field->normalizeForTransactionView($this, $new)); $field->normalizeForTransactionView($this, $new));
break; break;
case ReleephRequestTransaction::TYPE_PICK_STATUS: case self::TYPE_PICK_STATUS:
switch ($new) { switch ($new) {
case ReleephRequest::PICK_OK: case ReleephRequest::PICK_OK:
return pht('%s found this request picks without error', return pht('%s found this request picks without error',
@ -109,7 +109,7 @@ final class ReleephRequestTransaction
} }
break; break;
case ReleephRequestTransaction::TYPE_COMMIT: case self::TYPE_COMMIT:
$action_type = $this->getMetadataValue('action'); $action_type = $this->getMetadataValue('action');
switch ($action_type) { switch ($action_type) {
case 'pick': case 'pick':
@ -126,7 +126,7 @@ final class ReleephRequestTransaction
} }
break; break;
case ReleephRequestTransaction::TYPE_MANUAL_IN_BRANCH: case self::TYPE_MANUAL_IN_BRANCH:
$action = $new ? pht('picked') : pht('reverted'); $action = $new ? pht('picked') : pht('reverted');
return pht( return pht(
'%s marked this request as manually %s', '%s marked this request as manually %s',
@ -134,7 +134,7 @@ final class ReleephRequestTransaction
$action); $action);
break; break;
case ReleephRequestTransaction::TYPE_DISCOVERY: case self::TYPE_DISCOVERY:
return pht('%s discovered this commit as %s', return pht('%s discovered this commit as %s',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$this->renderHandleLink($new)); $this->renderHandleLink($new));
@ -173,7 +173,7 @@ final class ReleephRequestTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case ReleephRequestTransaction::TYPE_USER_INTENT: case self::TYPE_USER_INTENT:
switch ($new) { switch ($new) {
case ReleephRequest::INTENT_WANT: case ReleephRequest::INTENT_WANT:
return PhabricatorTransactions::COLOR_GREEN; return PhabricatorTransactions::COLOR_GREEN;
@ -243,7 +243,7 @@ final class ReleephRequestTransaction
public function shouldHide() { public function shouldHide() {
$type = $this->getTransactionType(); $type = $this->getTransactionType();
if ($type === ReleephRequestTransaction::TYPE_USER_INTENT && if ($type === self::TYPE_USER_INTENT &&
$this->getMetadataValue('isRQCreate')) { $this->getMetadataValue('isRQCreate')) {
return true; return true;
@ -255,7 +255,7 @@ final class ReleephRequestTransaction
// ReleephSummaryFieldSpecification is usually blank when an RQ is created, // ReleephSummaryFieldSpecification is usually blank when an RQ is created,
// creating a transaction change from null to "". Hide these! // creating a transaction change from null to "". Hide these!
if ($type === ReleephRequestTransaction::TYPE_EDIT_FIELD) { if ($type === self::TYPE_EDIT_FIELD) {
if ($this->getOldValue() === null && $this->getNewValue() === '') { if ($this->getOldValue() === null && $this->getNewValue() === '') {
return true; return true;
} }
@ -265,7 +265,7 @@ final class ReleephRequestTransaction
public function isBoringPickStatus() { public function isBoringPickStatus() {
$type = $this->getTransactionType(); $type = $this->getTransactionType();
if ($type === ReleephRequestTransaction::TYPE_PICK_STATUS) { if ($type === self::TYPE_PICK_STATUS) {
$new = $this->getNewValue(); $new = $this->getNewValue();
if ($new === ReleephRequest::PICK_OK || if ($new === ReleephRequest::PICK_OK ||
$new === ReleephRequest::REVERT_OK) { $new === ReleephRequest::REVERT_OK) {

View file

@ -201,7 +201,7 @@ final class PhabricatorRepositorySearchEngine
array $handles) { array $handles) {
assert_instances_of($repositories, 'PhabricatorRepository'); assert_instances_of($repositories, 'PhabricatorRepository');
$viewer = $this->requireViewer();; $viewer = $this->requireViewer();
$list = new PHUIObjectItemListView(); $list = new PHUIObjectItemListView();
foreach ($repositories as $repository) { foreach ($repositories as $repository) {

View file

@ -54,13 +54,13 @@ final class PhabricatorRepositoryPushLog
public static function getHeraldChangeFlagConditionOptions() { public static function getHeraldChangeFlagConditionOptions() {
return array( return array(
PhabricatorRepositoryPushLog::CHANGEFLAG_ADD => self::CHANGEFLAG_ADD =>
pht('change creates ref'), pht('change creates ref'),
PhabricatorRepositoryPushLog::CHANGEFLAG_DELETE => self::CHANGEFLAG_DELETE =>
pht('change deletes ref'), pht('change deletes ref'),
PhabricatorRepositoryPushLog::CHANGEFLAG_REWRITE => self::CHANGEFLAG_REWRITE =>
pht('change rewrites ref'), pht('change rewrites ref'),
PhabricatorRepositoryPushLog::CHANGEFLAG_DANGEROUS => self::CHANGEFLAG_DANGEROUS =>
pht('dangerous change'), pht('dangerous change'),
); );
} }

View file

@ -74,14 +74,14 @@ final class PhabricatorUserPreferences extends PhabricatorUserDAO {
} }
public function getPinnedApplications(array $apps, PhabricatorUser $viewer) { public function getPinnedApplications(array $apps, PhabricatorUser $viewer) {
$pref_pinned = PhabricatorUserPreferences::PREFERENCE_APP_PINNED; $pref_pinned = self::PREFERENCE_APP_PINNED;
$pinned = $this->getPreference($pref_pinned); $pinned = $this->getPreference($pref_pinned);
if ($pinned) { if ($pinned) {
return $pinned; return $pinned;
} }
$pref_tiles = PhabricatorUserPreferences::PREFERENCE_APP_TILES; $pref_tiles = self::PREFERENCE_APP_TILES;
$tiles = $this->getPreference($pref_tiles, array()); $tiles = $this->getPreference($pref_tiles, array());
$full_tile = 'full'; $full_tile = 'full';

View file

@ -26,10 +26,10 @@ final class PhabricatorSlowvoteTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorSlowvoteTransaction::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
case PhabricatorSlowvoteTransaction::TYPE_RESPONSES: case self::TYPE_RESPONSES:
case PhabricatorSlowvoteTransaction::TYPE_SHUFFLE: case self::TYPE_SHUFFLE:
case PhabricatorSlowvoteTransaction::TYPE_CLOSE: case self::TYPE_CLOSE:
return ($old === null); return ($old === null);
} }
@ -43,7 +43,7 @@ final class PhabricatorSlowvoteTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorSlowvoteTransaction::TYPE_QUESTION: case self::TYPE_QUESTION:
if ($old === null) { if ($old === null) {
return pht( return pht(
'%s created this poll.', '%s created this poll.',
@ -56,16 +56,16 @@ final class PhabricatorSlowvoteTransaction
$new); $new);
} }
break; break;
case PhabricatorSlowvoteTransaction::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
return pht( return pht(
'%s updated the description for this poll.', '%s updated the description for this poll.',
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
case PhabricatorSlowvoteTransaction::TYPE_RESPONSES: case self::TYPE_RESPONSES:
// TODO: This could be more detailed // TODO: This could be more detailed
return pht( return pht(
'%s changed who can see the responses.', '%s changed who can see the responses.',
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
case PhabricatorSlowvoteTransaction::TYPE_SHUFFLE: case self::TYPE_SHUFFLE:
if ($new) { if ($new) {
return pht( return pht(
'%s made poll responses appear in a random order.', '%s made poll responses appear in a random order.',
@ -76,7 +76,7 @@ final class PhabricatorSlowvoteTransaction
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
} }
break; break;
case PhabricatorSlowvoteTransaction::TYPE_CLOSE: case self::TYPE_CLOSE:
if ($new) { if ($new) {
return pht( return pht(
'%s closed this poll.', '%s closed this poll.',
@ -98,18 +98,18 @@ final class PhabricatorSlowvoteTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorSlowvoteTransaction::TYPE_QUESTION: case self::TYPE_QUESTION:
if ($old === null) { if ($old === null) {
return 'fa-plus'; return 'fa-plus';
} else { } else {
return 'fa-pencil'; return 'fa-pencil';
} }
case PhabricatorSlowvoteTransaction::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
case PhabricatorSlowvoteTransaction::TYPE_RESPONSES: case self::TYPE_RESPONSES:
return 'fa-pencil'; return 'fa-pencil';
case PhabricatorSlowvoteTransaction::TYPE_SHUFFLE: case self::TYPE_SHUFFLE:
return 'fa-refresh'; return 'fa-refresh';
case PhabricatorSlowvoteTransaction::TYPE_CLOSE: case self::TYPE_CLOSE:
if ($new) { if ($new) {
return 'fa-ban'; return 'fa-ban';
} else { } else {
@ -126,11 +126,11 @@ final class PhabricatorSlowvoteTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorSlowvoteTransaction::TYPE_QUESTION: case self::TYPE_QUESTION:
case PhabricatorSlowvoteTransaction::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
case PhabricatorSlowvoteTransaction::TYPE_RESPONSES: case self::TYPE_RESPONSES:
case PhabricatorSlowvoteTransaction::TYPE_SHUFFLE: case self::TYPE_SHUFFLE:
case PhabricatorSlowvoteTransaction::TYPE_CLOSE: case self::TYPE_CLOSE:
return PhabricatorTransactions::COLOR_BLUE; return PhabricatorTransactions::COLOR_BLUE;
} }
@ -139,7 +139,7 @@ final class PhabricatorSlowvoteTransaction
public function hasChangeDetails() { public function hasChangeDetails() {
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorSlowvoteTransaction::TYPE_DESCRIPTION: case self::TYPE_DESCRIPTION:
return true; return true;
} }
return parent::hasChangeDetails(); return parent::hasChangeDetails();

View file

@ -1073,7 +1073,7 @@ abstract class PhabricatorApplicationTransaction
} }
public function attachTransactionGroup(array $group) { public function attachTransactionGroup(array $group) {
assert_instances_of($group, 'PhabricatorApplicationTransaction'); assert_instances_of($group, __CLASS__);
$this->transactionGroup = $group; $this->transactionGroup = $group;
return $this; return $this;
} }
@ -1165,7 +1165,7 @@ abstract class PhabricatorApplicationTransaction
} }
$old_target = $xaction->getRenderingTarget(); $old_target = $xaction->getRenderingTarget();
$new_target = PhabricatorApplicationTransaction::TARGET_TEXT; $new_target = self::TARGET_TEXT;
$xaction->setRenderingTarget($new_target); $xaction->setRenderingTarget($new_target);
if ($publisher->getRenderWithImpliedContext()) { if ($publisher->getRenderWithImpliedContext()) {

View file

@ -65,7 +65,7 @@ abstract class PhabricatorCustomField {
"object of class '{$obj_class}'."); "object of class '{$obj_class}'.");
} }
$fields = PhabricatorCustomField::buildFieldList( $fields = self::buildFieldList(
$base_class, $base_class,
$spec, $spec,
$object); $object);

View file

@ -19,7 +19,11 @@ final class PhabricatorBot extends PhabricatorDaemon {
protected function run() { protected function run() {
$argv = $this->getArgv(); $argv = $this->getArgv();
if (count($argv) !== 1) { if (count($argv) !== 1) {
throw new Exception('usage: PhabricatorBot <json_config_file>'); throw new Exception(
pht(
'Usage: %s %s',
__CLASS__,
'<json_config_file>'));
} }
$json_raw = Filesystem::readFile($argv[0]); $json_raw = Filesystem::readFile($argv[0]);
@ -72,7 +76,7 @@ final class PhabricatorBot extends PhabricatorDaemon {
$response = $conduit->callMethodSynchronous( $response = $conduit->callMethodSynchronous(
'conduit.connect', 'conduit.connect',
array( array(
'client' => 'PhabricatorBot', 'client' => __CLASS__,
'clientVersion' => '1.0', 'clientVersion' => '1.0',
'clientDescription' => php_uname('n').':'.$nick, 'clientDescription' => php_uname('n').':'.$nick,
'host' => $conduit_host, 'host' => $conduit_host,

View file

@ -150,7 +150,7 @@ final class PhabricatorWorkerTriggerQuery
if (($this->nextEpochMin !== null) || if (($this->nextEpochMin !== null) ||
($this->nextEpochMax !== null) || ($this->nextEpochMax !== null) ||
($this->order == PhabricatorWorkerTriggerQuery::ORDER_EXECUTION)) { ($this->order == self::ORDER_EXECUTION)) {
$joins[] = qsprintf( $joins[] = qsprintf(
$conn_r, $conn_r,
'JOIN %T e ON e.triggerID = t.id', 'JOIN %T e ON e.triggerID = t.id',

View file

@ -88,7 +88,7 @@ final class PhabricatorEnv {
// Force a valid timezone. If both PHP and Phabricator configuration are // Force a valid timezone. If both PHP and Phabricator configuration are
// invalid, use UTC. // invalid, use UTC.
$tz = PhabricatorEnv::getEnvConfig('phabricator.timezone'); $tz = self::getEnvConfig('phabricator.timezone');
if ($tz) { if ($tz) {
@date_default_timezone_set($tz); @date_default_timezone_set($tz);
} }
@ -102,7 +102,7 @@ final class PhabricatorEnv {
$phabricator_path = dirname(phutil_get_library_root('phabricator')); $phabricator_path = dirname(phutil_get_library_root('phabricator'));
$support_path = $phabricator_path.'/support/bin'; $support_path = $phabricator_path.'/support/bin';
$env_path = $support_path.PATH_SEPARATOR.$env_path; $env_path = $support_path.PATH_SEPARATOR.$env_path;
$append_dirs = PhabricatorEnv::getEnvConfig('environment.append-paths'); $append_dirs = self::getEnvConfig('environment.append-paths');
if (!empty($append_dirs)) { if (!empty($append_dirs)) {
$append_path = implode(PATH_SEPARATOR, $append_dirs); $append_path = implode(PATH_SEPARATOR, $append_dirs);
$env_path = $env_path.PATH_SEPARATOR.$append_path; $env_path = $env_path.PATH_SEPARATOR.$append_path;
@ -116,7 +116,7 @@ final class PhabricatorEnv {
// If an instance identifier is defined, write it into the environment so // If an instance identifier is defined, write it into the environment so
// it's available to subprocesses. // it's available to subprocesses.
$instance = PhabricatorEnv::getEnvConfig('cluster.instance'); $instance = self::getEnvConfig('cluster.instance');
if (strlen($instance)) { if (strlen($instance)) {
putenv('PHABRICATOR_INSTANCE='.$instance); putenv('PHABRICATOR_INSTANCE='.$instance);
$_ENV['PHABRICATOR_INSTANCE'] = $instance; $_ENV['PHABRICATOR_INSTANCE'] = $instance;
@ -139,7 +139,7 @@ final class PhabricatorEnv {
$translations = PhutilTranslation::getTranslationMapForLocale( $translations = PhutilTranslation::getTranslationMapForLocale(
$locale_code); $locale_code);
$override = PhabricatorEnv::getEnvConfig('translation.override'); $override = self::getEnvConfig('translation.override');
if (!is_array($override)) { if (!is_array($override)) {
$override = array(); $override = array();
} }
@ -178,7 +178,7 @@ final class PhabricatorEnv {
// If the install overrides the database adapter, we might need to load // If the install overrides the database adapter, we might need to load
// the database adapter class before we can push on the database config. // the database adapter class before we can push on the database config.
// This config is locked and can't be edited from the web UI anyway. // This config is locked and can't be edited from the web UI anyway.
foreach (PhabricatorEnv::getEnvConfig('load-libraries') as $library) { foreach (self::getEnvConfig('load-libraries') as $library) {
phutil_load_library($library); phutil_load_library($library);
} }
@ -809,7 +809,7 @@ final class PhabricatorEnv {
} }
public static function isClusterAddress($address) { public static function isClusterAddress($address) {
$cluster_addresses = PhabricatorEnv::getEnvConfig('cluster.addresses'); $cluster_addresses = self::getEnvConfig('cluster.addresses');
if (!$cluster_addresses) { if (!$cluster_addresses) {
throw new Exception( throw new Exception(
pht( pht(

View file

@ -21,8 +21,11 @@ final class PhabricatorExampleEventListener extends PhabricatorEventListener {
$console = PhutilConsole::getConsole(); $console = PhutilConsole::getConsole();
$console->writeOut( $console->writeOut(
"PhabricatorExampleEventListener got test event at %d\n", "%s\n",
$event->getValue('time')); pht(
'% got test event at %d',
__CLASS__,
$event->getValue('time')));
} }
} }

View file

@ -38,8 +38,8 @@ final class PhabricatorSMS
// and ProviderSMSID are totally garbage data before a send it attempted. // and ProviderSMSID are totally garbage data before a send it attempted.
return id(new PhabricatorSMS()) return id(new PhabricatorSMS())
->setBody($body) ->setBody($body)
->setSendStatus(PhabricatorSMS::STATUS_UNSENT) ->setSendStatus(self::STATUS_UNSENT)
->setProviderShortName(PhabricatorSMS::SHORTNAME_PLACEHOLDER) ->setProviderShortName(self::SHORTNAME_PLACEHOLDER)
->setProviderSMSID(Filesystem::readRandomCharacters(40)); ->setProviderSMSID(Filesystem::readRandomCharacters(40));
} }
@ -70,6 +70,6 @@ final class PhabricatorSMS
public function hasBeenSentAtLeastOnce() { public function hasBeenSentAtLeastOnce() {
return ($this->getProviderShortName() != return ($this->getProviderShortName() !=
PhabricatorSMS::SHORTNAME_PLACEHOLDER); self::SHORTNAME_PLACEHOLDER);
} }
} }

View file

@ -38,7 +38,7 @@ abstract class PhabricatorSQLPatchList {
final public static function buildAllPatches() { final public static function buildAllPatches() {
$patch_lists = id(new PhutilSymbolLoader()) $patch_lists = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorSQLPatchList') ->setAncestorClass(__CLASS__)
->setConcreteOnly(true) ->setConcreteOnly(true)
->selectAndLoadSymbols(); ->selectAndLoadSymbols();

View file

@ -25,7 +25,10 @@ final class PhabricatorTime {
public static function popTime($key) { public static function popTime($key) {
if ($key !== last_key(self::$stack)) { if ($key !== last_key(self::$stack)) {
throw new Exception('PhabricatorTime::popTime with bad key.'); throw new Exception(
pht(
'%s with bad key.',
__METHOD__));
} }
array_pop(self::$stack); array_pop(self::$stack);
@ -49,7 +52,7 @@ final class PhabricatorTime {
$old_zone = date_default_timezone_get(); $old_zone = date_default_timezone_get();
date_default_timezone_set($user->getTimezoneIdentifier()); date_default_timezone_set($user->getTimezoneIdentifier());
$timestamp = (int)strtotime($time, PhabricatorTime::getNow()); $timestamp = (int)strtotime($time, self::getNow());
if ($timestamp <= 0) { if ($timestamp <= 0) {
$timestamp = null; $timestamp = null;
} }

View file

@ -35,7 +35,7 @@ final class PhabricatorHash extends Phobject {
} }
for ($ii = 0; $ii < 1000; $ii++) { for ($ii = 0; $ii < 1000; $ii++) {
$result = PhabricatorHash::digest($result, $salt); $result = self::digest($result, $salt);
} }
return $result; return $result;
@ -113,7 +113,7 @@ final class PhabricatorHash extends Phobject {
// who can control the inputs from intentionally using the hashed form // who can control the inputs from intentionally using the hashed form
// of a string to cause a collision. // of a string to cause a collision.
$hash = PhabricatorHash::digestForIndex($string); $hash = self::digestForIndex($string);
$prefix = substr($string, 0, ($length - ($min_length - 1))); $prefix = substr($string, 0, ($length - ($min_length - 1)));

View file

@ -213,7 +213,7 @@ abstract class PhabricatorPasswordHasher extends Phobject {
*/ */
public static function getAllHashers() { public static function getAllHashers() {
$objects = id(new PhutilSymbolLoader()) $objects = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorPasswordHasher') ->setAncestorClass(__CLASS__)
->loadObjects(); ->loadObjects();
$map = array(); $map = array();
@ -404,7 +404,7 @@ abstract class PhabricatorPasswordHasher extends Phobject {
} }
try { try {
$current_hasher = PhabricatorPasswordHasher::getHasherForHash($hash); $current_hasher = self::getHasherForHash($hash);
return $current_hasher->getHumanReadableName(); return $current_hasher->getHumanReadableName();
} catch (Exception $ex) { } catch (Exception $ex) {
$info = self::parseHashFromStorage($hash); $info = self::parseHashFromStorage($hash);
@ -421,7 +421,7 @@ abstract class PhabricatorPasswordHasher extends Phobject {
*/ */
public static function getBestAlgorithmName() { public static function getBestAlgorithmName() {
try { try {
$best_hasher = PhabricatorPasswordHasher::getBestHasher(); $best_hasher = self::getBestHasher();
return $best_hasher->getHumanReadableName(); return $best_hasher->getHumanReadableName();
} catch (Exception $ex) { } catch (Exception $ex) {
return pht('Unknown'); return pht('Unknown');

View file

@ -215,7 +215,10 @@ final class AphrontDialogView extends AphrontView {
if (!$this->user) { if (!$this->user) {
throw new Exception( throw new Exception(
pht('You must call setUser() when rendering an AphrontDialogView.')); pht(
'You must call %s when rendering an %s.',
'setUser()',
__CLASS__));
} }
$more = $this->class; $more = $this->class;

View file

@ -126,7 +126,10 @@ final class AphrontFormView extends AphrontView {
$layout = $this->buildLayoutView(); $layout = $this->buildLayoutView();
if (!$this->user) { if (!$this->user) {
throw new Exception(pht('You must pass the user to AphrontFormView.')); throw new Exception(
pht(
'You must pass the user to %s.',
__CLASS__));
} }
$sigils = $this->sigils; $sigils = $this->sigils;

View file

@ -33,7 +33,10 @@ final class PHUIFormLayoutView extends AphrontView {
public function appendRemarkupInstructions($remarkup) { public function appendRemarkupInstructions($remarkup) {
if ($this->getUser() === null) { if ($this->getUser() === null) {
throw new Exception( throw new Exception(
'Call `setUser` before appending Remarkup to PHUIFormLayoutView.'); pht(
'Call %s before appending Remarkup to %s.',
'setUser()',
__CLASS__));
} }
return $this->appendInstructions( return $this->appendInstructions(

View file

@ -41,7 +41,6 @@ final class PHUIInfoView extends AphrontView {
} }
final public function render() { final public function render() {
require_celerity_resource('phui-info-view-css'); require_celerity_resource('phui-info-view-css');
$errors = $this->errors; $errors = $this->errors;

View file

@ -152,7 +152,7 @@ final class PHUIPagedFormView extends AphrontView {
$is_attempt_complete = false; $is_attempt_complete = false;
if ($this->prevPage) { if ($this->prevPage) {
$prev_index = $this->getPageIndex($selected->getKey()) - 1;; $prev_index = $this->getPageIndex($selected->getKey()) - 1;
$index = max(0, $prev_index); $index = max(0, $prev_index);
$selected = $this->getPageByIndex($index); $selected = $this->getPageByIndex($index);
} else if ($this->nextPage) { } else if ($this->nextPage) {

View file

@ -25,7 +25,10 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
$viewer = $this->getUser(); $viewer = $this->getUser();
if (!$viewer) { if (!$viewer) {
throw new Exception( throw new Exception(
pht('Call setUser() before rendering a PhabricatorRemarkupControl!')); pht(
'Call %s before rendering a %s!',
'setUser()',
__CLASS__));
} }
// We need to have this if previews render images, since Ajax can not // We need to have this if previews render images, since Ajax can not

View file

@ -3,7 +3,6 @@
/** /**
* This is a standard Phabricator page with menus, Javelin, DarkConsole, and * This is a standard Phabricator page with menus, Javelin, DarkConsole, and
* basic styles. * basic styles.
*
*/ */
final class PhabricatorStandardPageView extends PhabricatorBarePageView { final class PhabricatorStandardPageView extends PhabricatorBarePageView {
@ -160,7 +159,8 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
if (!$this->getRequest()) { if (!$this->getRequest()) {
throw new Exception( throw new Exception(
pht( pht(
'You must set the Request to render a PhabricatorStandardPageView.')); 'You must set the Request to render a %s.',
__CLASS__));
} }
$console = $this->getConsole(); $console = $this->getConsole();

View file

@ -74,7 +74,7 @@ final class PHUIDocumentView extends AphrontTagView {
if ($this->offset) { if ($this->offset) {
$classes[] = 'phui-document-offset'; $classes[] = 'phui-document-offset';
}; }
if ($this->fluid) { if ($this->fluid) {
$classes[] = 'phui-document-fluid'; $classes[] = 'phui-document-fluid';

View file

@ -255,7 +255,7 @@ final class PhabricatorStartup {
static $initialized; static $initialized;
if (!$initialized) { if (!$initialized) {
declare(ticks=1); declare(ticks=1);
register_tick_function(array('PhabricatorStartup', 'onDebugTick')); register_tick_function(array(__CLASS__, 'onDebugTick'));
} }
} }
@ -647,7 +647,7 @@ final class PhabricatorStartup {
// populated into $_POST, but it wasn't. // populated into $_POST, but it wasn't.
$config = ini_get('post_max_size'); $config = ini_get('post_max_size');
PhabricatorStartup::didFatal( self::didFatal(
"As received by the server, this request had a nonzero content length ". "As received by the server, this request had a nonzero content length ".
"but no POST data.\n\n". "but no POST data.\n\n".
"Normally, this indicates that it exceeds the 'post_max_size' setting ". "Normally, this indicates that it exceeds the 'post_max_size' setting ".