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

PhpDoc: Replace non-standard dict type with array

Summary:
Make static code analysis more correct (which does not also mean less noisy) by replacing "dict" and "dictionary" types in PhpDoc with what they actually are: an array.
The "dictionary" type is not mentioned in `arcanist/src/parser/PhutilTypeSpec.php` either, thus no side effects.

See also related discussions in https://we.phorge.it/D26037 and https://we.phorge.it/D26039#27821

Test Plan: Grep and read the code, use static code analysis.

Reviewers: O1 Blessed Committers, valerio.bozzolan, amybones

Reviewed By: O1 Blessed Committers, valerio.bozzolan, amybones

Subscribers: amybones, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D26059

+67 -46
+5 -5
src/aphront/AphrontRequest.php
··· 714 714 * This is primarily useful if you want to ask the user for more input and 715 715 * then resubmit their request. 716 716 * 717 - * @return dict<string, string> Original request parameters. 717 + * @return array<string, string> Original request parameters. 718 718 */ 719 719 public function getPassthroughRequestParameters($include_quicksand = false) { 720 720 return self::flattenData( ··· 724 724 /** 725 725 * Get request data other than "magic" parameters. 726 726 * 727 - * @return dict<string, wild> Request data, with magic filtered out. 727 + * @return array<string, wild> Request data, with magic filtered out. 728 728 */ 729 729 public function getPassthroughRequestData($include_quicksand = false) { 730 730 $data = $this->getRequestData(); ··· 748 748 * into a list of key-value pairs suitable for submitting via HTTP request 749 749 * (with arrays flattened). 750 750 * 751 - * @param dict<string, wild> $data Data to flatten. 752 - * @return dict<string, string> Flat data suitable for inclusion in an HTTP 753 - * request. 751 + * @param array<string, wild> $data Data to flatten. 752 + * @return array<string, string> Flat data suitable for inclusion in an HTTP 753 + * request. 754 754 */ 755 755 public static function flattenData(array $data) { 756 756 $result = array();
+5 -4
src/aphront/configuration/AphrontApplicationConfiguration.php
··· 387 387 /** 388 388 * Build a controller to respond to the request. 389 389 * 390 - * @return pair<AphrontController,dict> Controller and dictionary of request 391 - * parameters. 390 + * @return pair<AphrontController,array> Controller and dictionary of request 391 + * parameters. 392 392 * @task routing 393 393 */ 394 394 private function buildController() { ··· 512 512 * 513 513 * @param list<AphrontRoutingMap> $maps List of routing maps. 514 514 * @param string $path Path to route. 515 - * @return pair<AphrontController,dict>|null Controller and dictionary of 516 - * request parameters, or null if no paths to route were found. 515 + * @return array<AphrontController,array<string,string>>|null Controller 516 + * subclass and dictionary of request parameters, or null if no paths to 517 + * route were found. 517 518 * @task routing 518 519 */ 519 520 private function routePath(array $maps, $path) {
+8 -1
src/aphront/site/AphrontRoutingMap.php
··· 21 21 return $this; 22 22 } 23 23 24 + /** 25 + * @return AphrontSite 26 + */ 24 27 public function getSite() { 25 28 return $this->site; 26 29 } ··· 30 33 return $this; 31 34 } 32 35 36 + /** 37 + * @return PhabricatorApplication 38 + */ 33 39 public function getApplication() { 34 40 return $this->application; 35 41 } ··· 87 93 * @param string $route Pattern from the map. 88 94 * @param string $value Value from the map. 89 95 * @param string $path Path to route. 90 - * @return dict<string, wild>|null Match details, if path matches sub-map. 96 + * @return array<string, array<string>|string>|null Match details, if path 97 + * matches sub-map. 91 98 * @task routing 92 99 */ 93 100 private function tryRoute($route, $value, $path) {
+12
src/aphront/site/AphrontRoutingResult.php
··· 21 21 return $this; 22 22 } 23 23 24 + /** 25 + * @return AphrontSite 26 + */ 24 27 public function getSite() { 25 28 return $this->site; 26 29 } ··· 30 33 return $this; 31 34 } 32 35 36 + /** 37 + * @return PhabricatorApplication 38 + */ 33 39 public function getApplication() { 34 40 return $this->application; 35 41 } ··· 39 45 return $this; 40 46 } 41 47 48 + /** 49 + * @return AphrontController 50 + */ 42 51 public function getController() { 43 52 return $this->controller; 44 53 } ··· 48 57 return $this; 49 58 } 50 59 60 + /** 61 + * @return array<string,string> 62 + */ 51 63 public function getURIData() { 52 64 return $this->uriData; 53 65 }
+1 -1
src/applications/conduit/controller/PhabricatorConduitAPIController.php
··· 160 160 * Authenticate the client making the request to a Phabricator user account. 161 161 * 162 162 * @param ConduitAPIRequest $api_request Request being executed. 163 - * @param dict $metadata Request metadata. 163 + * @param array $metadata Dictionary of request metadata. 164 164 * @param wild $method 165 165 * @return null|pair Null to indicate successful authentication, or 166 166 * an error code and error message pair.
+2 -1
src/applications/differential/parser/DifferentialHunkParser.php
··· 14 14 * datastructure is used to determine when to render "Context not available." 15 15 * in diffs with multiple hunks. 16 16 * 17 - * @return dict<int, bool> Map of lines where hunks start, other than line 1. 17 + * @return array<int|string, bool> Map of lines where hunks start, other than 18 + * line 1. 18 19 */ 19 20 public function getHunkStartLines(array $hunks) { 20 21 assert_instances_of($hunks, 'DifferentialHunk');
+2 -2
src/applications/feed/story/PhabricatorFeedStory.php
··· 32 32 * construct appropriate @{class:PhabricatorFeedStory} wrappers for each 33 33 * data row. 34 34 * 35 - * @param list<dict> $rows List of @{class:PhabricatorFeedStoryData} rows 36 - * from the database. 35 + * @param array<int,array<string,string>> $rows List of 36 + * @{class:PhabricatorFeedStoryData} rows from the database. 37 37 * @param PhabricatorUser $viewer 38 38 * @return list<PhabricatorFeedStory> List of @{class:PhabricatorFeedStory} 39 39 * objects.
+2 -2
src/applications/files/query/PhabricatorFileQuery.php
··· 96 96 * `PHID-FILE-aaaa` and all transformations of the file with PHID 97 97 * `PHID-FILE-bbbb`. 98 98 * 99 - * @param list<dict> $specs List of transform specifications, described 100 - * above. 99 + * @param array<int, array<string, mixed>> $specs List of transform 100 + * specifications, described above. 101 101 * @return $this 102 102 */ 103 103 public function withTransforms(array $specs) {
+1 -1
src/applications/files/storage/PhabricatorFile.php
··· 1215 1215 * @param PhabricatorUser $user Viewing user. 1216 1216 * @param list<PhabricatorFilesBuiltinFile> $builtins List of builtin file 1217 1217 * specs. 1218 - * @return dict<string, PhabricatorFile> Dictionary of named builtins. 1218 + * @return array<string, PhabricatorFile> Dictionary of named builtins. 1219 1219 */ 1220 1220 public static function loadBuiltins(PhabricatorUser $user, array $builtins) { 1221 1221 $builtins = mpull($builtins, null, 'getBuiltinFileKey');
+1 -1
src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php
··· 191 191 * @{function:vcsprintf}. 192 192 * @param string $pattern User-provided pattern string containing 193 193 * `${variables}`. 194 - * @param dict $variables List of available replacement variables. 194 + * @param array $variables List of available replacement variables. 195 195 * @return string String with variables replaced safely into it. 196 196 */ 197 197 protected function mergeVariables($function, $pattern, array $variables) {
+2 -2
src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php
··· 26 26 * ), 27 27 * ) 28 28 * 29 - * @param string $body Raw mail text body. 30 - * @return dict Parsed body. 29 + * @param string $body Raw mail text body. 30 + * @return array<string, array|string> Parsed body. 31 31 */ 32 32 public function parseBody($body) { 33 33 $body = $this->stripTextBody($body);
+3 -3
src/applications/phid/type/PhabricatorPHIDType.php
··· 147 147 * To get PHID types a given user has access to, see 148 148 * @{method:getAllInstalledTypes}. 149 149 * 150 - * @return dict<string, PhabricatorPHIDType> Map of type constants to types. 150 + * @return array<string, PhabricatorPHIDType> Map of type constants to types. 151 151 */ 152 152 final public static function getAllTypes() { 153 153 return self::newClassMapQuery() ··· 172 172 * Get all PHID types of applications installed for a given viewer. 173 173 * 174 174 * @param PhabricatorUser $viewer Viewing user. 175 - * @return dict<string, PhabricatorPHIDType> Map of constants to installed 175 + * @return array<string, PhabricatorPHIDType> Map of constants to installed 176 176 * types. 177 177 */ 178 178 public static function getAllInstalledTypes(PhabricatorUser $viewer) { ··· 216 216 * Get all PHID types of an application. 217 217 * 218 218 * @param string $application Class name of an application 219 - * @return dict<string, PhabricatorPHIDType> Map of constants of application 219 + * @return array<string, PhabricatorPHIDType> Map of constants of application 220 220 */ 221 221 public static function getAllTypesForApplication( 222 222 string $application) {
+5 -5
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 4548 4548 * 4549 4549 * This data will be loaded with @{method:loadWorkerState} in the worker. 4550 4550 * 4551 - * @return dict<string, wild> Serializable editor state. 4551 + * @return array<string, wild> Serializable editor state. 4552 4552 * @task workers 4553 4553 */ 4554 4554 private function getWorkerState() { ··· 4573 4573 /** 4574 4574 * Hook; return custom properties which need to be passed to workers. 4575 4575 * 4576 - * @return dict<string, wild> Custom properties. 4576 + * @return array<string, wild> Custom properties. 4577 4577 * @task workers 4578 4578 */ 4579 4579 protected function getCustomWorkerState() { ··· 4588 4588 * This primarily allows binary data to be passed to workers and survive 4589 4589 * JSON encoding. 4590 4590 * 4591 - * @return dict<string, string> Property encodings. 4591 + * @return array<string, string> Property encodings. 4592 4592 * @task workers 4593 4593 */ 4594 4594 protected function getCustomWorkerStateEncoding() { ··· 4601 4601 * 4602 4602 * This method is used to load state when running worker operations. 4603 4603 * 4604 - * @param dict<string, wild> $state Editor state, from 4604 + * @param array<string, wild> $state Editor state, from 4605 4605 @{method:getWorkerState}. 4606 4606 * @return $this 4607 4607 * @task workers ··· 4628 4628 * Hook; set custom properties on the editor from data emitted by 4629 4629 * @{method:getCustomWorkerState}. 4630 4630 * 4631 - * @param dict<string, wild> $state Custom state, 4631 + * @param array<string, wild> $state Custom state, 4632 4632 * from @{method:getCustomWorkerState}. 4633 4633 * @return $this 4634 4634 * @task workers
+2 -2
src/infrastructure/cache/PhutilKeyValueCache.php
··· 77 77 * Get data from the cache. 78 78 * 79 79 * @param list<string> $keys List of cache keys to retrieve. 80 - * @return dict<string, wild> Dictionary of keys that were found in the 80 + * @return array<string, wild> Dictionary of keys that were found in the 81 81 * cache. Keys not present in the cache are 82 82 * omitted, so you can detect a cache miss. 83 83 * @task kvimpl ··· 92 92 * after a specified number of seconds. By default, there is no expiration 93 93 * policy and data will persist in cache indefinitely. 94 94 * 95 - * @param dict<string, wild> $keys Map of cache keys to values. 95 + * @param array<string, wild> $keys Map of cache keys to values. 96 96 * @param int|null $ttl (optional) TTL for cache keys, in seconds. 97 97 * @return $this 98 98 * @task kvimpl
+1 -1
src/infrastructure/cache/PhutilMemcacheKeyValueCache.php
··· 100 100 * ), 101 101 * )); 102 102 * 103 - * @param list<dict> $servers List of server specifications. 103 + * @param array $servers List of server specifications. 104 104 * @return $this 105 105 * @task memcache 106 106 */
+1 -1
src/infrastructure/daemon/PhutilDaemonHandle.php
··· 329 329 * Dispatch an event to event listeners. 330 330 * 331 331 * @param string $type Event type. 332 - * @param dict $params (optional) Event parameters. 332 + * @param array $params (optional) Event parameters. 333 333 * @return void 334 334 */ 335 335 private function dispatchEvent($type, array $params = array()) {
+4 -4
src/infrastructure/markup/markuprule/PhutilRemarkupRule.php
··· 60 60 * This method acts as @{function:phutil_tag}, but checks attributes before 61 61 * using them. 62 62 * 63 - * @param string $name Tag name. 64 - * @param dict<string, wild> $attrs Tag attributes. 65 - * @param wild $content (optional) Tag content. 66 - * @return PhutilSafeHTML Tag object. 63 + * @param string $name Tag name. 64 + * @param array<string, wild> $attrs Dictionary of tag attributes. 65 + * @param wild $content (optional) Tag content. 66 + * @return PhutilSafeHTML Tag object. 67 67 */ 68 68 protected function newTag($name, array $attrs, $content = null) { 69 69 foreach ($attrs as $key => $attr) {
+10 -10
src/infrastructure/storage/lisk/LiskDAO.php
··· 450 450 /** 451 451 * Loads all of the objects, unconditionally. 452 452 * 453 - * @return dict Dictionary of all persisted objects of this type, keyed 454 - * on object ID. 453 + * @return array<int,object> Dictionary of all persisted objects of this 454 + * type, keyed on object ID. 455 455 * 456 456 * @task load 457 457 */ ··· 470 470 * 471 471 * @param string $pattern queryfx()-style SQL WHERE clause. 472 472 * @param mixed $args,... Zero or more conversions. 473 - * @return dict Dictionary of matching objects, keyed on ID. 473 + * @return array<int,object> Dictionary of matching objects, keyed on ID. 474 474 * 475 475 * @task load 476 476 */ ··· 574 574 * convenient to pull data from elsewhere directly (e.g., a complicated 575 575 * join via @{method:queryData}) and then load from an array representation. 576 576 * 577 - * @param dict $row Dictionary of properties, which should be equivalent 578 - * to selecting a row from the table or calling 579 - * @{method:getProperties}. 577 + * @param array<string,string|null> $row Dictionary of properties, which 578 + * should be equivalent to selecting a row from the table or calling 579 + * @{method:getProperties}. 580 580 * @return $this 581 581 * 582 582 * @task load ··· 650 650 * This is a lot messier than @{method:loadAllWhere}, but more flexible. 651 651 * 652 652 * @param list $rows List of property dictionaries. 653 - * @return dict List of constructed objects, keyed on ID. 653 + * @return array<int,object> List of constructed objects, keyed on ID. 654 654 * 655 655 * @task load 656 656 */ ··· 739 739 * database. 740 740 * Properties that should not be persisted must be declared as private. 741 741 * 742 - * @return dict Dictionary of normalized (lowercase) to canonical (original 743 - * case) property names. 742 + * @return array<string,string> Dictionary of normalized (lowercase) to 743 + * canonical (original case) property names. 744 744 * 745 745 * @task info 746 746 */ ··· 874 874 * using legacy features with CONFIG_CONVERT_CAMELCASE, but in that case you 875 875 * should just go ahead and die in a fire). 876 876 * 877 - * @return dict Dictionary of object properties. 877 + * @return array<string,wild|null> Dictionary of object properties. 878 878 * 879 879 * @task info 880 880 */