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

Misc PhpDoc additions or improvements

Summary: Side effect of stuff I've been poking and trying to understand what it may do.

Test Plan: Check parameter and return types, e.g. via gettype() or get_class(). Run phpstan and get a few less complaints.

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

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

+104 -11
+3 -3
src/applications/base/PhabricatorApplication.php
··· 411 411 * To check if an application is installed //and// available to a particular 412 412 * viewer, user @{method:isClassInstalledForViewer}. 413 413 * 414 - * @param string $class Application class name. 414 + * @param class-string<PhabricatorApplication> $class Application class name. 415 415 * @return bool True if the class is installed. 416 416 * @task meta 417 417 */ ··· 427 427 * To check if an application is installed at all, use 428 428 * @{method:isClassInstalled}. 429 429 * 430 - * @param string $class Application class name. 430 + * @param class-string<PhabricatorApplication> $class Application class name. 431 431 * @param PhabricatorUser $viewer Viewing user. 432 432 * @return bool True if the class is installed for the viewer. 433 433 * @task meta ··· 477 477 * To check if an application is installed at all, use 478 478 * @{method:isClassInstalled}. 479 479 * 480 - * @param string $class Application class name. 480 + * @param class-string<PhabricatorApplication> $class Application class name. 481 481 * @param PhabricatorUser|null $viewer Viewing user. 482 482 * @return bool True if the class is installed or if the installed class is 483 483 * available to the viewer when a viewer is given.
+3
src/applications/calendar/worker/PhabricatorCalendarImportReloadWorker.php
··· 31 31 $import_engine->importEventsFromSource($author, $import, false); 32 32 } 33 33 34 + /** 35 + * @return PhabricatorCalendarImportQuery 36 + */ 34 37 private function loadImport() { 35 38 $viewer = PhabricatorUser::getOmnipotentUser(); 36 39
+17
src/applications/conduit/method/ConduitAPIMethod.php
··· 230 230 ->loadClass($method_name); 231 231 } 232 232 233 + /** 234 + * Whether to require a session key for calling the API method. 235 + * 236 + * @return bool Defaults to true 237 + */ 233 238 public function shouldRequireAuthentication() { 234 239 return true; 235 240 } 236 241 242 + /** 243 + * Whether to allow public access. Related to the `policy.allow-public` 244 + * global setting and policies set for the corresponding application. 245 + * 246 + * @return bool Defaults to false 247 + */ 237 248 public function shouldAllowPublic() { 238 249 return false; 239 250 } 240 251 252 + /** 253 + * Whether not to guard writes against CSRF. See @{class:AphrontWriteGuard}. 254 + * 255 + * @return bool Defaults to false 256 + */ 241 257 public function shouldAllowUnguardedWrites() { 242 258 return false; 243 259 } ··· 316 332 317 333 318 334 /** 335 + * @return AphrontCursorPagerView 319 336 * @task pager 320 337 */ 321 338 protected function newPager(ConduitAPIRequest $request) {
+8
src/applications/herald/field/HeraldField.php
··· 39 39 return null; 40 40 } 41 41 42 + /** 43 + * @return array Conditions available in the dropdown after the object 44 + * dropdown as one of the CONDITION_* constants defined in the 45 + * HeraldAdapter class, rendered as e.g. "contains" or "is any of" 46 + */ 42 47 public function getHeraldFieldConditions() { 43 48 $standard_type = $this->getHeraldFieldStandardType(); 44 49 switch ($standard_type) { ··· 157 162 $standard_type)); 158 163 } 159 164 165 + /** 166 + * @return bool 167 + */ 160 168 abstract public function supportsObject($object); 161 169 162 170 public function getFieldsForObject($object) {
+5
src/applications/herald/value/HeraldEmptyFieldValue.php
··· 1 1 <?php 2 2 3 + /** 4 + * Implements not allowing to set a value for comparison in a boolean Herald 5 + * rule condition (e.g. for "Assignee | does not exist") or in a boolean Herald 6 + * rule action (e.g. "Do nothing" or "Require secure mail"). 7 + */ 3 8 final class HeraldEmptyFieldValue 4 9 extends HeraldFieldValue { 5 10
+6
src/applications/herald/value/HeraldFieldValue.php
··· 1 1 <?php 2 2 3 + /** 4 + * Implements the value to use for comparison in a Herald rule condition 5 + * (e.g. the value which follows after "Assignee | is any of") and the value 6 + * to set for a Herald rule action (e.g. what follows after "Add projects" 7 + * or "Remove subscribers"). 8 + */ 3 9 abstract class HeraldFieldValue extends Phobject { 4 10 5 11 private $viewer;
+1 -1
src/applications/lipsum/generator/PhabricatorTestDataGenerator.php
··· 97 97 /** 98 98 * Get one random object by its PHP class name. 99 99 * 100 - * @param string $classname PHP class name. 100 + * @param class-string $classname PHP class name. 101 101 * @return PhabricatorLiskDAO Object of that class. 102 102 */ 103 103 public function loadOneRandom($classname) {
+4 -2
src/applications/phid/type/PhabricatorPHIDType.php
··· 215 215 /** 216 216 * Get all PHID types of an application. 217 217 * 218 - * @param string $application Class name of an application 219 - * @return array<string, PhabricatorPHIDType> Map of constants of application 218 + * @param class-string<PhabricatorApplication> $application Class name of an 219 + * application. 220 + * @return array<string, PhabricatorPHIDType> Map of constants of 221 + * application. 220 222 */ 221 223 public static function getAllTypesForApplication( 222 224 string $application) {
+3
src/applications/phrequent/storage/PhrequentTimeBlock.php
··· 19 19 return $slices->getDuration($now); 20 20 } 21 21 22 + /** 23 + * @return array<PhrequentTimeSlices> 24 + */ 22 25 public function getObjectTimeRanges() { 23 26 $ranges = array(); 24 27
+1 -1
src/applications/policy/storage/PhabricatorPolicy.php
··· 348 348 * policy. This is used to bulk load data (like project memberships) in order 349 349 * to apply policy filters efficiently. 350 350 * 351 - * @param string $rule_class Policy rule classname. 351 + * @param class-string $rule_class Policy rule classname. 352 352 * @return list<wild> List of values used in this policy. 353 353 */ 354 354 public function getCustomRuleValues($rule_class) {
+6
src/applications/project/controller/PhabricatorProjectBoardController.php
··· 5 5 6 6 private $viewState; 7 7 8 + /** 9 + * @return PhabricatorWorkboardViewState 10 + */ 8 11 final protected function getViewState() { 9 12 if ($this->viewState === null) { 10 13 $this->viewState = $this->newViewState(); ··· 22 25 ->readFromRequest($request); 23 26 } 24 27 28 + /** 29 + * @return AphrontDialogView 30 + */ 25 31 final protected function newWorkboardDialog() { 26 32 $dialog = $this->newDialog(); 27 33
+9
src/applications/project/controller/PhabricatorProjectBoardViewController.php
··· 7 7 return true; 8 8 } 9 9 10 + /** 11 + * @return AphrontResponse|PhabricatorStandardPageView 12 + */ 10 13 public function handleRequest(AphrontRequest $request) { 11 14 $viewer = $request->getUser(); 12 15 ··· 400 403 return $page; 401 404 } 402 405 406 + /** 407 + * @return PHUIListItemView 408 + */ 403 409 private function buildSortMenu( 404 410 PhabricatorUser $viewer, 405 411 PhabricatorProject $project, ··· 473 479 return $sort_button; 474 480 } 475 481 482 + /** 483 + * @return PHUIListItemView 484 + */ 476 485 private function buildFilterMenu( 477 486 PhabricatorUser $viewer, 478 487 PhabricatorProject $project,
+1 -1
src/applications/search/engine/PhabricatorApplicationSearchEngine.php
··· 1036 1036 } 1037 1037 1038 1038 /** 1039 - * @return int 1039 + * @return int|float Number of results to display (float if set to infinity) 1040 1040 */ 1041 1041 public function getPageSize(PhabricatorSavedQuery $saved) { 1042 1042 $bucket = $this->getResultBucket($saved);
+11
src/applications/search/engineextension/PhabricatorSearchEngineExtension.php
··· 72 72 return array(); 73 73 } 74 74 75 + /** 76 + * Add additional parameters to the $query based on elements in the $map 77 + * @param $object A subclass of PhabricatorLiskDAO - a storage object, e.g. 78 + * ManiphestTask or PhabricatorDashboardPortal 79 + * @param $query A corresponding subclass of 80 + * PhabricatorCursorPagedPolicyAwareQuery, e.g. ManiphestTaskQuery or 81 + * PhabricatorDashboardPortalQuery 82 + * @param PhabricatorSavedQuery $saved 83 + * @param array $map 84 + * @return void 85 + */ 75 86 public function applyConstraintsToQuery( 76 87 $object, 77 88 $query,
+2 -2
src/applications/search/ferret/PhabricatorFerretEngine.php
··· 15 15 */ 16 16 abstract public function getScopeName(); 17 17 /** 18 - * @return string New instance of the corresponding 19 - * PhabricatorApplicationSearchEngine subclass 18 + * @return PhabricatorApplicationSearchEngine New instance of the 19 + * corresponding PhabricatorApplicationSearchEngine subclass 20 20 */ 21 21 abstract public function newSearchEngine(); 22 22
+7
src/applications/transactions/editengine/PhabricatorEditEngine.php
··· 102 102 return $keys; 103 103 } 104 104 105 + /** 106 + * Split the Full Key into its Edit Engine Key and its Form Key 107 + * 108 + * @param string $full_key 'Edit Engine Key/Form Key' string, e.g. 109 + * 'macro.image/default' or 'maniphest.task/5' 110 + * @return array<string,string> Edit Engine Key and Form Key 111 + */ 105 112 public static function splitFullKey($full_key) { 106 113 return explode('/', $full_key, 2); 107 114 }
+2 -1
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 103 103 * 104 104 * Uninstalling the application will disable the editor. 105 105 * 106 - * @return string Editor's application class name. 106 + * @return class-string<PhabricatorApplication> Editor's application 107 + * class name. 107 108 */ 108 109 abstract public function getEditorApplicationClass(); 109 110
+15
src/infrastructure/daemon/workers/PhabricatorWorker.php
··· 89 89 return $this; 90 90 } 91 91 92 + /** 93 + * @return PhabricatorWorkerTask 94 + */ 92 95 public function getCurrentWorkerTask() { 93 96 return $this->currentWorkerTask; 94 97 } ··· 101 104 return $task->getID(); 102 105 } 103 106 107 + /** 108 + * Perform some preparations and set up context, then call the final 109 + * functionality (e.g. publishFeedStory() or importEvents() or whatever 110 + * work the PhabricatorWorker subclass is supposed to do). 111 + * 112 + * @return void 113 + */ 104 114 abstract protected function doWork(); 105 115 106 116 final public function __construct($data) { ··· 120 130 return idx($data, $key, $default); 121 131 } 122 132 133 + /** 134 + * Public wrapper function which calls the doWork() function 135 + * 136 + * @return void 137 + */ 123 138 final public function executeTask() { 124 139 $this->doWork(); 125 140 }