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

Drop question mark suffix from optional PHPDoc @param types

Summary:
The question mark in `@param type? $foo Desc` is a custom notation not consistently applied across the codebase and not necessarily obvious to the reader (because custom and not mentioned in https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md ).
Instead, explicitly state "optional" in the parameter description for clarity.

Closes T15925.

Test Plan: Run PHPStan, see no `PHPDoc @param has invalid value (type? [...]` style output anymore.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15925

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

+92 -85
+3 -3
src/aphront/AphrontRequest.php
··· 780 780 * 781 781 * @param string $name Canonical header name, like 782 782 `"Accept-Encoding"`. 783 - * @param wild? $default Default value to return if header is not 784 - present. 785 - * @param array? $data Read this instead of `$_SERVER`. 783 + * @param wild $default (optional) Default value to return if 784 + header is not present. 785 + * @param array $data (optional) Read this instead of `$_SERVER`. 786 786 * @return string|wild Header value if present, or `$default` if not. 787 787 */ 788 788 public static function getHTTPHeader($name, $default = null, $data = null) {
+1 -1
src/aphront/sink/AphrontHTTPSink.php
··· 29 29 * Write an HTTP status code to the output. 30 30 * 31 31 * @param int $code Numeric HTTP status code. 32 - * @param string? $message 32 + * @param string $message (optional) 33 33 * @return void 34 34 */ 35 35 final public function writeHTTPStatus($code, $message = '') {
+2 -2
src/applications/auth/constants/PhabricatorCookies.php
··· 107 107 * 108 108 * @param AphrontRequest $request Request to write to. 109 109 * @param string $next_uri URI to write. 110 - * @param bool? $force Write this cookie even if we have a 111 - * fresh cookie already. 110 + * @param bool $force (optional) Write this cookie even if we 111 + * have a fresh cookie already. 112 112 * @return void 113 113 * 114 114 * @task next
+2 -2
src/applications/auth/controller/PhabricatorAuthController.php
··· 45 45 * event and do something else if they prefer. 46 46 * 47 47 * @param PhabricatorUser $user User to log the viewer in as. 48 - * @param bool? $force_full_session True to issue a full session immediately, 49 - * bypassing MFA. 48 + * @param bool $force_full_session (optional) True to issue a full session 49 + * immediately, bypassing MFA. 50 50 * @return AphrontResponse Response which continues the login process. 51 51 */ 52 52 protected function loginUser(
+16 -15
src/applications/auth/engine/PhabricatorAuthSessionEngine.php
··· 327 327 * multifactor authentication. 328 328 * 329 329 * @param PhabricatorUser $user User whose sessions should be terminated. 330 - * @param string|null? $except_session Optionally, one session to keep. 330 + * @param string|null $except_session (optional) One session to keep. 331 331 * Normally, the current login session. 332 332 * 333 333 * @return void ··· 428 428 * @param AphrontRequest $request Current request. 429 429 * @param string $cancel_uri URI to return the user to if they 430 430 * cancel. 431 - * @param bool? $jump_into_hisec True to jump partial sessions 432 - * directly into high security instead of just 433 - * upgrading them to full sessions. 431 + * @param bool $jump_into_hisec (optional) True to jump partial 432 + * sessions directly into high security instead of 433 + * just upgrading them to full sessions. 434 434 * @return PhabricatorAuthHighSecurityToken Security token. 435 435 * @task hisec 436 436 */ ··· 742 742 * Issue a high security token for a session, if authorized. 743 743 * 744 744 * @param PhabricatorAuthSession $session Session to issue a token for. 745 - * @param bool? $force Force token issue. 745 + * @param bool $force (optional) Force token issue. 746 746 * @return PhabricatorAuthHighSecurityToken|null Token, if authorized. 747 747 * @task hisec 748 748 */ ··· 945 945 * @param PhabricatorUser $user User to generate a URI for. 946 946 * @param PhabricatorUserEmail? $email Optionally, email to verify when 947 947 * link is used. 948 - * @param string? $type Optional context string for the URI. This is purely 948 + * @param string $type (optional) Context string for the URI. This is purely 949 949 * cosmetic and used only to customize workflow and error messages. 950 - * @param bool? $force_full_session True to generate a URI which forces an 951 - * immediate upgrade to a full session, bypassing MFA and other login 952 - * checks. 950 + * @param bool $force_full_session (optional) True to generate a URI which 951 + * forces an immediate upgrade to a full session, bypassing MFA and other 952 + * login checks. 953 953 * @return string Login URI. 954 954 * @task onetime 955 955 */ ··· 994 994 * Load the temporary token associated with a given one-time login key. 995 995 * 996 996 * @param PhabricatorUser $user User to load the token for. 997 - * @param PhabricatorUserEmail? $email Optionally, email to verify when 998 - * link is used. 999 - * @param string? $key Key user is presenting as a valid one-time login key. 997 + * @param PhabricatorUserEmail $email (optional) Email to verify when link is 998 + * used. 999 + * @param string $key (optional) Key user is presenting as a valid one-time 1000 + * login key. 1000 1001 * @return PhabricatorAuthTemporaryToken|null Token, if one exists. 1001 1002 * @task onetime 1002 1003 */ ··· 1022 1023 * Hash a one-time login key for storage as a temporary token. 1023 1024 * 1024 1025 * @param PhabricatorUser $user User this key is for. 1025 - * @param PhabricatorUserEmail? $email Optionally, email to verify when 1026 - * link is used. 1027 - * @param string? $key The one time login key. 1026 + * @param PhabricatorUserEmail $email (optional) Email to verify when link is 1027 + * used. 1028 + * @param string $key (optional) The one time login key. 1028 1029 * @return string Hash of the key. 1029 1030 * task onetime 1030 1031 */
+2 -1
src/applications/auth/provider/PhabricatorAuthProvider.php
··· 462 462 * 463 463 * @param AphrontRequest $request HTTP request. 464 464 * @param string $mode Request mode string. 465 - * @param map? $attributes Additional parameters, see above. 465 + * @param map $attributes (optional) Additional parameters, see 466 + * above. 466 467 * @return wild Log in button. 467 468 */ 468 469 protected function renderStandardLoginButton(
+2 -2
src/applications/base/PhabricatorApplication.php
··· 331 331 * Build items for the main menu. 332 332 * 333 333 * @param PhabricatorUser $user The viewing user. 334 - * @param AphrontController? $controller The current controller. May be null 335 - * for special pages like 404, exception handlers, etc. 334 + * @param AphrontController $controller (optional) The current controller. 335 + * May be null for special pages like 404, exception handlers, etc. 336 336 * @return list<PHUIListItemView> List of menu items. 337 337 * @task ui 338 338 */
+2 -2
src/applications/celerity/api.php
··· 11 11 * 12 12 * @param string $symbol Name of the celerity module to include. This is 13 13 * whatever you annotated as "@provides" in the file. 14 - * @param string? $source_name 14 + * @param string $source_name (optional) 15 15 * @return void 16 16 */ 17 17 function require_celerity_resource($symbol, $source_name = 'phabricator') { ··· 42 42 * Get the versioned URI for a raw resource, like an image. 43 43 * 44 44 * @param string $resource Path to the raw image. 45 - * @param string? $source 45 + * @param string $source (optional) Defaults to 'phabricator' 46 46 * @return string Versioned path to the image, if one is available. 47 47 */ 48 48 function celerity_get_resource_uri($resource, $source = 'phabricator') {
+1 -1
src/applications/differential/render/DifferentialChangesetHTMLRenderer.php
··· 494 494 * @param int $top Beginning of the line range to build links for. 495 495 * @param int $len Length of the line range to build links for. 496 496 * @param int $changeset_length Total number of lines in the changeset. 497 - * @param bool? $is_blocks 497 + * @param bool $is_blocks (optional) 498 498 * @return markup Rendered links. 499 499 */ 500 500 protected function renderShowContextLinks(
+2 -2
src/applications/diffusion/data/DiffusionGitBranch.php
··· 20 20 * ); 21 21 * 22 22 * @param string $stdout stdout of git branch command. 23 - * @param string? $only_this_remote Filter branches to those on a specific 24 - * remote. 23 + * @param string $only_this_remote (optional) Filter branches to those on a 24 + * specific remote. 25 25 * @return map Map of 'branch' or 'remote/branch' to hash at HEAD. 26 26 */ 27 27 public static function parseRemoteBranchOutput(
+1 -1
src/applications/diffusion/request/DiffusionRequest.php
··· 135 135 * 136 136 * @param string $identifier Repository identifier. 137 137 * @param PhabricatorUser $viewer Viewing user. 138 - * @param bool? $need_edit 138 + * @param bool $need_edit (optional) 139 139 * @return DiffusionRequest New request object. 140 140 * @task new 141 141 */
+1 -1
src/applications/files/PhabricatorImageTransformer.php
··· 21 21 * extensions), but can save images in another format. 22 22 * 23 23 * @param resource $data GD image resource. 24 - * @param string? $preferred_mime Optionally, preferred mime type. 24 + * @param string $preferred_mime (optional) Preferred mime type. 25 25 * @return string Bytes of an image file. 26 26 * @task save 27 27 */
+2 -2
src/applications/files/storage/PhabricatorFile.php
··· 807 807 /** 808 808 * Return an iterable which emits file content bytes. 809 809 * 810 - * @param int? $begin Offset for the start of data. 811 - * @param int? $end Offset for the end of data. 810 + * @param int $begin (optional) Offset for the start of data. 811 + * @param int $end (optional) Offset for the end of data. 812 812 * @return Iterable Iterable object which emits requested data. 813 813 */ 814 814 public function getFileDataIterator($begin = null, $end = null) {
+1 -1
src/applications/meta/panel/PhabricatorApplicationConfigurationPanel.php
··· 27 27 /** 28 28 * Get the URI for this application configuration panel. 29 29 * 30 - * @param string? $path Optional path to append. 30 + * @param string $path (optional) Path to append. 31 31 * @return string Relative URI for the panel. 32 32 */ 33 33 public function getPanelURI($path = '') {
+2 -2
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
··· 456 456 * 457 457 * @param string $thread_id Unique identifier, appropriate for use in a 458 458 * Message-ID, In-Reply-To or References headers. 459 - * @param bool? $is_first_message If true, indicates this is the first 460 - * message in the thread. 459 + * @param bool $is_first_message (optional) If true, indicates this is the 460 + * first message in the thread. 461 461 * @return this 462 462 */ 463 463 public function setThreadID($thread_id, $is_first_message = false) {
+2 -2
src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php
··· 341 341 * With the `$consume` flag, an internal cursor will also be incremented so 342 342 * that these messages are not returned by subsequent calls. 343 343 * 344 - * @param bool? $consume Pass `true` to consume these messages, so the 345 - * process will not see them again. 344 + * @param bool $consume (optional) Pass `true` to consume these messages, so 345 + * the process will not see them again. 346 346 * @return list<wild> Pending update messages. 347 347 * 348 348 * @task pull
+2 -2
src/applications/repository/graphcache/PhabricatorRepositoryGraphCache.php
··· 236 236 * to force a cache update by passing the existing data to `$rebuild_data`. 237 237 * 238 238 * @param int $bucket_key Bucket key, from @{method:getBucketKey}. 239 - * @param mixed? $rebuild_data Current data, to force a cache rebuild of 240 - * this bucket. 239 + * @param mixed $rebuild_data (optional) Current data, to force a cache 240 + * rebuild of this bucket. 241 241 * @return array Data from the cache. 242 242 * @task cache 243 243 */
+4 -2
src/applications/repository/storage/PhabricatorRepository.php
··· 1645 1645 * 2037). We adjust the pull frequency based on when the most recent commit 1646 1646 * occurred. 1647 1647 * 1648 - * @param int? $minimum The minimum update interval to use, in seconds. 1648 + * @param int $minimum (optional) The minimum update interval to use, in 1649 + * seconds. 1649 1650 * @return int Repository update interval, in seconds. 1650 1651 */ 1651 1652 public function loadUpdateInterval($minimum = 15) { ··· 2113 2114 * For lower-level service resolution, see @{method:getAlmanacServiceURI}. 2114 2115 * 2115 2116 * @param PhabricatorUser $viewer Viewing user. 2116 - * @param bool? $never_proxy `true` to throw if a client would be returned. 2117 + * @param bool $never_proxy (optional) `true` to throw if a client would be 2118 + * returned. 2117 2119 * @return ConduitClient|null Client, or `null` for local repositories. 2118 2120 */ 2119 2121 public function newConduitClient(
+2 -2
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 Other permitted PHID types. 735 + * @param list<const> $allow_types (optional) Other permitted PHID types. 736 736 * @return list<phid> List of user PHIDs and selector functions. 737 737 * @task read 738 738 */ ··· 807 807 * 808 808 * @param AphrontRequest $request Request to read PHIDs from. 809 809 * @param string $key Key to read in the request. 810 - * @param list<const>? $allow_types Optional, list of permitted PHID 810 + * @param list<const> $allow_types (optional) List of permitted PHID 811 811 * types. 812 812 * @return list<phid> List of object PHIDs. 813 813 *
+1 -1
src/applications/settings/panel/PhabricatorSettingsPanel.php
··· 234 234 /** 235 235 * Get the URI for this panel. 236 236 * 237 - * @param string? $path Optional path to append. 237 + * @param string $path (optional) Path to append. 238 238 * @return string Relative URI for the panel. 239 239 * @task panel 240 240 */
+8 -8
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 List of required capability constants, 717 - * or omit for defaults. 716 + * @param list<const> $capabilities (optional) List of required capability 717 + * constants, or omit for defaults. 718 718 * @return object Corresponding editable object. 719 719 * @task load 720 720 */ ··· 793 793 * Load an object by ID. 794 794 * 795 795 * @param int $id Object ID. 796 - * @param list<const>? $capabilities List of required capability constants, 797 - * or omit for defaults. 796 + * @param list<const> $capabilities (optional) List of required capability 797 + * constants, or omit for defaults. 798 798 * @return object|null Object, or null if no such object exists. 799 799 * @task load 800 800 */ ··· 810 810 * Load an object by PHID. 811 811 * 812 812 * @param phid $phid Object PHID. 813 - * @param list<const>? $capabilities List of required capability constants, 814 - * or omit for defaults. 813 + * @param list<const> $capabilities (optional) List of required capability 814 + * constants, or omit for defaults. 815 815 * @return object|null Object, or null if no such object exists. 816 816 * @task load 817 817 */ ··· 827 827 * Load an object given a configured query. 828 828 * 829 829 * @param PhabricatorPolicyAwareQuery $query Configured query. 830 - * @param list<const>? $capabilities List of required capability constants, 831 - * or omit for defaults. 830 + * @param list<const> $capabilities (optional) List of required capability 831 + * constants, or omit for defaults. 832 832 * @return object|null Object, or null if no such object exists. 833 833 * @task load 834 834 */
+3 -3
src/infrastructure/cache/PhutilKeyValueCache.php
··· 31 31 * once. 32 32 * 33 33 * @param string $key Key to retrieve. 34 - * @param wild? $default Optional value to return if the key is not 34 + * @param wild $default (optional) Value to return if the key is not 35 35 * found. By default, returns null. 36 36 * @return wild Cache value (on cache hit) or default value (on cache 37 37 * miss). ··· 51 51 * 52 52 * @param string $key Key to set. 53 53 * @param wild $value Value to set. 54 - * @param int|null? $ttl Optional TTL. 54 + * @param int|null $ttl (optional) TTL. 55 55 * @return this 56 56 * @task kvimpl 57 57 */ ··· 93 93 * policy and data will persist in cache indefinitely. 94 94 * 95 95 * @param dict<string, wild> $keys Map of cache keys to values. 96 - * @param int|null? $ttl TTL for cache keys, in seconds. 96 + * @param int|null $ttl (optional) TTL for cache keys, in seconds. 97 97 * @return this 98 98 * @task kvimpl 99 99 */
+3 -3
src/infrastructure/contentsource/PhabricatorContentSource.php
··· 23 23 * Construct a new content source object. 24 24 * 25 25 * @param const $source The source type constant to build a source for. 26 - * @param array? $params Source parameters. 27 - * @param bool? $force True to suppress errors and force construction of a 28 - * source even if the source type is not valid. 26 + * @param array $params (optional) Source parameters. 27 + * @param bool $force (optional) True to suppress errors and force 28 + * construction of a source even if the source type is not valid. 29 29 * @return PhabricatorContentSource New source object. 30 30 */ 31 31 final public static function newForSource(
+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 Event parameters. 332 + * @param dict $params (optional) Event parameters. 333 333 * @return void 334 334 */ 335 335 private function dispatchEvent($type, array $params = array()) {
+2 -2
src/infrastructure/daemon/workers/PhabricatorWorker.php
··· 232 232 * 233 233 * @param string $class Task class to queue. 234 234 * @param array $data Data for the followup task. 235 - * @param array? $options Options for the followup task. 235 + * @param array $options (optional) Options for the followup task. 236 236 * @return this 237 237 */ 238 238 final protected function queueTask( ··· 261 261 * this method to force the queue to flush before failing (for example, if 262 262 * you are using queues to improve locking behavior). 263 263 * 264 - * @param map<string, wild>? $defaults Optional default options. 264 + * @param map<string, wild> $defaults (optional) Default options. 265 265 */ 266 266 final public function flushTaskQueue($defaults = array()) { 267 267 foreach ($this->getQueuedTasks() as $task) {
+1 -1
src/infrastructure/edges/editor/PhabricatorEdgeEditor.php
··· 48 48 * @param phid $src Source object PHID. 49 49 * @param const $type Edge type constant. 50 50 * @param phid $dst Destination object PHID. 51 - * @param map? $options Options map (see documentation). 51 + * @param map $options (optional) Options map (see documentation). 52 52 * @return this 53 53 * 54 54 * @task edit
+4 -2
src/infrastructure/edges/query/PhabricatorEdgeQuery.php
··· 256 256 * $object->attachHandles(array_select_keys($handles, $dst_phids)); 257 257 * } 258 258 * 259 - * @param list? $src_phids List of PHIDs to select, or empty to select all. 260 - * @param list? $types List of edge types to select, or empty to select all. 259 + * @param list $src_phids (optional) List of PHIDs to select, or empty to 260 + * select all. 261 + * @param list $types (optional) List of edge types to select, or empty to 262 + * select all. 261 263 * @return list<phid> List of matching destination PHIDs. 262 264 */ 263 265 public function getDestinationPHIDs(
+3 -3
src/infrastructure/markup/PhabricatorMarkupEngine.php
··· 59 59 * @param PhabricatorMarkupInterface $object The object to render. 60 60 * @param string $field The field to render. 61 61 * @param PhabricatorUser $viewer User viewing the markup. 62 - * @param object? $context_object A context object for 63 - * policy checks. 62 + * @param object $context_object (optional) A context 63 + * object for policy checks. 64 64 * @return string Marked up output. 65 65 * @task markup 66 66 */ ··· 196 196 * @param string $field The field to retrieve. 197 197 * @param string $metadata_key The engine metadata field 198 198 * to retrieve. 199 - * @param wild? $default Optional default value. 199 + * @param wild $default (optional) Default value. 200 200 * @task markup 201 201 */ 202 202 public function getEngineMetadata(
+2 -2
src/infrastructure/markup/PhutilMarkupEngine.php
··· 22 22 * metadata may be available in your configuration. 23 23 * 24 24 * @param string $key Key to retrieve from metadata. 25 - * @param mixed? $default Default value to return if the key is not 26 - * available. 25 + * @param mixed $default (optional) Default value to return if the key is 26 + * not available. 27 27 * @return mixed Metadata property, or default value. 28 28 */ 29 29 abstract public function getTextMetadata($key, $default = null);
+1 -1
src/infrastructure/markup/markuprule/PhutilRemarkupRule.php
··· 62 62 * 63 63 * @param string $name Tag name. 64 64 * @param dict<string, wild> $attrs Tag attributes. 65 - * @param wild? $content Tag content. 65 + * @param wild $content (optional) Tag content. 66 66 * @return PhutilSafeHTML Tag object. 67 67 */ 68 68 protected function newTag($name, array $attrs, $content = null) {
+2 -2
src/infrastructure/markup/render.php
··· 17 17 * parameters. 18 18 * 19 19 * @param string $tag The name of the tag, like `a` or `div`. 20 - * @param map<string, string>? $attributes A map of tag attributes. 21 - * @param wild? $content Content to put in the tag. 20 + * @param map<string, string> $attributes (optional) A map of tag attributes. 21 + * @param wild $content (optional) Content to put in the tag. 22 22 * @return PhutilSafeHTML Tag object. 23 23 */ 24 24 function phutil_tag($tag, array $attributes = array(), $content = null) {
+4 -3
src/infrastructure/storage/lisk/LiskDAO.php
··· 264 264 * 265 265 * @param mode $mode Connection mode. 266 266 * @param AphrontDatabaseConnection $connection Connection to cache. 267 - * @param bool? $force_unique 267 + * @param bool $force_unique (optional) 268 268 * @return this 269 269 * @task conn 270 270 */ ··· 802 802 * Get or build the database connection for this object. 803 803 * 804 804 * @param string $mode 'r' for read, 'w' for read/write. 805 - * @param bool? $force_new True to force a new connection. The connection 806 - * will not be retrieved from or saved into the connection cache. 805 + * @param bool $force_new (optional) True to force a new connection. The 806 + * connection will not be retrieved from or saved into the connection 807 + * cache. 807 808 * @return AphrontDatabaseConnection Lisk connection object. 808 809 * 809 810 * @task info
+1 -1
src/infrastructure/util/PhabricatorHash.php
··· 12 12 * weak. Callers should prefer @{method:digestWithNamedKey}. 13 13 * 14 14 * @param string $string Input string. 15 - * @param string? $key 15 + * @param string $key (optional) 16 16 * @return string 32-byte hexadecimal SHA1+HMAC hash. 17 17 */ 18 18 public static function weakDigest($string, $key = null) {
+1 -1
src/view/phui/PHUICrumbsView.php
··· 16 16 * a link. 17 17 * 18 18 * @param string $text Text of the crumb. 19 - * @param string? $href Optional href for the crumb. 19 + * @param string $href (optional) href for the crumb. 20 20 * @return this 21 21 */ 22 22 public function addTextCrumb($text, $href = null) {
+4 -4
support/startup/PhabricatorStartup.php
··· 344 344 * Fatal the request completely, sending a plain text message to the client. 345 345 * 346 346 * @param string $message Plain text message to send to the client. 347 - * @param string? $log_message Plain text message to send to the error log. 348 - * If not provided, the client message is used. You can pass 349 - * a more detailed message here (e.g., with stack traces) to 350 - * avoid showing it to users. 347 + * @param string $log_message (optional) Plain text message to send to the 348 + * error log. If not provided, the client message is used. 349 + * You can pass a more detailed message here (e.g., with 350 + * stack traces) to avoid showing it to users. 351 351 * @return exit This method **does not return**. 352 352 * 353 353 * @task apocalypse
+1 -1
support/startup/preamble-utils.php
··· 4 4 * Parse the "X_FORWARDED_FOR" HTTP header to determine the original client 5 5 * address. 6 6 * 7 - * @param int? $layers Number of devices to trust. 7 + * @param int $layers (optional) Number of devices to trust. 8 8 * @return void 9 9 */ 10 10 function preamble_trust_x_forwarded_for_header($layers = 1) {