From acb45968d889f21eb3c7614847ac816ab1b33be5 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Thu, 14 May 2015 06:50:28 +1000 Subject: [PATCH] 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 --- src/aphront/AphrontRequest.php | 2 +- src/aphront/response/AphrontProxyResponse.php | 5 ++- src/aphront/response/AphrontResponse.php | 2 +- .../PhabricatorAuditStatusConstants.php | 14 +++---- .../storage/PhabricatorAuditInlineComment.php | 2 +- .../base/PhabricatorApplication.php | 2 +- src/applications/cache/PhabricatorCaches.php | 2 +- .../storage/PhabricatorCalendarEvent.php | 2 +- .../resources/CelerityPhysicalResources.php | 2 +- .../conduit/method/ConduitAPIMethod.php | 6 +-- .../query/PhabricatorConduitLogQuery.php | 2 +- .../query/PhabricatorConduitTokenQuery.php | 2 +- .../storage/PhabricatorConduitToken.php | 2 +- .../config/check/PhabricatorSetupCheck.php | 2 +- .../PhabricatorApplicationConfigOptions.php | 16 +++++--- .../conpherence/storage/ConpherenceThread.php | 2 +- .../errorlog/DarkConsoleErrorLogPluginAPI.php | 2 +- .../query/PhabricatorDaemonLogQuery.php | 4 +- .../constants/DifferentialAction.php | 40 +++++++++---------- .../constants/DifferentialChangeType.php | 24 +++++------ .../storage/DifferentialTransaction.php | 2 +- .../diffusion/data/DiffusionPathChange.php | 4 +- .../diviner/storage/DivinerLiveSymbol.php | 4 +- .../DrydockBlueprintImplementation.php | 2 +- .../drydock/storage/DrydockLease.php | 2 +- .../feed/story/PhabricatorFeedStory.php | 2 +- .../PhabricatorFileComposeController.php | 2 +- .../files/storage/PhabricatorFile.php | 10 ++--- .../storage/FundInitiativeTransaction.php | 36 ++++++++--------- .../HarbormasterBuildStepImplementation.php | 2 +- .../storage/HarbormasterBuildable.php | 4 +- .../PhabricatorHelpApplication.php | 2 +- .../herald/adapter/HeraldAdapter.php | 2 +- .../PhabricatorMacroMemeController.php | 2 +- .../maniphest/query/ManiphestTaskQuery.php | 2 +- .../MetaMTAEmailTransactionCommand.php | 2 +- .../PhabricatorContentSource.php | 6 +-- .../nuance/storage/NuanceItem.php | 2 +- .../storage/PhabricatorPasteTransaction.php | 12 +++--- .../PhabricatorUserEditorTestCase.php | 4 +- .../handle/pool/PhabricatorHandleList.php | 5 ++- .../phid/type/PhabricatorPHIDType.php | 10 +++-- .../phortune/currency/PhortuneCurrency.php | 12 +++--- .../provider/PhortunePaymentProvider.php | 2 +- .../phortune/storage/PhortuneAccount.php | 2 +- .../phortune/storage/PhortuneCart.php | 2 +- .../phragment/storage/PhragmentFragment.php | 2 +- .../policy/constants/PhabricatorPolicies.php | 4 +- .../project/icon/PhabricatorProjectIcon.php | 2 +- .../storage/PhabricatorProjectColumn.php | 2 +- .../PhabricatorProjectColumnTransaction.php | 6 +-- .../storage/PhabricatorProjectTransaction.php | 34 ++++++++-------- .../releeph/storage/ReleephRequest.php | 4 +- .../storage/ReleephRequestTransaction.php | 28 ++++++------- .../PhabricatorRepositorySearchEngine.php | 2 +- .../storage/PhabricatorRepositoryPushLog.php | 8 ++-- .../storage/PhabricatorUserPreferences.php | 4 +- .../PhabricatorSlowvoteTransaction.php | 40 +++++++++---------- .../PhabricatorApplicationTransaction.php | 4 +- .../field/PhabricatorCustomField.php | 2 +- .../daemon/bot/PhabricatorBot.php | 8 +++- .../query/PhabricatorWorkerTriggerQuery.php | 2 +- src/infrastructure/env/PhabricatorEnv.php | 12 +++--- .../PhabricatorExampleEventListener.php | 7 +++- .../sms/storage/PhabricatorSMS.php | 6 +-- .../storage/patch/PhabricatorSQLPatchList.php | 2 +- src/infrastructure/time/PhabricatorTime.php | 7 +++- src/infrastructure/util/PhabricatorHash.php | 4 +- .../password/PhabricatorPasswordHasher.php | 6 +-- src/view/AphrontDialogView.php | 5 ++- src/view/form/AphrontFormView.php | 5 ++- src/view/form/PHUIFormLayoutView.php | 5 ++- src/view/form/PHUIInfoView.php | 1 - src/view/form/PHUIPagedFormView.php | 2 +- .../control/PhabricatorRemarkupControl.php | 5 ++- src/view/page/PhabricatorStandardPageView.php | 4 +- src/view/phui/PHUIDocumentView.php | 2 +- support/PhabricatorStartup.php | 4 +- 78 files changed, 268 insertions(+), 233 deletions(-) diff --git a/src/aphront/AphrontRequest.php b/src/aphront/AphrontRequest.php index 197e5a437c..ab6e0d9820 100644 --- a/src/aphront/AphrontRequest.php +++ b/src/aphront/AphrontRequest.php @@ -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'); } diff --git a/src/aphront/response/AphrontProxyResponse.php b/src/aphront/response/AphrontProxyResponse.php index 7e27ea2b1b..175f2d2c53 100644 --- a/src/aphront/response/AphrontProxyResponse.php +++ b/src/aphront/response/AphrontProxyResponse.php @@ -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()')); } } diff --git a/src/aphront/response/AphrontResponse.php b/src/aphront/response/AphrontResponse.php index 0bbe22b5ec..b1e72f5529 100644 --- a/src/aphront/response/AphrontResponse.php +++ b/src/aphront/response/AphrontResponse.php @@ -154,7 +154,7 @@ abstract class AphrontResponse { array_walk_recursive( $object, - array('AphrontResponse', 'processValueForJSONEncoding')); + array(__CLASS__, 'processValueForJSONEncoding')); $response = json_encode($object); diff --git a/src/applications/audit/constants/PhabricatorAuditStatusConstants.php b/src/applications/audit/constants/PhabricatorAuditStatusConstants.php index e1a4378ab3..78924905b9 100644 --- a/src/applications/audit/constants/PhabricatorAuditStatusConstants.php +++ b/src/applications/audit/constants/PhabricatorAuditStatusConstants.php @@ -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: diff --git a/src/applications/audit/storage/PhabricatorAuditInlineComment.php b/src/applications/audit/storage/PhabricatorAuditInlineComment.php index 8c0aa78d5d..292e0274a5 100644 --- a/src/applications/audit/storage/PhabricatorAuditInlineComment.php +++ b/src/applications/audit/storage/PhabricatorAuditInlineComment.php @@ -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; diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php index d5237adc11..295d4db180 100644 --- a/src/applications/base/PhabricatorApplication.php +++ b/src/applications/base/PhabricatorApplication.php @@ -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) { diff --git a/src/applications/cache/PhabricatorCaches.php b/src/applications/cache/PhabricatorCaches.php index 37708457b7..4e3af7a6a4 100644 --- a/src/applications/cache/PhabricatorCaches.php +++ b/src/applications/cache/PhabricatorCaches.php @@ -270,7 +270,7 @@ final class PhabricatorCaches { } private static function addNamespaceToCaches(array $caches) { - $namespace = PhabricatorCaches::getNamespace(); + $namespace = self::getNamespace(); if (!$namespace) { return $caches; } diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php index af756b5273..3dd984ef7d 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -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); diff --git a/src/applications/celerity/resources/CelerityPhysicalResources.php b/src/applications/celerity/resources/CelerityPhysicalResources.php index 995b9f1a55..41665d15f2 100644 --- a/src/applications/celerity/resources/CelerityPhysicalResources.php +++ b/src/applications/celerity/resources/CelerityPhysicalResources.php @@ -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) { diff --git a/src/applications/conduit/method/ConduitAPIMethod.php b/src/applications/conduit/method/ConduitAPIMethod.php index a048e3e0f0..f6d464cfc5 100644 --- a/src/applications/conduit/method/ConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitAPIMethod.php @@ -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); diff --git a/src/applications/conduit/query/PhabricatorConduitLogQuery.php b/src/applications/conduit/query/PhabricatorConduitLogQuery.php index 4d66cccae5..a08fd25a68 100644 --- a/src/applications/conduit/query/PhabricatorConduitLogQuery.php +++ b/src/applications/conduit/query/PhabricatorConduitLogQuery.php @@ -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) { diff --git a/src/applications/conduit/query/PhabricatorConduitTokenQuery.php b/src/applications/conduit/query/PhabricatorConduitTokenQuery.php index 870043cac8..44586f1815 100644 --- a/src/applications/conduit/query/PhabricatorConduitTokenQuery.php +++ b/src/applications/conduit/query/PhabricatorConduitTokenQuery.php @@ -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) { diff --git a/src/applications/conduit/storage/PhabricatorConduitToken.php b/src/applications/conduit/storage/PhabricatorConduitToken.php index ab4d88335e..f5673fdab3 100644 --- a/src/applications/conduit/storage/PhabricatorConduitToken.php +++ b/src/applications/conduit/storage/PhabricatorConduitToken.php @@ -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(); diff --git a/src/applications/config/check/PhabricatorSetupCheck.php b/src/applications/config/check/PhabricatorSetupCheck.php index b40dd4c8cc..a689d14943 100644 --- a/src/applications/config/check/PhabricatorSetupCheck.php +++ b/src/applications/config/check/PhabricatorSetupCheck.php @@ -113,7 +113,7 @@ abstract class PhabricatorSetupCheck { final public static function runAllChecks() { $symbols = id(new PhutilSymbolLoader()) - ->setAncestorClass('PhabricatorSetupCheck') + ->setAncestorClass(__CLASS__) ->setConcreteOnly(true) ->selectAndLoadSymbols(); diff --git a/src/applications/config/option/PhabricatorApplicationConfigOptions.php b/src/applications/config/option/PhabricatorApplicationConfigOptions.php index 6982ef513f..7ac1df3e16 100644 --- a/src/applications/config/option/PhabricatorApplicationConfigOptions.php +++ b/src/applications/config/option/PhabricatorApplicationConfigOptions.php @@ -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; } diff --git a/src/applications/conpherence/storage/ConpherenceThread.php b/src/applications/conpherence/storage/ConpherenceThread.php index 03f8f6997e..8ed0e4fd18 100644 --- a/src/applications/conpherence/storage/ConpherenceThread.php +++ b/src/applications/conpherence/storage/ConpherenceThread.php @@ -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()); diff --git a/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php b/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php index 0708c98eec..5d9723cc4b 100644 --- a/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php +++ b/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php @@ -12,7 +12,7 @@ final class DarkConsoleErrorLogPluginAPI { // reenter autoloaders). PhutilReadableSerializer::printableValue(null); PhutilErrorHandler::setErrorListener( - array('DarkConsoleErrorLogPluginAPI', 'handleErrors')); + array(__CLASS__, 'handleErrors')); } public static function enableDiscardMode() { diff --git a/src/applications/daemon/query/PhabricatorDaemonLogQuery.php b/src/applications/daemon/query/PhabricatorDaemonLogQuery.php index 5822194d06..961c1cfc61 100644 --- a/src/applications/daemon/query/PhabricatorDaemonLogQuery.php +++ b/src/applications/daemon/query/PhabricatorDaemonLogQuery.php @@ -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; diff --git a/src/applications/differential/constants/DifferentialAction.php b/src/applications/differential/constants/DifferentialAction.php index 9238990161..48a263c45a 100644 --- a/src/applications/differential/constants/DifferentialAction.php +++ b/src/applications/differential/constants/DifferentialAction.php @@ -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; diff --git a/src/applications/differential/constants/DifferentialChangeType.php b/src/applications/differential/constants/DifferentialChangeType.php index 0a4f7861cc..2ce5392165 100644 --- a/src/applications/differential/constants/DifferentialChangeType.php +++ b/src/applications/differential/constants/DifferentialChangeType.php @@ -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]); } diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php index 5cb6fd7e87..2857d24272 100644 --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -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.'); diff --git a/src/applications/diffusion/data/DiffusionPathChange.php b/src/applications/diffusion/data/DiffusionPathChange.php index b1d7286fdd..6f96057014 100644 --- a/src/applications/diffusion/data/DiffusionPathChange.php +++ b/src/applications/diffusion/data/DiffusionPathChange.php @@ -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); diff --git a/src/applications/diviner/storage/DivinerLiveSymbol.php b/src/applications/diviner/storage/DivinerLiveSymbol.php index b6a7cde226..ba35eed255 100644 --- a/src/applications/diviner/storage/DivinerLiveSymbol.php +++ b/src/applications/diviner/storage/DivinerLiveSymbol.php @@ -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; } diff --git a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php index 18ca597a90..43891d0d07 100644 --- a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php @@ -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'); diff --git a/src/applications/drydock/storage/DrydockLease.php b/src/applications/drydock/storage/DrydockLease.php index cb61e54490..252c922065 100644 --- a/src/applications/drydock/storage/DrydockLease.php +++ b/src/applications/drydock/storage/DrydockLease.php @@ -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')); diff --git a/src/applications/feed/story/PhabricatorFeedStory.php b/src/applications/feed/story/PhabricatorFeedStory.php index 0c989d4948..f94c2601e8 100644 --- a/src/applications/feed/story/PhabricatorFeedStory.php +++ b/src/applications/feed/story/PhabricatorFeedStory.php @@ -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; } diff --git a/src/applications/files/controller/PhabricatorFileComposeController.php b/src/applications/files/controller/PhabricatorFileComposeController.php index bb95cb67eb..d1e6041131 100644 --- a/src/applications/files/controller/PhabricatorFileComposeController.php +++ b/src/applications/files/controller/PhabricatorFileComposeController.php @@ -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(); diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php index 34a2bb5df5..f8e99bc965 100644 --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -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) diff --git a/src/applications/fund/storage/FundInitiativeTransaction.php b/src/applications/fund/storage/FundInitiativeTransaction.php index 3531ff3e5e..c06d62e229 100644 --- a/src/applications/fund/storage/FundInitiativeTransaction.php +++ b/src/applications/fund/storage/FundInitiativeTransaction.php @@ -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); } diff --git a/src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php index 5057097fac..4fe1128ac0 100644 --- a/src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php +++ b/src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php @@ -4,7 +4,7 @@ abstract class HarbormasterBuildStepImplementation { public static function getImplementations() { return id(new PhutilSymbolLoader()) - ->setAncestorClass('HarbormasterBuildStepImplementation') + ->setAncestorClass(__CLASS__) ->loadObjects(); } diff --git a/src/applications/harbormaster/storage/HarbormasterBuildable.php b/src/applications/harbormaster/storage/HarbormasterBuildable.php index b53e2bc2d3..81f8e66d07 100644 --- a/src/applications/harbormaster/storage/HarbormasterBuildable.php +++ b/src/applications/harbormaster/storage/HarbormasterBuildable.php @@ -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); diff --git a/src/applications/help/application/PhabricatorHelpApplication.php b/src/applications/help/application/PhabricatorHelpApplication.php index c86d5cd0d0..b1f66b02cd 100644 --- a/src/applications/help/application/PhabricatorHelpApplication.php +++ b/src/applications/help/application/PhabricatorHelpApplication.php @@ -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, diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php index 6a51ade55f..f56572a398 100644 --- a/src/applications/herald/adapter/HeraldAdapter.php +++ b/src/applications/herald/adapter/HeraldAdapter.php @@ -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; diff --git a/src/applications/macro/controller/PhabricatorMacroMemeController.php b/src/applications/macro/controller/PhabricatorMacroMemeController.php index badb1759ad..ff25a8a8a4 100644 --- a/src/applications/macro/controller/PhabricatorMacroMemeController.php +++ b/src/applications/macro/controller/PhabricatorMacroMemeController.php @@ -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(); diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php index 60e3425af6..4a6381581b 100644 --- a/src/applications/maniphest/query/ManiphestTaskQuery.php +++ b/src/applications/maniphest/query/ManiphestTaskQuery.php @@ -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; diff --git a/src/applications/metamta/command/MetaMTAEmailTransactionCommand.php b/src/applications/metamta/command/MetaMTAEmailTransactionCommand.php index e6011768df..cc78df3492 100644 --- a/src/applications/metamta/command/MetaMTAEmailTransactionCommand.php +++ b/src/applications/metamta/command/MetaMTAEmailTransactionCommand.php @@ -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) { diff --git a/src/applications/metamta/contentsource/PhabricatorContentSource.php b/src/applications/metamta/contentsource/PhabricatorContentSource.php index a1cbd061f2..e5a29572c1 100644 --- a/src/applications/metamta/contentsource/PhabricatorContentSource.php +++ b/src/applications/metamta/contentsource/PhabricatorContentSource.php @@ -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()); } diff --git a/src/applications/nuance/storage/NuanceItem.php b/src/applications/nuance/storage/NuanceItem.php index 2db403cd2e..50d7ee72ef 100644 --- a/src/applications/nuance/storage/NuanceItem.php +++ b/src/applications/nuance/storage/NuanceItem.php @@ -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() { diff --git a/src/applications/paste/storage/PhabricatorPasteTransaction.php b/src/applications/paste/storage/PhabricatorPasteTransaction.php index cc4e36d2ff..34cc6bd92d 100644 --- a/src/applications/paste/storage/PhabricatorPasteTransaction.php +++ b/src/applications/paste/storage/PhabricatorPasteTransaction.php @@ -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), diff --git a/src/applications/people/editor/__tests__/PhabricatorUserEditorTestCase.php b/src/applications/people/editor/__tests__/PhabricatorUserEditorTestCase.php index f5c3c73a9a..6cc6abf37b 100644 --- a/src/applications/people/editor/__tests__/PhabricatorUserEditorTestCase.php +++ b/src/applications/people/editor/__tests__/PhabricatorUserEditorTestCase.php @@ -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; } diff --git a/src/applications/phid/handle/pool/PhabricatorHandleList.php b/src/applications/phid/handle/pool/PhabricatorHandleList.php index 21a695b258..7a8fed529f 100644 --- a/src/applications/phid/handle/pool/PhabricatorHandleList.php +++ b/src/applications/phid/handle/pool/PhabricatorHandleList.php @@ -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__)); } diff --git a/src/applications/phid/type/PhabricatorPHIDType.php b/src/applications/phid/type/PhabricatorPHIDType.php index 4445ab863d..fd64ab7bd1 100644 --- a/src/applications/phid/type/PhabricatorPHIDType.php +++ b/src/applications/phid/type/PhabricatorPHIDType.php @@ -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); diff --git a/src/applications/phortune/currency/PhortuneCurrency.php b/src/applications/phortune/currency/PhortuneCurrency.php index a473738ed6..b59d9b144a 100644 --- a/src/applications/phortune/currency/PhortuneCurrency.php +++ b/src/applications/phortune/currency/PhortuneCurrency.php @@ -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( diff --git a/src/applications/phortune/provider/PhortunePaymentProvider.php b/src/applications/phortune/provider/PhortunePaymentProvider.php index 49c80dcd72..da36779d06 100644 --- a/src/applications/phortune/provider/PhortunePaymentProvider.php +++ b/src/applications/phortune/provider/PhortunePaymentProvider.php @@ -118,7 +118,7 @@ abstract class PhortunePaymentProvider { public static function getAllProviders() { return id(new PhutilSymbolLoader()) - ->setAncestorClass('PhortunePaymentProvider') + ->setAncestorClass(__CLASS__) ->loadObjects(); } diff --git a/src/applications/phortune/storage/PhortuneAccount.php b/src/applications/phortune/storage/PhortuneAccount.php index facb9d5089..e86fd53df2 100644 --- a/src/applications/phortune/storage/PhortuneAccount.php +++ b/src/applications/phortune/storage/PhortuneAccount.php @@ -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()) diff --git a/src/applications/phortune/storage/PhortuneCart.php b/src/applications/phortune/storage/PhortuneCart.php index 46d474cc93..70ecbb21c9 100644 --- a/src/applications/phortune/storage/PhortuneCart.php +++ b/src/applications/phortune/storage/PhortuneCart.php @@ -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(); diff --git a/src/applications/phragment/storage/PhragmentFragment.php b/src/applications/phragment/storage/PhragmentFragment.php index 3f5719178b..574283d7a7 100644 --- a/src/applications/phragment/storage/PhragmentFragment.php +++ b/src/applications/phragment/storage/PhragmentFragment.php @@ -256,7 +256,7 @@ final class PhragmentFragment extends PhragmentDAO $mappings[$path], array('name' => basename($path))); } - PhragmentFragment::createFromFile( + self::createFromFile( $viewer, $file, $base_path.'/'.$path, diff --git a/src/applications/policy/constants/PhabricatorPolicies.php b/src/applications/policy/constants/PhabricatorPolicies.php index 859010eca2..c33b9bf909 100644 --- a/src/applications/policy/constants/PhabricatorPolicies.php +++ b/src/applications/policy/constants/PhabricatorPolicies.php @@ -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; } } diff --git a/src/applications/project/icon/PhabricatorProjectIcon.php b/src/applications/project/icon/PhabricatorProjectIcon.php index ae6efa9b6e..9411baa6a9 100644 --- a/src/applications/project/icon/PhabricatorProjectIcon.php +++ b/src/applications/project/icon/PhabricatorProjectIcon.php @@ -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', diff --git a/src/applications/project/storage/PhabricatorProjectColumn.php b/src/applications/project/storage/PhabricatorProjectColumn.php index 8fcb6ade9c..63b8a8748f 100644 --- a/src/applications/project/storage/PhabricatorProjectColumn.php +++ b/src/applications/project/storage/PhabricatorProjectColumn.php @@ -111,7 +111,7 @@ final class PhabricatorProjectColumn ->setMetadata( array( 'tip' => $text, - ));; + )); } return null; diff --git a/src/applications/project/storage/PhabricatorProjectColumnTransaction.php b/src/applications/project/storage/PhabricatorProjectColumnTransaction.php index dd4f95d5f6..ed4bfed8a6 100644 --- a/src/applications/project/storage/PhabricatorProjectColumnTransaction.php +++ b/src/applications/project/storage/PhabricatorProjectColumnTransaction.php @@ -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( diff --git a/src/applications/project/storage/PhabricatorProjectTransaction.php b/src/applications/project/storage/PhabricatorProjectTransaction.php index 9b0ff0c340..3dceb0934c 100644 --- a/src/applications/project/storage/PhabricatorProjectTransaction.php +++ b/src/applications/project/storage/PhabricatorProjectTransaction.php @@ -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); diff --git a/src/applications/releeph/storage/ReleephRequest.php b/src/applications/releeph/storage/ReleephRequest.php index 7f3f190a6d..7f2487107a 100644 --- a/src/applications/releeph/storage/ReleephRequest.php +++ b/src/applications/releeph/storage/ReleephRequest.php @@ -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 diff --git a/src/applications/releeph/storage/ReleephRequestTransaction.php b/src/applications/releeph/storage/ReleephRequestTransaction.php index bd17ad43c9..f4a4720c78 100644 --- a/src/applications/releeph/storage/ReleephRequestTransaction.php +++ b/src/applications/releeph/storage/ReleephRequestTransaction.php @@ -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) { diff --git a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php index 3131f9b9e6..21c7fe38ab 100644 --- a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php +++ b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php @@ -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) { diff --git a/src/applications/repository/storage/PhabricatorRepositoryPushLog.php b/src/applications/repository/storage/PhabricatorRepositoryPushLog.php index d5fb87fa8d..f16784bbf1 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryPushLog.php +++ b/src/applications/repository/storage/PhabricatorRepositoryPushLog.php @@ -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'), ); } diff --git a/src/applications/settings/storage/PhabricatorUserPreferences.php b/src/applications/settings/storage/PhabricatorUserPreferences.php index e07a045dc2..3248dc8b2a 100644 --- a/src/applications/settings/storage/PhabricatorUserPreferences.php +++ b/src/applications/settings/storage/PhabricatorUserPreferences.php @@ -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'; diff --git a/src/applications/slowvote/storage/PhabricatorSlowvoteTransaction.php b/src/applications/slowvote/storage/PhabricatorSlowvoteTransaction.php index abb73fd588..9abf1f5801 100644 --- a/src/applications/slowvote/storage/PhabricatorSlowvoteTransaction.php +++ b/src/applications/slowvote/storage/PhabricatorSlowvoteTransaction.php @@ -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(); diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php index c6755ccfcc..355f15c2a7 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -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()) { diff --git a/src/infrastructure/customfield/field/PhabricatorCustomField.php b/src/infrastructure/customfield/field/PhabricatorCustomField.php index ec5a02337e..28110e7334 100644 --- a/src/infrastructure/customfield/field/PhabricatorCustomField.php +++ b/src/infrastructure/customfield/field/PhabricatorCustomField.php @@ -65,7 +65,7 @@ abstract class PhabricatorCustomField { "object of class '{$obj_class}'."); } - $fields = PhabricatorCustomField::buildFieldList( + $fields = self::buildFieldList( $base_class, $spec, $object); diff --git a/src/infrastructure/daemon/bot/PhabricatorBot.php b/src/infrastructure/daemon/bot/PhabricatorBot.php index 18a0c74648..ef949cb9ff 100644 --- a/src/infrastructure/daemon/bot/PhabricatorBot.php +++ b/src/infrastructure/daemon/bot/PhabricatorBot.php @@ -19,7 +19,11 @@ final class PhabricatorBot extends PhabricatorDaemon { protected function run() { $argv = $this->getArgv(); if (count($argv) !== 1) { - throw new Exception('usage: PhabricatorBot '); + throw new Exception( + pht( + 'Usage: %s %s', + __CLASS__, + '')); } $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, diff --git a/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php b/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php index 34cab99afa..c569f0c695 100644 --- a/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php +++ b/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php @@ -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', diff --git a/src/infrastructure/env/PhabricatorEnv.php b/src/infrastructure/env/PhabricatorEnv.php index 05ab7c677d..39f911e3c5 100644 --- a/src/infrastructure/env/PhabricatorEnv.php +++ b/src/infrastructure/env/PhabricatorEnv.php @@ -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( diff --git a/src/infrastructure/events/PhabricatorExampleEventListener.php b/src/infrastructure/events/PhabricatorExampleEventListener.php index 0a7bd699df..fb85678da1 100644 --- a/src/infrastructure/events/PhabricatorExampleEventListener.php +++ b/src/infrastructure/events/PhabricatorExampleEventListener.php @@ -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'))); } } diff --git a/src/infrastructure/sms/storage/PhabricatorSMS.php b/src/infrastructure/sms/storage/PhabricatorSMS.php index c17d8f16da..7b6c85f159 100644 --- a/src/infrastructure/sms/storage/PhabricatorSMS.php +++ b/src/infrastructure/sms/storage/PhabricatorSMS.php @@ -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); } } diff --git a/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php b/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php index 0eefe68069..390d591a07 100644 --- a/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php +++ b/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php @@ -38,7 +38,7 @@ abstract class PhabricatorSQLPatchList { final public static function buildAllPatches() { $patch_lists = id(new PhutilSymbolLoader()) - ->setAncestorClass('PhabricatorSQLPatchList') + ->setAncestorClass(__CLASS__) ->setConcreteOnly(true) ->selectAndLoadSymbols(); diff --git a/src/infrastructure/time/PhabricatorTime.php b/src/infrastructure/time/PhabricatorTime.php index d2866d99c2..03495d8412 100644 --- a/src/infrastructure/time/PhabricatorTime.php +++ b/src/infrastructure/time/PhabricatorTime.php @@ -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; } diff --git a/src/infrastructure/util/PhabricatorHash.php b/src/infrastructure/util/PhabricatorHash.php index dd158d1168..df1fbfa08b 100644 --- a/src/infrastructure/util/PhabricatorHash.php +++ b/src/infrastructure/util/PhabricatorHash.php @@ -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))); diff --git a/src/infrastructure/util/password/PhabricatorPasswordHasher.php b/src/infrastructure/util/password/PhabricatorPasswordHasher.php index 4409163509..3b136b4ec3 100644 --- a/src/infrastructure/util/password/PhabricatorPasswordHasher.php +++ b/src/infrastructure/util/password/PhabricatorPasswordHasher.php @@ -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'); diff --git a/src/view/AphrontDialogView.php b/src/view/AphrontDialogView.php index 3d79197bd8..925d76a565 100644 --- a/src/view/AphrontDialogView.php +++ b/src/view/AphrontDialogView.php @@ -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; diff --git a/src/view/form/AphrontFormView.php b/src/view/form/AphrontFormView.php index 6b30656131..f9f281ff20 100644 --- a/src/view/form/AphrontFormView.php +++ b/src/view/form/AphrontFormView.php @@ -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; diff --git a/src/view/form/PHUIFormLayoutView.php b/src/view/form/PHUIFormLayoutView.php index 87e35e03c1..3e7941257e 100644 --- a/src/view/form/PHUIFormLayoutView.php +++ b/src/view/form/PHUIFormLayoutView.php @@ -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( diff --git a/src/view/form/PHUIInfoView.php b/src/view/form/PHUIInfoView.php index a079e3f6ca..497fcf3f78 100644 --- a/src/view/form/PHUIInfoView.php +++ b/src/view/form/PHUIInfoView.php @@ -41,7 +41,6 @@ final class PHUIInfoView extends AphrontView { } final public function render() { - require_celerity_resource('phui-info-view-css'); $errors = $this->errors; diff --git a/src/view/form/PHUIPagedFormView.php b/src/view/form/PHUIPagedFormView.php index 82e58c7f58..ff72f67ca0 100644 --- a/src/view/form/PHUIPagedFormView.php +++ b/src/view/form/PHUIPagedFormView.php @@ -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) { diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php index 7d5451a1b2..b6ed3b5e0c 100644 --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -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 diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index 3c8891ba80..7c5dcaf1cb 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -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(); diff --git a/src/view/phui/PHUIDocumentView.php b/src/view/phui/PHUIDocumentView.php index 833bb48fe5..a27805e1c7 100644 --- a/src/view/phui/PHUIDocumentView.php +++ b/src/view/phui/PHUIDocumentView.php @@ -74,7 +74,7 @@ final class PHUIDocumentView extends AphrontTagView { if ($this->offset) { $classes[] = 'phui-document-offset'; - }; + } if ($this->fluid) { $classes[] = 'phui-document-fluid'; diff --git a/support/PhabricatorStartup.php b/support/PhabricatorStartup.php index 3945049ffb..30e8f3c937 100644 --- a/support/PhabricatorStartup.php +++ b/support/PhabricatorStartup.php @@ -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 ".