@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: Fix @return string for methods which can also return null

Summary: Correct docs.

Test Plan: Read the method code, run static code analysis (PHPStan) which complains "should return string but returns null".

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/D25958

+25 -22
+2 -2
src/aphront/configuration/AphrontApplicationConfiguration.php
··· 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> Controller and dictionary of request 516 - * parameters. 515 + * @return pair<AphrontController,dict>|null Controller and dictionary of 516 + * request parameters, or null if no paths to route were found. 517 517 * @task routing 518 518 */ 519 519 private function routePath(array $maps, $path) {
+1 -1
src/aphront/httpparametertype/AphrontHTTPParameterType.php
··· 299 299 * 300 300 * See @{method:getDefaultValue}. If unspecified, the default is `null`. 301 301 * 302 - * @return wild Default value. 302 + * @return wild|null Default value (null if unspecified). 303 303 * @task impl 304 304 */ 305 305 protected function getParameterDefault() {
+3 -2
src/applications/auth/constants/PhabricatorCookies.php
··· 155 155 /** 156 156 * Parse a Next URI cookie into its components. 157 157 * 158 - * @param string $cookie Raw cookie value. 159 - * @return list<string> List of timestamp and URI. 158 + * @param string $cookie Raw cookie value. 159 + * @return list<int,string>|null List of timestamp and URI, or null if the 160 + * cookie is empty or null. 160 161 * 161 162 * @task next 162 163 */
+1 -1
src/applications/config/option/PhabricatorApplicationConfigOptions.php
··· 67 67 * 68 68 * @param PhabricatorConfigOption $option Option being rendered. 69 69 * @param AphrontRequest $request Active request. 70 - * @return wild Additional contextual description 70 + * @return wild|null Additional contextual description 71 71 * information. 72 72 */ 73 73 public function renderContextualDescription(
+5 -3
src/applications/diffusion/request/DiffusionRequest.php
··· 56 56 * - `commit` Optional, commit identifier. 57 57 * - `line` Optional, line range. 58 58 * 59 - * @param map $data See documentation. 60 - * @return DiffusionRequest New request object. 59 + * @param map $data See documentation. 60 + * @return DiffusionRequest|null New request object, or null if none is 61 + * found. 61 62 * @task new 62 63 */ 63 64 final public static function newFromDictionary(array $data) { ··· 136 137 * @param string $identifier Repository identifier. 137 138 * @param PhabricatorUser $viewer Viewing user. 138 139 * @param bool $need_edit (optional) 139 - * @return DiffusionRequest New request object. 140 + * @return DiffusionRequest New request object, or null if no repository is 141 + * found. 140 142 * @task new 141 143 */ 142 144 private static function newFromIdentifier(
+1 -1
src/applications/metamta/command/MetaMTAEmailTransactionCommand.php
··· 34 34 * 35 35 * This can be as long as necessary to explain the command. 36 36 * 37 - * @return string Human-readable remarkup of whatever length is desired. 37 + * @return string|null Human-readable remarkup of whatever length is desired. 38 38 * @task docs 39 39 */ 40 40 public function getCommandDescription() {
+2 -2
src/applications/phame/storage/PhameBlog.php
··· 111 111 * Makes sure a given custom blog uri is properly configured in DNS 112 112 * to point at this Phabricator instance. If there is an error in 113 113 * the configuration, return a string describing the error and how 114 - * to fix it. If there is no error, return an empty string. 114 + * to fix it. If there is no error, return null. 115 115 * 116 - * @return string 116 + * @return string|null 117 117 */ 118 118 public function validateCustomDomain($domain_full_uri) { 119 119 $example_domain = 'http://blog.example.com/';
+2 -2
src/applications/policy/capability/PhabricatorPolicyCapability.php
··· 36 36 * - You do not have permission to edit this object. 37 37 * - You do not have permission to create new tasks. 38 38 * 39 - * @return string Human-readable name describing what failing a check for this 40 - * capability prevents the user from doing. 39 + * @return string|null Human-readable name describing what failing a check 40 + * for this capability prevents the user from doing. 41 41 */ 42 42 public function describeCapabilityRejection() { 43 43 return null;
+1 -1
src/applications/transactions/editfield/PhabricatorEditField.php
··· 575 575 * 576 576 * @param AphrontRequest $request Request to read from. 577 577 * @param string $key Key to read. 578 - * @return wild Value read from request. 578 + * @return wild|null Value read from request. 579 579 */ 580 580 protected function getInitialValueFromSubmit(AphrontRequest $request, $key) { 581 581 return null;
+3 -4
src/infrastructure/customfield/field/PhabricatorCustomField.php
··· 587 587 * If the field value is a scalar, it can be returned unmodified. If not, 588 588 * it should be serialized (for example, using JSON). 589 589 * 590 - * @return string Serialized field value. 590 + * @return string|null Serialized field value. 591 591 * @task storage 592 592 */ 593 593 public function getValueForStorage() { ··· 686 686 * 687 687 * The value of the index is not used. 688 688 * 689 - * Return null from this method if the field can not be ordered. 690 - * 691 - * @return PhabricatorCustomFieldIndexStorage A single index to order by. 689 + * @return PhabricatorCustomFieldIndexStorage|null A single index to order 690 + * by, or null if this field cannot be ordered. 692 691 * @task appsearch 693 692 */ 694 693 public function buildOrderIndex() {
+1 -1
src/infrastructure/edges/query/PhabricatorEdgeQuery.php
··· 142 142 * @param string $src_phid Source PHID. 143 143 * @param string $edge_type Edge type constant. 144 144 * @param string $dest_phid Destination PHID. 145 - * @return wild Edge annotation (or null). 145 + * @return wild|null Edge annotation, or null. 146 146 */ 147 147 public static function loadSingleEdgeData($src_phid, $edge_type, $dest_phid) { 148 148 $edges = id(new PhabricatorEdgeQuery())
+3 -2
src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
··· 433 433 * this is the case, return the alias for the primary table the query 434 434 * uses; generally the object table which has `id` and `phid` columns. 435 435 * 436 - * @return string Alias for the primary table. 436 + * @return string|null Alias for the primary table, or null. 437 437 */ 438 438 protected function getPrimaryTableAlias() { 439 439 return null; ··· 3140 3140 * @{method:withSpacePHIDs}. 3141 3141 * 3142 3142 * @param AphrontDatabaseConnection $conn Database connection. 3143 - * @return string Part of a WHERE clause. 3143 + * @return string|null Part of a WHERE clause, or null when there is no 3144 + * object or the object is not an instance of PhabricatorSpacesInterface. 3144 3145 * @task spaces 3145 3146 */ 3146 3147 private function buildSpacesWhereClause(AphrontDatabaseConnection $conn) {