@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use PhutilClassMapQuery

Summary: Use `PhutilClassMapQuery` where appropriate.

Test Plan: Browsed around the UI to verify things seemed somewhat working.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13429

+102 -443
+4 -4
src/applications/almanac/servicetype/AlmanacServiceType.php
··· 65 65 * @return map<string, object> Dictionary of available service types. 66 66 */ 67 67 public static function getAllServiceTypes() { 68 - $types = id(new PhutilSymbolLoader()) 68 + return id(new PhutilClassMapQuery()) 69 69 ->setAncestorClass(__CLASS__) 70 - ->loadObjects(); 71 - 72 - return msort($types, 'getServiceTypeName'); 70 + ->setUniqueMethod('getServiceTypeShortName') 71 + ->setSortMethod('getServiceTypeName') 72 + ->execute(); 73 73 } 74 74 75 75
+4 -29
src/applications/auth/factor/PhabricatorAuthFactor.php
··· 34 34 } 35 35 36 36 public static function getAllFactors() { 37 - static $factors; 38 - 39 - if ($factors === null) { 40 - $map = id(new PhutilSymbolLoader()) 41 - ->setAncestorClass(__CLASS__) 42 - ->loadObjects(); 43 - 44 - $factors = array(); 45 - foreach ($map as $factor) { 46 - $key = $factor->getFactorKey(); 47 - if (empty($factors[$key])) { 48 - $factors[$key] = $factor; 49 - } else { 50 - $this_class = get_class($factor); 51 - $that_class = get_class($factors[$key]); 52 - 53 - throw new Exception( 54 - pht( 55 - 'Two auth factors (with classes "%s" and "%s") both provide '. 56 - 'implementations with the same key ("%s"). Each factor must '. 57 - 'have a unique key.', 58 - $this_class, 59 - $that_class, 60 - $key)); 61 - } 62 - } 63 - } 64 - 65 - return $factors; 37 + return id(new PhutilClassMapQuery()) 38 + ->setAncestorClass(__CLASS__) 39 + ->setUniqueMethod('getFactorKey') 40 + ->execute(); 66 41 } 67 42 68 43 protected function newConfigForUser(PhabricatorUser $user) {
+3 -10
src/applications/auth/provider/PhabricatorAuthProvider.php
··· 55 55 } 56 56 57 57 public static function getAllBaseProviders() { 58 - static $providers; 59 - 60 - if ($providers === null) { 61 - $objects = id(new PhutilSymbolLoader()) 62 - ->setAncestorClass(__CLASS__) 63 - ->loadObjects(); 64 - $providers = $objects; 65 - } 66 - 67 - return $providers; 58 + return id(new PhutilClassMapQuery()) 59 + ->setAncestorClass(__CLASS__) 60 + ->execute(); 68 61 } 69 62 70 63 public static function getAllProviders() {
+3 -3
src/applications/base/PhabricatorApplication.php
··· 383 383 static $applications; 384 384 385 385 if ($applications === null) { 386 - $apps = id(new PhutilSymbolLoader()) 386 + $apps = id(new PhutilClassMapQuery()) 387 387 ->setAncestorClass(__CLASS__) 388 - ->loadObjects(); 388 + ->setSortMethod('getApplicationOrder') 389 + ->execute(); 389 390 390 391 // Reorder the applications into "application order". Notably, this 391 392 // ensures their event handlers register in application order. 392 - $apps = msort($apps, 'getApplicationOrder'); 393 393 $apps = mgroup($apps, 'getApplicationGroup'); 394 394 395 395 $group_order = array_keys(self::getApplicationGroups());
+4 -28
src/applications/celerity/postprocessor/CelerityPostprocessor.php
··· 36 36 } 37 37 38 38 final public static function getAllPostprocessors() { 39 - static $postprocessors; 40 - 41 - if ($postprocessors === null) { 42 - $objects = id(new PhutilSymbolLoader()) 43 - ->setAncestorClass(__CLASS__) 44 - ->loadObjects(); 45 - 46 - $map = array(); 47 - foreach ($objects as $object) { 48 - $key = $object->getPostprocessorKey(); 49 - if (empty($map[$key])) { 50 - $map[$key] = $object; 51 - continue; 52 - } 53 - 54 - throw new Exception( 55 - pht( 56 - 'Two postprocessors (of classes "%s" and "%s") define the same '. 57 - 'postprocessor key ("%s"). Each postprocessor must define a '. 58 - 'unique key.', 59 - get_class($object), 60 - get_class($map[$key]), 61 - $key)); 62 - } 63 - $postprocessors = $map; 64 - } 65 - 66 - return $postprocessors; 39 + return id(new PhutilClassMapQuery()) 40 + ->setAncestorClass(__CLASS__) 41 + ->setUniqueMethod('getPostprocessorKey') 42 + ->execute(); 67 43 } 68 44 69 45 }
+5 -18
src/applications/celerity/resources/CelerityPhysicalResources.php
··· 23 23 static $resources_map; 24 24 25 25 if ($resources_map === null) { 26 - $resources_map = array(); 27 - 28 - $resources_list = id(new PhutilSymbolLoader()) 26 + $resources_list = id(new PhutilClassMapQuery()) 29 27 ->setAncestorClass(__CLASS__) 30 - ->loadObjects(); 28 + ->setUniqueMethod('getName') 29 + ->execute(); 31 30 32 31 foreach ($resources_list as $resources) { 33 32 $name = $resources->getName(); ··· 39 38 'lowercase latin letters and digits.', 40 39 $name)); 41 40 } 41 + } 42 42 43 - if (empty($resources_map[$name])) { 44 - $resources_map[$name] = $resources; 45 - } else { 46 - $old = get_class($resources_map[$name]); 47 - $new = get_class($resources); 48 - throw new Exception( 49 - pht( 50 - 'Celerity resource maps must have unique names, but maps %s and '. 51 - '%s share the same name, "%s".', 52 - $old, 53 - $new, 54 - $name)); 55 - } 56 - } 43 + $resources_map = $resources_list; 57 44 } 58 45 59 46 return $resources_map;
+3 -10
src/applications/config/check/PhabricatorSetupCheck.php
··· 112 112 } 113 113 114 114 final public static function loadAllChecks() { 115 - $symbols = id(new PhutilSymbolLoader()) 115 + return id(new PhutilClassMapQuery()) 116 116 ->setAncestorClass(__CLASS__) 117 - ->setConcreteOnly(true) 118 - ->selectAndLoadSymbols(); 119 - 120 - $checks = array(); 121 - foreach ($symbols as $symbol) { 122 - $checks[] = newv($symbol['name'], array()); 123 - } 124 - 125 - return msort($checks, 'getExecutionOrder'); 117 + ->setSortMethod('getExecutionOrder') 118 + ->execute(); 126 119 } 127 120 128 121 final public static function runAllChecks() {
+4 -30
src/applications/dashboard/paneltype/PhabricatorDashboardPanelType.php
··· 46 46 } 47 47 48 48 public static function getAllPanelTypes() { 49 - static $types; 50 - 51 - if ($types === null) { 52 - $objects = id(new PhutilSymbolLoader()) 53 - ->setAncestorClass(__CLASS__) 54 - ->loadObjects(); 55 - 56 - $map = array(); 57 - foreach ($objects as $object) { 58 - $key = $object->getPanelTypeKey(); 59 - if (!empty($map[$key])) { 60 - $this_class = get_class($object); 61 - $that_class = get_class($map[$key]); 62 - throw new Exception( 63 - pht( 64 - 'Two dashboard panels (of classes "%s" and "%s") have the '. 65 - 'same panel type key ("%s"). Each panel type must have a '. 66 - 'unique panel type key.', 67 - $this_class, 68 - $that_class, 69 - $key)); 70 - } 71 - 72 - $map[$key] = $object; 73 - } 74 - 75 - $types = $map; 76 - } 77 - 78 - return $types; 49 + return id(new PhutilClassMapQuery()) 50 + ->setAncestorClass(__CLASS__) 51 + ->setUniqueMethod('getPanelTypeKey') 52 + ->execute(); 79 53 } 80 54 81 55 }
+3 -15
src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
··· 372 372 373 373 374 374 public static function getAllBlueprintImplementations() { 375 - static $list = null; 376 - 377 - if ($list === null) { 378 - $blueprints = id(new PhutilSymbolLoader()) 379 - ->setType('class') 380 - ->setAncestorClass(__CLASS__) 381 - ->setConcreteOnly(true) 382 - ->selectAndLoadSymbols(); 383 - $list = ipull($blueprints, 'name', 'name'); 384 - foreach ($list as $class_name => $ignored) { 385 - $list[$class_name] = newv($class_name, array()); 386 - } 387 - } 388 - 389 - return $list; 375 + return id(new PhutilClassMapQuery()) 376 + ->setAncestorClass(__CLASS__) 377 + ->execute(); 390 378 } 391 379 392 380 public static function getAllBlueprintImplementationsForResource($type) {
+2 -10
src/applications/fact/engine/PhabricatorFactEngine.php
··· 3 3 abstract class PhabricatorFactEngine extends Phobject { 4 4 5 5 final public static function loadAllEngines() { 6 - $classes = id(new PhutilSymbolLoader()) 6 + return id(new PhutilClassMapQuery()) 7 7 ->setAncestorClass(__CLASS__) 8 - ->setConcreteOnly(true) 9 - ->selectAndLoadSymbols(); 10 - 11 - $objects = array(); 12 - foreach ($classes as $class) { 13 - $objects[] = newv($class['name'], array()); 14 - } 15 - 16 - return $objects; 8 + ->execute(); 17 9 } 18 10 19 11 public function getFactSpecs(array $fact_types) {
+5 -30
src/applications/files/engine/PhabricatorFileStorageEngine.php
··· 224 224 * @task load 225 225 */ 226 226 public static function loadAllEngines() { 227 - static $engines; 228 - 229 - if ($engines === null) { 230 - $objects = id(new PhutilSymbolLoader()) 231 - ->setAncestorClass(__CLASS__) 232 - ->loadObjects(); 233 - 234 - $map = array(); 235 - foreach ($objects as $engine) { 236 - $key = $engine->getEngineIdentifier(); 237 - if (empty($map[$key])) { 238 - $map[$key] = $engine; 239 - } else { 240 - throw new Exception( 241 - pht( 242 - 'Storage engines "%s" and "%s" have the same engine '. 243 - 'identifier "%s". Each storage engine must have a unique '. 244 - 'identifier.', 245 - get_class($engine), 246 - get_class($map[$key]), 247 - $key)); 248 - } 249 - } 250 - 251 - $map = msort($map, 'getEnginePriority'); 252 - 253 - $engines = $map; 254 - } 255 - 256 - return $engines; 227 + return id(new PhutilClassMapQuery()) 228 + ->setAncestorClass(__CLASS__) 229 + ->setUniqueMethod('getEngineIdentifier') 230 + ->setSortMethod('getEnginePriority') 231 + ->execute(); 257 232 } 258 233 259 234
+5 -27
src/applications/files/transform/PhabricatorFileTransform.php
··· 28 28 } 29 29 30 30 public static function getAllTransforms() { 31 - static $map; 32 - 33 - if ($map === null) { 34 - $xforms = id(new PhutilSymbolLoader()) 35 - ->setAncestorClass(__CLASS__) 36 - ->loadObjects(); 37 - 38 - $result = array(); 39 - foreach ($xforms as $xform_template) { 40 - foreach ($xform_template->generateTransforms() as $xform) { 41 - $key = $xform->getTransformKey(); 42 - if (isset($result[$key])) { 43 - throw new Exception( 44 - pht( 45 - 'Two %s objects define the same transform key ("%s"), but '. 46 - 'each transform must have a unique key.', 47 - __CLASS__, 48 - $key)); 49 - } 50 - $result[$key] = $xform; 51 - } 52 - } 53 - 54 - $map = $result; 55 - } 56 - 57 - return $map; 31 + return id(new PhutilClassMapQuery()) 32 + ->setAncestorClass(__CLASS__) 33 + ->setExpandMethod('generateTransforms') 34 + ->setUniqueMethod('getTransformKey') 35 + ->execute(); 58 36 } 59 37 60 38 public static function getTransformByKey($key) {
+4 -29
src/applications/harbormaster/autoplan/HarbormasterBuildAutoplan.php
··· 10 10 } 11 11 12 12 public static function getAllAutoplans() { 13 - static $plans; 14 - 15 - if ($plans === null) { 16 - $objects = id(new PhutilSymbolLoader()) 17 - ->setAncestorClass(__CLASS__) 18 - ->loadObjects(); 19 - 20 - $map = array(); 21 - foreach ($objects as $object) { 22 - $key = $object->getAutoplanPlanKey(); 23 - if (!empty($map[$key])) { 24 - $other = $map[$key]; 25 - throw new Exception( 26 - pht( 27 - 'Two build autoplans (of classes "%s" and "%s") define the same '. 28 - 'key ("%s"). Each autoplan must have a unique key.', 29 - get_class($other), 30 - get_class($object), 31 - $key)); 32 - } 33 - $map[$key] = $object; 34 - } 35 - 36 - ksort($map); 37 - 38 - $plans = $map; 39 - } 40 - 41 - return $plans; 13 + return id(new PhutilClassMapQuery()) 14 + ->setAncestorClass(__CLASS__) 15 + ->setUniqueMethod('getAutoplanPlanKey') 16 + ->execute(); 42 17 } 43 18 44 19 }
+2 -2
src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php
··· 8 8 private $settings; 9 9 10 10 public static function getImplementations() { 11 - return id(new PhutilSymbolLoader()) 11 + return id(new PhutilClassMapQuery()) 12 12 ->setAncestorClass(__CLASS__) 13 - ->loadObjects(); 13 + ->execute(); 14 14 } 15 15 16 16 public static function getImplementation($class) {
+5 -8
src/applications/herald/adapter/HeraldAdapter.php
··· 1023 1023 } 1024 1024 1025 1025 public static function getAllAdapters() { 1026 - static $adapters; 1027 - if (!$adapters) { 1028 - $adapters = id(new PhutilSymbolLoader()) 1029 - ->setAncestorClass(__CLASS__) 1030 - ->loadObjects(); 1031 - $adapters = msort($adapters, 'getAdapterSortKey'); 1032 - } 1033 - return $adapters; 1026 + return id(new PhutilClassMapQuery()) 1027 + ->setAncestorClass(__CLASS__) 1028 + ->setUniqueMethod('getAdapterContentType') 1029 + ->setSortMethod('getAdapterSortKey') 1030 + ->execute(); 1034 1031 } 1035 1032 1036 1033 public static function getAdapterForContentType($content_type) {
+3 -12
src/applications/maniphest/export/ManiphestExcelFormat.php
··· 3 3 abstract class ManiphestExcelFormat extends Phobject { 4 4 5 5 final public static function loadAllFormats() { 6 - $classes = id(new PhutilSymbolLoader()) 6 + return id(new PhutilClassMapQuery()) 7 7 ->setAncestorClass(__CLASS__) 8 - ->setConcreteOnly(true) 9 - ->selectAndLoadSymbols(); 10 - 11 - $objects = array(); 12 - foreach ($classes as $class) { 13 - $objects[$class['name']] = newv($class['name'], array()); 14 - } 15 - 16 - $objects = msort($objects, 'getOrder'); 17 - 18 - return $objects; 8 + ->setSortMethod('getOrder') 9 + ->execute(); 19 10 } 20 11 21 12 abstract public function getName();
+3 -20
src/applications/meta/panel/PhabricatorApplicationConfigurationPanel.php
··· 47 47 PhabricatorController $controller); 48 48 49 49 public static function loadAllPanels() { 50 - $objects = id(new PhutilSymbolLoader()) 50 + return id(new PhutilClassMapQuery()) 51 51 ->setAncestorClass(__CLASS__) 52 - ->loadObjects(); 53 - 54 - $panels = array(); 55 - foreach ($objects as $object) { 56 - $key = $object->getPanelKey(); 57 - if (empty($panels[$key])) { 58 - $panels[$key] = $object; 59 - } else { 60 - throw new Exception( 61 - pht( 62 - 'Application configuration panels "%s" and "%s" have the same '. 63 - 'panel key, "%s". Each panel must have a unique key.', 64 - get_class($object), 65 - get_class($panels[$key]), 66 - $key)); 67 - } 68 - } 69 - 70 - return $panels; 52 + ->setUniqueMethod('getPanelKey') 53 + ->execute(); 71 54 } 72 55 73 56 public static function loadAllPanelsForApplication(
+5 -15
src/applications/metamta/command/MetaMTAEmailTransactionCommand.php
··· 60 60 } 61 61 62 62 public static function getAllCommands() { 63 - static $commands; 64 - 65 - if ($commands === null) { 66 - $kinds = id(new PhutilSymbolLoader()) 67 - ->setAncestorClass(__CLASS__) 68 - ->loadObjects(); 69 - $commands = array(); 70 - foreach ($kinds as $kind) { 71 - foreach ($kind->getCommandObjects() as $command) { 72 - $commands[] = $command; 73 - } 74 - } 75 - } 76 - 77 - return $commands; 63 + return id(new PhutilClassMapQuery()) 64 + ->setAncestorClass(__CLASS__) 65 + ->setExpandMethod('getCommandObjects') 66 + ->setUniqueMethod('getCommand') 67 + ->execute(); 78 68 } 79 69 80 70 public static function getAllCommandsForObject(
+4 -25
src/applications/nuance/source/NuanceSourceDefinition.php
··· 58 58 } 59 59 60 60 public static function getAllDefinitions() { 61 - static $definitions; 62 - 63 - if ($definitions === null) { 64 - $definitions = array(); 65 - 66 - $objects = id(new PhutilSymbolLoader()) 67 - ->setAncestorClass(__CLASS__) 68 - ->loadObjects(); 69 - foreach ($objects as $definition) { 70 - $key = $definition->getSourceTypeConstant(); 71 - $name = $definition->getName(); 72 - if (isset($definitions[$key])) { 73 - $conflict = $definitions[$key]; 74 - throw new Exception( 75 - pht( 76 - 'Definition %s conflicts with definition %s. This is a '. 77 - 'programming error.', 78 - $conflict, 79 - $name)); 80 - } 81 - $definitions[$key] = $definition; 82 - } 83 - } 84 - 85 - return $definitions; 61 + return id(new PhutilClassMapQuery()) 62 + ->setAncestorClass(__CLASS__) 63 + ->setUniqueMethod('getSourceTypeConstant') 64 + ->execute(); 86 65 } 87 66 88 67 /**
+3 -3
src/applications/passphrase/credentialtype/PassphraseCredentialType.php
··· 16 16 } 17 17 18 18 public static function getAllTypes() { 19 - $types = id(new PhutilSymbolLoader()) 19 + return id(new PhutilClassMapQuery()) 20 20 ->setAncestorClass(__CLASS__) 21 - ->loadObjects(); 22 - return $types; 21 + ->setUniqueMethod('getCredentialType') 22 + ->execute(); 23 23 } 24 24 25 25 public static function getAllCreateableTypes() {
+4 -31
src/applications/phid/type/PhabricatorPHIDType.php
··· 159 159 * @return dict<string, PhabricatorPHIDType> Map of type constants to types. 160 160 */ 161 161 final public static function getAllTypes() { 162 - static $types; 163 - if ($types === null) { 164 - $objects = id(new PhutilSymbolLoader()) 165 - ->setAncestorClass(__CLASS__) 166 - ->loadObjects(); 167 - 168 - $map = array(); 169 - $original = array(); 170 - foreach ($objects as $object) { 171 - $type = $object->getTypeConstant(); 172 - if (isset($map[$type])) { 173 - $that_class = $original[$type]; 174 - $this_class = get_class($object); 175 - throw new Exception( 176 - pht( 177 - "Two %s classes (%s, %s) both handle PHID type '%s'. ". 178 - "A type may be handled by only one class.", 179 - __CLASS__, 180 - $that_class, 181 - $this_class, 182 - $type)); 183 - } 184 - 185 - $original[$type] = get_class($object); 186 - $map[$type] = $object; 187 - } 188 - 189 - $types = $map; 190 - } 191 - 192 - return $types; 162 + return id(new PhutilClassMapQuery()) 163 + ->setAncestorClass(__CLASS__) 164 + ->setUniqueMethod('getTypeConstant') 165 + ->execute(); 193 166 } 194 167 195 168
+2 -2
src/applications/phortune/provider/PhortunePaymentProvider.php
··· 117 117 118 118 119 119 public static function getAllProviders() { 120 - return id(new PhutilSymbolLoader()) 120 + return id(new PhutilClassMapQuery()) 121 121 ->setAncestorClass(__CLASS__) 122 - ->loadObjects(); 122 + ->execute(); 123 123 } 124 124 125 125 public function isEnabled() {
+4 -10
src/applications/policy/capability/PhabricatorPolicyCapability.php
··· 79 79 } 80 80 81 81 final public static function getCapabilityMap() { 82 - static $map; 83 - if ($map === null) { 84 - $capabilities = id(new PhutilSymbolLoader()) 85 - ->setAncestorClass(__CLASS__) 86 - ->loadObjects(); 87 - 88 - $map = mpull($capabilities, null, 'getCapabilityKey'); 89 - } 90 - 91 - return $map; 82 + return id(new PhutilClassMapQuery()) 83 + ->setAncestorClass(__CLASS__) 84 + ->setUniqueMethod('getCapabilityKey') 85 + ->execute(); 92 86 } 93 87 94 88 }
+2 -4
src/applications/search/engine/PhabricatorApplicationSearchEngine.php
··· 559 559 * @task construct 560 560 */ 561 561 public static function getAllEngines() { 562 - $engines = id(new PhutilSymbolLoader()) 562 + return id(new PhutilClassMapQuery()) 563 563 ->setAncestorClass(__CLASS__) 564 - ->loadObjects(); 565 - 566 - return $engines; 564 + ->execute(); 567 565 } 568 566 569 567
+5 -29
src/applications/search/engine/PhabricatorSearchEngine.php
··· 106 106 * @task load 107 107 */ 108 108 public static function loadAllEngines() { 109 - static $engines; 110 - 111 - if ($engines === null) { 112 - $objects = id(new PhutilSymbolLoader()) 113 - ->setAncestorClass(__CLASS__) 114 - ->loadObjects(); 115 - 116 - $map = array(); 117 - foreach ($objects as $engine) { 118 - $key = $engine->getEngineIdentifier(); 119 - if (empty($map[$key])) { 120 - $map[$key] = $engine; 121 - } else { 122 - throw new Exception( 123 - pht( 124 - 'Search engines "%s" and "%s" have the same engine identifier '. 125 - '"%s". Each storage engine must have a unique identifier.', 126 - get_class($engine), 127 - get_class($map[$key]), 128 - $key)); 129 - } 130 - } 131 - 132 - $map = msort($map, 'getEnginePriority'); 133 - 134 - $engines = $map; 135 - } 136 - 137 - return $engines; 109 + return id(new PhutilClassMapQuery()) 110 + ->setAncestorClass(__CLASS__) 111 + ->setUniqueMethod('getEngineIdentifier') 112 + ->setSortMethod('getEnginePriority') 113 + ->execute(); 138 114 } 139 115 140 116 /**
+7 -24
src/infrastructure/edges/type/PhabricatorEdgeType.php
··· 156 156 static $type_map; 157 157 158 158 if ($type_map === null) { 159 - $types = id(new PhutilSymbolLoader()) 159 + $types = id(new PhutilClassMapQuery()) 160 160 ->setAncestorClass(__CLASS__) 161 - ->loadObjects(); 162 - 163 - $map = array(); 164 - 165 - foreach ($types as $class => $type) { 166 - $const = $type->getEdgeConstant(); 167 - 168 - if (isset($map[$const])) { 169 - throw new Exception( 170 - pht( 171 - 'Two edge types ("%s", "%s") share the same edge constant '. 172 - '(%d). Each edge type must have a unique constant.', 173 - $class, 174 - get_class($map[$const]), 175 - $const)); 176 - } 177 - 178 - $map[$const] = $type; 179 - } 161 + ->setUniqueMethod('getEdgeConstant') 162 + ->execute(); 180 163 181 164 // Check that all the inverse edge definitions actually make sense. If 182 165 // edge type A says B is its inverse, B must exist and say that A is its 183 166 // inverse. 184 167 185 - foreach ($map as $const => $type) { 168 + foreach ($types as $const => $type) { 186 169 $inverse = $type->getInverseEdgeConstant(); 187 170 if ($inverse === null) { 188 171 continue; 189 172 } 190 173 191 - if (empty($map[$inverse])) { 174 + if (empty($types[$inverse])) { 192 175 throw new Exception( 193 176 pht( 194 177 'Edge type "%s" ("%d") defines an inverse type ("%d") which '. ··· 198 181 $inverse)); 199 182 } 200 183 201 - $inverse_inverse = $map[$inverse]->getInverseEdgeConstant(); 184 + $inverse_inverse = $types[$inverse]->getInverseEdgeConstant(); 202 185 if ($inverse_inverse !== $const) { 203 186 throw new Exception( 204 187 pht( ··· 212 195 } 213 196 } 214 197 215 - $type_map = $map; 198 + $type_map = $types; 216 199 } 217 200 218 201 return $type_map;
+4 -15
src/infrastructure/util/password/PhabricatorPasswordHasher.php
··· 212 212 * @task hashing 213 213 */ 214 214 public static function getAllHashers() { 215 - $objects = id(new PhutilSymbolLoader()) 215 + $objects = id(new PhutilClassMapQuery()) 216 216 ->setAncestorClass(__CLASS__) 217 - ->loadObjects(); 217 + ->setUniqueMethod('getHashName') 218 + ->execute(); 218 219 219 - $map = array(); 220 220 foreach ($objects as $object) { 221 221 $name = $object->getHashName(); 222 222 ··· 233 233 $maximum_length, 234 234 $potential_length)); 235 235 } 236 - 237 - if (isset($map[$name])) { 238 - throw new Exception( 239 - pht( 240 - 'Two hashers use the same hash name ("%s"), "%s" and "%s". Each '. 241 - 'hasher must have a unique name.', 242 - $name, 243 - get_class($object), 244 - get_class($map[$name]))); 245 - } 246 - $map[$name] = $object; 247 236 } 248 237 249 - return $map; 238 + return $objects; 250 239 } 251 240 252 241