@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

PHPDoc: Replace non-existing param type const with string

Summary:
`const` is not a valid type. See https://docs.phpdoc.org/guide/references/phpdoc/types.html and https://docs.phpdoc.org/guide/references/phpdoc/tags/return.html.
Thus set the param type to `string` and get a few less errors reported by PHPStan.

Test Plan: Read docs; run static code analysis.

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

+32 -30
+2 -2
src/applications/auth/engine/PhabricatorAuthSessionEngine.php
··· 109 109 * loading context. This prevents use of a Conduit sesssion as a Web 110 110 * session, for example. 111 111 * 112 - * @param const $session_type The type of session to load. 112 + * @param string $session_type Constant of the type of session to load. 113 113 * @param string $session_token The session token. 114 114 * @return PhabricatorUser|null 115 115 * @task use ··· 250 250 * You can configure the maximum number of concurrent sessions for various 251 251 * session types in the Phabricator configuration. 252 252 * 253 - * @param const $session_type Session type constant (see 253 + * @param string $session_type Session type constant (see 254 254 * @{class:PhabricatorAuthSession}). 255 255 * @param phid|null $identity_phid Identity to establish a session for, 256 256 * usually a user PHID. With `null`, generates an
+2 -2
src/applications/differential/constants/DifferentialReviewerStatus.php
··· 19 19 * will attempt to update you to both "commented" and "accepted". We want 20 20 * "accepted" to win, because it's the stronger of the two. 21 21 * 22 - * @param const $constant Reviewer status constant. 23 - * @return int Relative strength (higher is stronger). 22 + * @param string $constant Reviewer status constant. 23 + * @return int Relative strength (higher is stronger). 24 24 */ 25 25 public static function getStatusStrength($constant) { 26 26 $map = array(
+1 -1
src/applications/harbormaster/constants/HarbormasterBuildStatus.php
··· 96 96 /** 97 97 * Get a human readable name for a build status constant. 98 98 * 99 - * @param const $status Build status constant. 99 + * @param string $status Build status constant. 100 100 * @return string Human-readable name. 101 101 */ 102 102 public static function getBuildStatusName($status) {
+1 -1
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
··· 88 88 * These tags are used to allow users to opt out of receiving certain types 89 89 * of mail, like updates when a task's projects change. 90 90 * 91 - * @param list<const> $tags 91 + * @param list<string> $tags Tag constants. 92 92 * @return $this 93 93 */ 94 94 public function setMailTags(array $tags) {
+1 -1
src/applications/people/storage/PhabricatorUser.php
··· 430 430 /** 431 431 * Test if a given setting is set to a particular value. 432 432 * 433 - * @param const $key Setting key. 433 + * @param string $key Setting key constant. 434 434 * @param wild $value Value to compare. 435 435 * @return bool True if the setting has the specified value. 436 436 * @task settings
+1 -1
src/applications/policy/interface/PhabricatorExtendedPolicyInterface.php
··· 62 62 * // ... 63 63 * ); 64 64 * 65 - * @param const $capability Capability being tested. 65 + * @param string $capability Constant of the capability being tested. 66 66 * @param PhabricatorUser $viewer Viewer whose capabilities are being tested. 67 67 * @return list<pair<wild, wild>> List of extended policies. 68 68 */
+4 -3
src/applications/search/engine/PhabricatorApplicationSearchEngine.php
··· 732 732 * 733 733 * @param AphrontRequest $request Request to read user PHIDs from. 734 734 * @param string $key Key to read in the request. 735 - * @param list<const> $allow_types (optional) Other permitted PHID types. 735 + * @param list<string> $allow_types (optional) Other permitted PHID type 736 + * constants. 736 737 * @return list<phid> List of user PHIDs and selector functions. 737 738 * @task read 738 739 */ ··· 807 808 * 808 809 * @param AphrontRequest $request Request to read PHIDs from. 809 810 * @param string $key Key to read in the request. 810 - * @param list<const> $allow_types (optional) List of permitted PHID 811 - * types. 811 + * @param list<string> $allow_types (optional) List of permitted PHID 812 + * type constants. 812 813 * @return list<phid> List of object PHIDs. 813 814 * 814 815 * @task read
+4 -4
src/applications/transactions/editengine/PhabricatorEditEngine.php
··· 713 713 * to make Conduit a little easier to use. 714 714 * 715 715 * @param wild $identifier ID, PHID, or monogram. 716 - * @param list<const> $capabilities (optional) List of required capability 716 + * @param list<string> $capabilities (optional) List of required capability 717 717 * constants, or omit for defaults. 718 718 * @return object Corresponding editable object. 719 719 * @task load ··· 793 793 * Load an object by ID. 794 794 * 795 795 * @param int $id Object ID. 796 - * @param list<const> $capabilities (optional) List of required capability 796 + * @param list<string> $capabilities (optional) List of required capability 797 797 * constants, or omit for defaults. 798 798 * @return object|null Object, or null if no such object exists. 799 799 * @task load ··· 810 810 * Load an object by PHID. 811 811 * 812 812 * @param phid $phid Object PHID. 813 - * @param list<const> $capabilities (optional) List of required capability 813 + * @param list<string> $capabilities (optional) List of required capability 814 814 * constants, or omit for defaults. 815 815 * @return object|null Object, or null if no such object exists. 816 816 * @task load ··· 827 827 * Load an object given a configured query. 828 828 * 829 829 * @param PhabricatorPolicyAwareQuery $query Configured query. 830 - * @param list<const> $capabilities (optional) List of required capability 830 + * @param list<string> $capabilities (optional) List of required capability 831 831 * constants, or omit for defaults. 832 832 * @return object|null Object, or null if no such object exists. 833 833 * @task load
+3 -3
src/infrastructure/contentsource/PhabricatorContentSource.php
··· 22 22 /** 23 23 * Construct a new content source object. 24 24 * 25 - * @param const $source The source type constant to build a source for. 26 - * @param array $params (optional) Source parameters. 27 - * @param bool $force (optional) True to suppress errors and force 25 + * @param string $source The source type constant to build a source for. 26 + * @param array $params (optional) Source parameters. 27 + * @param bool $force (optional) True to suppress errors and force 28 28 * construction of a source even if the source type is not valid. 29 29 * @return PhabricatorContentSource New source object. 30 30 */
+3 -2
src/infrastructure/customfield/field/PhabricatorCustomField.php
··· 1570 1570 /** 1571 1571 * Get the Herald value type for the given condition. 1572 1572 * 1573 - * @param const $condition Herald condition constant. 1574 - * @return const|null Herald value type, or null to use the default. 1573 + * @param string $condition Herald condition constant. 1574 + * @return string|null Herald value type constant, or null to use the 1575 + * default. 1575 1576 * @task herald 1576 1577 */ 1577 1578 public function getHeraldFieldValueType($condition) {
+1 -1
src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php
··· 59 59 * triggers which have been scheduled to execute. You should not use this 60 60 * ordering when querying for specific triggers, e.g. by ID or PHID. 61 61 * 62 - * @param const $order Result order. 62 + * @param string $order Result order constant. 63 63 * @return $this 64 64 */ 65 65 public function setOrder($order) {
+2 -2
src/infrastructure/edges/editor/PhabricatorEdgeEditor.php
··· 46 46 * provided, `data` will be written. 47 47 * 48 48 * @param phid $src Source object PHID. 49 - * @param const $type Edge type constant. 49 + * @param string $type Edge type constant. 50 50 * @param phid $dst Destination object PHID. 51 51 * @param map $options (optional) Options map (see documentation). 52 52 * @return $this ··· 68 68 * a remove plus an add is to overwrite. 69 69 * 70 70 * @param phid $src Source object PHID. 71 - * @param const $type Edge type constant. 71 + * @param string $type Edge type constant. 72 72 * @param phid $dst Destination object PHID. 73 73 * @return $this 74 74 *
+3 -3
src/infrastructure/edges/query/PhabricatorEdgeQuery.php
··· 88 88 /** 89 89 * Configure the order edge results are returned in. 90 90 * 91 - * @param const $order Order constant. 91 + * @param string $order Order constant. 92 92 * @return $this 93 93 * 94 94 * @task config ··· 122 122 * use case. 123 123 * 124 124 * @param phid $src_phid Source PHID. 125 - * @param const $edge_type Edge type. 125 + * @param string $edge_type Edge type constant. 126 126 * @return list<phid> List of destination PHIDs. 127 127 */ 128 128 public static function loadDestinationPHIDs($src_phid, $edge_type) { ··· 140 140 * and immediately executes a full query. 141 141 * 142 142 * @param phid $src_phid Source PHID. 143 - * @param const $edge_type Edge type. 143 + * @param string $edge_type Edge type constant. 144 144 * @param phid $dest_phid Destination PHID. 145 145 * @return wild Edge annotation (or null). 146 146 */
+2 -2
src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
··· 2587 2587 * Convenience method for specifying edge logic constraints with a list of 2588 2588 * PHIDs. 2589 2589 * 2590 - * @param const $edge_type Edge constant. 2591 - * @param const $operator Constraint operator. 2590 + * @param string $edge_type Edge constant. 2591 + * @param string $operator Constraint operator. 2592 2592 * @param list<phid> $phids List of PHIDs. 2593 2593 * @return $this 2594 2594 * @task edgelogic
+2 -2
src/infrastructure/storage/lisk/LiskDAO.php
··· 402 402 /** 403 403 * Determine the setting of a configuration option for this class of objects. 404 404 * 405 - * @param const $option_name Option name, one of the CONFIG_* constants. 405 + * @param string $option_name Option name, one of the CONFIG_* constants. 406 406 * @return mixed Option value, if configured (null if unavailable). 407 407 * 408 408 * @task config ··· 1042 1042 /** 1043 1043 * Internal implementation of INSERT and REPLACE. 1044 1044 * 1045 - * @param const $mode Either "INSERT" or "REPLACE", to force the desired 1045 + * @param string $mode Either "INSERT" or "REPLACE", to force the desired 1046 1046 * mode. 1047 1047 * @return $this 1048 1048 *