@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

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, read code.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

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

+172 -2
+27 -2
src/applications/auth/controller/PhabricatorAuthController.php
··· 2 2 3 3 abstract class PhabricatorAuthController extends PhabricatorController { 4 4 5 + /** 6 + * @return PhabricatorStandardPageView PhabricatorStandardPageView with a 7 + * @{class:PHUIInfoView} child displaying error messages. 8 + */ 5 9 protected function renderErrorPage($title, array $messages) { 6 10 $view = new PHUIInfoView(); 7 11 $view->setTitle($title); ··· 14 18 } 15 19 16 20 /** 17 - * Returns true if this install is newly setup (i.e., there are no user 21 + * Returns true if this install is newly set up (i.e., there are no user 18 22 * accounts yet). In this case, we enter a special mode to permit creation 19 23 * of the first account form the web UI. 24 + * 25 + * @return bool 20 26 */ 21 27 protected function isFirstTimeSetup() { 22 28 // If there are any auth providers, this isn't first time setup, even if ··· 94 100 $request->clearCookie(PhabricatorCookies::COOKIE_INVITE); 95 101 } 96 102 103 + /** 104 + * @return AphrontRedirectResponse Redirect to /auth/validate/, including 105 + * an "expect" parameter with the expected username, to be validated in 106 + * @{class:PhabricatorAuthValidateController} 107 + */ 97 108 private function buildLoginValidateResponse(PhabricatorUser $user) { 98 109 $validate_uri = new PhutilURI($this->getApplicationURI('validate/')); 99 110 $validate_uri->replaceQueryParam('expect', $user->getUsername()); ··· 109 120 )); 110 121 } 111 122 123 + /** 124 + * @return array Returns <null,null,PhabricatorStandardPageView> or 125 + * <PhabricatorExternalAccount,null,PhabricatorStandardPageView> in case of 126 + * an error, or <PhabricatorExternalAccount,PhabricatorAuthProvider,null> 127 + * in case of success. 128 + */ 112 129 protected function loadAccountForRegistrationOrLinking($account_key) { 113 130 $request = $this->getRequest(); 114 131 $viewer = $request->getUser(); ··· 214 231 return array($account, $provider, null); 215 232 } 216 233 234 + /** 235 + * @return PhabricatorAuthInvite|null Invitation, or null if none exists 236 + */ 217 237 protected function loadInvite() { 218 238 $invite_cookie = PhabricatorCookies::COOKIE_INVITE; 219 239 $invite_code = $this->getRequest()->getCookie($invite_cookie); ··· 235 255 } 236 256 } 237 257 258 + /** 259 + * @return PHUIBoxView|null 260 + */ 238 261 protected function renderInviteHeader(PhabricatorAuthInvite $invite) { 239 262 $viewer = $this->getViewer(); 240 263 ··· 275 298 ->appendChild($invite_list); 276 299 } 277 300 278 - 301 + /** 302 + * @return PhutilSafeHTML|null 303 + */ 279 304 final protected function newCustomStartMessage() { 280 305 $viewer = $this->getViewer(); 281 306
+3
src/applications/auth/engine/PhabricatorAuthInviteEngine.php
··· 32 32 return $this->userHasConfirmedVerify; 33 33 } 34 34 35 + /** 36 + * @return PhabricatorAuthInvite 37 + */ 35 38 public function processInviteCode($code) { 36 39 $viewer = $this->getViewer(); 37 40
+9
src/applications/base/controller/PhabricatorController.php
··· 423 423 ->setSubmitURI($submit_uri); 424 424 } 425 425 426 + /** 427 + * @return AphrontRedirectResponse 428 + */ 426 429 public function newRedirect() { 427 430 return id(new AphrontRedirectResponse()); 428 431 } 429 432 433 + /** 434 + * @return PhabricatorStandardPageView 435 + */ 430 436 public function newPage() { 431 437 $page = id(new PhabricatorStandardPageView()) 432 438 ->setRequest($this->getRequest()) ··· 449 455 return $page; 450 456 } 451 457 458 + /** 459 + * @return PHUIApplicationMenuView 460 + */ 452 461 public function newApplicationMenu() { 453 462 return id(new PHUIApplicationMenuView()) 454 463 ->setViewer($this->getViewer());
+9
src/applications/conduit/data/ConduitConstantDescription.php
··· 6 6 private $value; 7 7 private $isDeprecated; 8 8 9 + /** 10 + * @param string $key Key of the constant 11 + */ 9 12 public function setKey($key) { 10 13 $this->key = $key; 11 14 return $this; ··· 15 18 return $this->key; 16 19 } 17 20 21 + /** 22 + * @param string $value Description of the constant 23 + */ 18 24 public function setValue($value) { 19 25 $this->value = $value; 20 26 return $this; ··· 24 30 return $this->value; 25 31 } 26 32 33 + /** 34 + * @param bool $is_deprecated Whether the constant is deprecated 35 + */ 27 36 public function setIsDeprecated($is_deprecated) { 28 37 $this->isDeprecated = $is_deprecated; 29 38 return $this;
+8
src/applications/conduit/method/ConduitAPIMethod.php
··· 49 49 return array(); 50 50 } 51 51 52 + /** 53 + * @return ConduitAPIDocumentationPage 54 + */ 52 55 final protected function newDocumentationPage(PhabricatorUser $viewer) { 53 56 return id(new ConduitAPIDocumentationPage()) 54 57 ->setIconIcon('fa-chevron-right'); 55 58 } 56 59 60 + /** 61 + * @return ConduitAPIDocumentationPage 62 + */ 57 63 final protected function newDocumentationBoxPage( 58 64 PhabricatorUser $viewer, 59 65 $title, ··· 183 189 /** 184 190 * Return a key which sorts methods by application name, then method status, 185 191 * then method name. 192 + * 193 + * @return string For example 'almanac.0.namespace.edit' or 'user.2.enable' 186 194 */ 187 195 public function getSortOrder() { 188 196 $name = $this->getAPIMethodName();
+6
src/applications/config/option/PhabricatorConfigOption.php
··· 85 85 return $this; 86 86 } 87 87 88 + /** 89 + * @return array Pairs of a config value and its description 90 + */ 88 91 public function getExamples() { 89 92 return $this->examples; 90 93 } ··· 103 106 return $this; 104 107 } 105 108 109 + /** 110 + * @return array Array of boolean options, defaults to True and False 111 + */ 106 112 public function getBoolOptions() { 107 113 if ($this->boolOptions) { 108 114 return $this->boolOptions;
+6
src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php
··· 116 116 return $this->panelPHID; 117 117 } 118 118 119 + /** 120 + * @return PHUIObjectBoxView 121 + */ 119 122 public function renderPanel() { 120 123 $panel = $this->getPanel(); 121 124 ··· 240 243 $header); 241 244 } 242 245 246 + /** 247 + * @return PHUIObjectBoxView 248 + */ 243 249 private function renderPanelDiv( 244 250 $content, 245 251 $header = null,
+5
src/applications/home/engine/PhabricatorHomeProfileMenuEngine.php
··· 29 29 ); 30 30 } 31 31 32 + /** 33 + * Returns the menu items in the default home sidebar 34 + * 35 + * @return array<PhabricatorProfileMenuItemConfiguration> 36 + */ 32 37 protected function getBuiltinProfileItems($object) { 33 38 $viewer = $this->getViewer(); 34 39 $items = array();
+9
src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php
··· 33 33 return $this->getDefaultName(); 34 34 } 35 35 36 + /** 37 + * @return PHUIHomeView 38 + */ 36 39 public function newPageContent( 37 40 PhabricatorProfileMenuItemConfiguration $config) { 38 41 $viewer = $this->getViewer(); ··· 41 44 ->setViewer($viewer); 42 45 } 43 46 47 + /** 48 + * @return array<PhabricatorTextEditField> 49 + */ 44 50 public function buildEditEngineFields( 45 51 PhabricatorProfileMenuItemConfiguration $config) { 46 52 return array( ··· 52 58 ); 53 59 } 54 60 61 + /** 62 + * @return array<PhabricatorProfileMenuItemView> 63 + */ 55 64 protected function newMenuItemViewList( 56 65 PhabricatorProfileMenuItemConfiguration $config) { 57 66 $viewer = $this->getViewer();
+25
src/applications/home/view/PHUIHomeView.php
··· 11 11 return array(); 12 12 } 13 13 14 + /** 15 + * Construct the default homepage dashboard. 16 + * 17 + * @return PHUIBoxView Homepage dashboard content: a PHUIBoxView which wraps 18 + * a @{class:AphrontMultiColumnView} which includes numerous 19 + * @{class:PHUIObjectBoxView} boxes 20 + */ 14 21 protected function getTagContent() { 15 22 require_celerity_resource('phabricator-dashboard-css'); 16 23 $viewer = $this->getViewer(); ··· 77 84 return $view; 78 85 } 79 86 87 + /** 88 + * @return PHUIObjectBoxView 89 + */ 80 90 private function buildRevisionPanel() { 81 91 $viewer = $this->getViewer(); 82 92 if (!$viewer->isLoggedIn()) { ··· 91 101 return $this->renderPanel($panel); 92 102 } 93 103 104 + /** 105 + * @return PHUIObjectBoxView 106 + */ 94 107 private function buildTasksPanel() { 95 108 $viewer = $this->getViewer(); 96 109 ··· 111 124 return $this->renderPanel($panel); 112 125 } 113 126 127 + /** 128 + * @return PHUIObjectBoxView 129 + */ 114 130 public function buildFeedPanel() { 115 131 $panel = $this->newQueryPanel() 116 132 ->setName(pht('Recent Activity')) ··· 121 137 return $this->renderPanel($panel); 122 138 } 123 139 140 + /** 141 + * @return PHUIObjectBoxView 142 + */ 124 143 public function buildRepositoryPanel() { 125 144 $panel = $this->newQueryPanel() 126 145 ->setName(pht('Active Repositories')) ··· 131 150 return $this->renderPanel($panel); 132 151 } 133 152 153 + /** 154 + * @return PhabricatorDashboardPanel 155 + */ 134 156 private function newQueryPanel() { 135 157 $panel_type = id(new PhabricatorDashboardQueryPanelType()) 136 158 ->getPanelTypeKey(); ··· 139 161 ->setPanelType($panel_type); 140 162 } 141 163 164 + /** 165 + * @return PHUIObjectBoxView 166 + */ 142 167 private function renderPanel(PhabricatorDashboardPanel $panel) { 143 168 $viewer = $this->getViewer(); 144 169
+19
src/applications/search/controller/PhabricatorApplicationSearchController.php
··· 774 774 return $menu; 775 775 } 776 776 777 + /** 778 + * @return AphrontSideNavFilterView 779 + */ 777 780 private function buildNavigation() { 778 781 $viewer = $this->getViewer(); 779 782 $engine = $this->getSearchEngine(); ··· 787 790 return $nav; 788 791 } 789 792 793 + /** 794 + * Render a content body (if available) to onboard new users. This may return 795 + * what the corresponding PhabricatorApplicationSearchEngine returns, or null 796 + * based on some additional checks performed in this function. 797 + * 798 + * @return mixed|PhutilSafeHTML|null 799 + */ 790 800 private function renderNewUserView( 791 801 PhabricatorApplicationSearchEngine $engine, 792 802 $force_nux) { ··· 830 840 return $nux_view; 831 841 } 832 842 843 + /** 844 + * @return PHUIButtonView 845 + */ 833 846 private function newUseResultsDropdown( 834 847 PhabricatorSavedQuery $query, 835 848 array $dropdown_items) { ··· 889 902 return $message; 890 903 } 891 904 905 + /** 906 + * @return PHUIInfoView 907 + */ 892 908 private function newOverheatedView(array $results) { 893 909 $message = self::newOverheatedError((bool)$results); 894 910 ··· 902 918 )); 903 919 } 904 920 921 + /** 922 + * @return PhabricatorActionView 923 + */ 905 924 private function newBuiltinUseActions() { 906 925 $actions = array(); 907 926 $request = $this->getRequest();
+6
src/applications/search/editor/PhabricatorProfileMenuEditEngine.php
··· 20 20 return $this; 21 21 } 22 22 23 + /** 24 + * @return PhabricatorProfileMenuEngine 25 + */ 23 26 public function getMenuEngine() { 24 27 return $this->menuEngine; 25 28 } ··· 48 51 return $this; 49 52 } 50 53 54 + /** 55 + * @return PhabricatorProfileMenuItemConfiguration 56 + */ 51 57 public function getNewMenuItemConfiguration() { 52 58 return $this->newMenuItemConfiguration; 53 59 }
+10
src/applications/search/engine/PhabricatorApplicationSearchEngine.php
··· 91 91 return $this->viewer; 92 92 } 93 93 94 + /** 95 + * Set rendering context (e.g. list or panel) 96 + * 97 + * @param $context string A CONTEXT_* constant 98 + */ 94 99 public function setContext($context) { 95 100 $this->context = $context; 96 101 return $this; 97 102 } 98 103 104 + /** 105 + * Whether this is in the context of rendering a panel 106 + * 107 + * @return bool True if in panel context 108 + */ 99 109 public function isPanelContext() { 100 110 return ($this->context == self::CONTEXT_PANEL); 101 111 }
+15
src/applications/search/engine/PhabricatorProfileMenuEngine.php
··· 28 28 return $this->viewer; 29 29 } 30 30 31 + /** 32 + * @param object $profile_object A PhabricatorApplication subclass 33 + */ 31 34 public function setProfileObject($profile_object) { 32 35 $this->profileObject = $profile_object; 33 36 return $this; 34 37 } 35 38 39 + /** 40 + * @return object A PhabricatorApplication subclass 41 + */ 36 42 public function getProfileObject() { 37 43 return $this->profileObject; 38 44 } 39 45 46 + /** 47 + * @param $custom_phid A User PHID 48 + */ 40 49 public function setCustomPHID($custom_phid) { 41 50 $this->customPHID = $custom_phid; 42 51 return $this; 43 52 } 44 53 54 + /** 55 + * @return string|null A User PHID, or null 56 + */ 45 57 public function getCustomPHID() { 46 58 return $this->customPHID; 47 59 } 48 60 61 + /** 62 + * @return string|null A User PHID, or null 63 + */ 49 64 private function getEditModeCustomPHID() { 50 65 $mode = $this->getEditMode(); 51 66
+3
src/applications/search/field/PhabricatorSearchField.php
··· 382 382 return $this->enableForConduit; 383 383 } 384 384 385 + /** 386 + * @return array<ConduitConstantDescription|null> 387 + */ 385 388 public function newConduitConstants() { 386 389 return array(); 387 390 }
+3
src/applications/search/menuitem/PhabricatorProfileMenuItem.php
··· 66 66 ->execute(); 67 67 } 68 68 69 + /** 70 + * @return PhabricatorProfileMenuItemView 71 + */ 69 72 final protected function newItemView() { 70 73 return new PhabricatorProfileMenuItemView(); 71 74 }
+6
src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php
··· 198 198 return ($this->getVisibility() === self::VISIBILITY_DEFAULT); 199 199 } 200 200 201 + /** 202 + * @return int|string 203 + */ 201 204 public function getItemIdentifier() { 202 205 $id = $this->getID(); 203 206 ··· 208 211 return $this->getBuiltinKey(); 209 212 } 210 213 214 + /** 215 + * @return string 216 + */ 211 217 public function getDefaultMenuItemKey() { 212 218 if ($this->getBuiltinKey()) { 213 219 return $this->getBuiltinKey();
+3
src/infrastructure/env/PhabricatorConfigDatabaseSource.php
··· 1 1 <?php 2 2 3 + /** 4 + * Configuration source which reads from the database. 5 + */ 3 6 final class PhabricatorConfigDatabaseSource 4 7 extends PhabricatorConfigProxySource { 5 8