1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +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.
*/
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() {
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(
$object,
array('AphrontResponse', 'processValueForJSONEncoding'));
array(__CLASS__, 'processValueForJSONEncoding'));
$response = json_encode($object);

View file

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

View file

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

View file

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

View file

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

View file

@ -200,7 +200,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
public function getTerseSummary(PhabricatorUser $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);
} else {
return pht('Away until %s', $until);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -242,7 +242,7 @@ final class PhabricatorFileComposeController
}
$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();
$preview_id = celerity_generate_unique_node_id();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -15,9 +15,9 @@ final class PhabricatorPolicies extends PhabricatorPolicyConstants {
*/
public static function getMostOpenPolicy() {
if (PhabricatorEnv::getEnvConfig('policy.allow-public')) {
return PhabricatorPolicies::POLICY_PUBLIC;
return self::POLICY_PUBLIC;
} 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) {
$project_icons = PhabricatorProjectIcon::getIconMap();
$project_icons = self::getIconMap();
return phutil_tag(
'span',

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -19,7 +19,11 @@ final class PhabricatorBot extends PhabricatorDaemon {
protected function run() {
$argv = $this->getArgv();
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]);
@ -72,7 +76,7 @@ final class PhabricatorBot extends PhabricatorDaemon {
$response = $conduit->callMethodSynchronous(
'conduit.connect',
array(
'client' => 'PhabricatorBot',
'client' => __CLASS__,
'clientVersion' => '1.0',
'clientDescription' => php_uname('n').':'.$nick,
'host' => $conduit_host,

View file

@ -150,7 +150,7 @@ final class PhabricatorWorkerTriggerQuery
if (($this->nextEpochMin !== null) ||
($this->nextEpochMax !== null) ||
($this->order == PhabricatorWorkerTriggerQuery::ORDER_EXECUTION)) {
($this->order == self::ORDER_EXECUTION)) {
$joins[] = qsprintf(
$conn_r,
'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
// invalid, use UTC.
$tz = PhabricatorEnv::getEnvConfig('phabricator.timezone');
$tz = self::getEnvConfig('phabricator.timezone');
if ($tz) {
@date_default_timezone_set($tz);
}
@ -102,7 +102,7 @@ final class PhabricatorEnv {
$phabricator_path = dirname(phutil_get_library_root('phabricator'));
$support_path = $phabricator_path.'/support/bin';
$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)) {
$append_path = implode(PATH_SEPARATOR, $append_dirs);
$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
// it's available to subprocesses.
$instance = PhabricatorEnv::getEnvConfig('cluster.instance');
$instance = self::getEnvConfig('cluster.instance');
if (strlen($instance)) {
putenv('PHABRICATOR_INSTANCE='.$instance);
$_ENV['PHABRICATOR_INSTANCE'] = $instance;
@ -139,7 +139,7 @@ final class PhabricatorEnv {
$translations = PhutilTranslation::getTranslationMapForLocale(
$locale_code);
$override = PhabricatorEnv::getEnvConfig('translation.override');
$override = self::getEnvConfig('translation.override');
if (!is_array($override)) {
$override = array();
}
@ -178,7 +178,7 @@ final class PhabricatorEnv {
// If the install overrides the database adapter, we might need to load
// 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.
foreach (PhabricatorEnv::getEnvConfig('load-libraries') as $library) {
foreach (self::getEnvConfig('load-libraries') as $library) {
phutil_load_library($library);
}
@ -809,7 +809,7 @@ final class PhabricatorEnv {
}
public static function isClusterAddress($address) {
$cluster_addresses = PhabricatorEnv::getEnvConfig('cluster.addresses');
$cluster_addresses = self::getEnvConfig('cluster.addresses');
if (!$cluster_addresses) {
throw new Exception(
pht(

View file

@ -21,8 +21,11 @@ final class PhabricatorExampleEventListener extends PhabricatorEventListener {
$console = PhutilConsole::getConsole();
$console->writeOut(
"PhabricatorExampleEventListener got test event at %d\n",
$event->getValue('time'));
"%s\n",
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.
return id(new PhabricatorSMS())
->setBody($body)
->setSendStatus(PhabricatorSMS::STATUS_UNSENT)
->setProviderShortName(PhabricatorSMS::SHORTNAME_PLACEHOLDER)
->setSendStatus(self::STATUS_UNSENT)
->setProviderShortName(self::SHORTNAME_PLACEHOLDER)
->setProviderSMSID(Filesystem::readRandomCharacters(40));
}
@ -70,6 +70,6 @@ final class PhabricatorSMS
public function hasBeenSentAtLeastOnce() {
return ($this->getProviderShortName() !=
PhabricatorSMS::SHORTNAME_PLACEHOLDER);
self::SHORTNAME_PLACEHOLDER);
}
}

View file

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

View file

@ -25,7 +25,10 @@ final class PhabricatorTime {
public static function popTime($key) {
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);
@ -49,7 +52,7 @@ final class PhabricatorTime {
$old_zone = date_default_timezone_get();
date_default_timezone_set($user->getTimezoneIdentifier());
$timestamp = (int)strtotime($time, PhabricatorTime::getNow());
$timestamp = (int)strtotime($time, self::getNow());
if ($timestamp <= 0) {
$timestamp = null;
}

View file

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

View file

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

View file

@ -215,7 +215,10 @@ final class AphrontDialogView extends AphrontView {
if (!$this->user) {
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;

View file

@ -126,7 +126,10 @@ final class AphrontFormView extends AphrontView {
$layout = $this->buildLayoutView();
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;

View file

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

View file

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

View file

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

View file

@ -25,7 +25,10 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
$viewer = $this->getUser();
if (!$viewer) {
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

View file

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

View file

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

View file

@ -255,7 +255,7 @@ final class PhabricatorStartup {
static $initialized;
if (!$initialized) {
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.
$config = ini_get('post_max_size');
PhabricatorStartup::didFatal(
self::didFatal(
"As received by the server, this request had a nonzero content length ".
"but no POST data.\n\n".
"Normally, this indicates that it exceeds the 'post_max_size' setting ".