@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

Add PHPDoc to PhabricatorPHIDType::canLoadNamedObject()

Summary:
All implementations of `canLoadNamedObject($name)` in classes which extend `PhabricatorPHIDType` run a `preg_match()` on the `$name` parameter being passed.
Thus the parameter must always be a string.
(Spoiler: This isn't always the case currently.)

Test Plan: Read the 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/D26025

+125
+5
src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php
··· 47 47 } 48 48 } 49 49 50 + /** 51 + * Check whether a named object is of this PHID type 52 + * @param string $name Object name 53 + * @return bool True if the named object is of this PHID type 54 + */ 50 55 public function canLoadNamedObject($name) { 51 56 return preg_match('/^E[1-9]\d*$/i', $name); 52 57 }
+5
src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php
··· 40 40 } 41 41 } 42 42 43 + /** 44 + * Check whether a named object is of this PHID type 45 + * @param string $name Object name 46 + * @return bool True if the named object is of this PHID type 47 + */ 43 48 public function canLoadNamedObject($name) { 44 49 return preg_match('/^Z\d*[1-9]\d*$/i', $name); 45 50 }
+5
src/applications/countdown/phid/PhabricatorCountdownCountdownPHIDType.php
··· 41 41 } 42 42 } 43 43 44 + /** 45 + * Check whether a named object is of this PHID type 46 + * @param string $name Object name 47 + * @return bool True if the named object is of this PHID type 48 + */ 44 49 public function canLoadNamedObject($name) { 45 50 return preg_match('/^C\d*[1-9]\d*$/i', $name); 46 51 }
+5
src/applications/dashboard/phid/PhabricatorDashboardPanelPHIDType.php
··· 47 47 } 48 48 } 49 49 50 + /** 51 + * Check whether a named object is of this PHID type 52 + * @param string $name Object name 53 + * @return bool True if the named object is of this PHID type 54 + */ 50 55 public function canLoadNamedObject($name) { 51 56 return preg_match('/^W\d*[1-9]\d*$/i', $name); 52 57 }
+5
src/applications/differential/phid/DifferentialRevisionPHIDType.php
··· 47 47 } 48 48 } 49 49 50 + /** 51 + * Check whether a named object is of this PHID type 52 + * @param string $name Object name 53 + * @return bool True if the named object is of this PHID type 54 + */ 50 55 public function canLoadNamedObject($name) { 51 56 return preg_match('/^D[1-9]\d*$/i', $name); 52 57 }
+5
src/applications/files/phid/PhabricatorFileFilePHIDType.php
··· 45 45 } 46 46 } 47 47 48 + /** 49 + * Check whether a named object is of this PHID type 50 + * @param string $name Object name 51 + * @return bool True if the named object is of this PHID type 52 + */ 48 53 public function canLoadNamedObject($name) { 49 54 return preg_match('/^F\d*[1-9]\d*$/', $name); 50 55 }
+5
src/applications/fund/phid/FundInitiativePHIDType.php
··· 46 46 } 47 47 } 48 48 49 + /** 50 + * Check whether a named object is of this PHID type 51 + * @param string $name Object name 52 + * @return bool True if the named object is of this PHID type 53 + */ 49 54 public function canLoadNamedObject($name) { 50 55 return preg_match('/^I\d*[1-9]\d*$/i', $name); 51 56 }
+5
src/applications/harbormaster/phid/HarbormasterBuildablePHIDType.php
··· 56 56 } 57 57 } 58 58 59 + /** 60 + * Check whether a named object is of this PHID type 61 + * @param string $name Object name 62 + * @return bool True if the named object is of this PHID type 63 + */ 59 64 public function canLoadNamedObject($name) { 60 65 return preg_match('/^B\d*[1-9]\d*$/i', $name); 61 66 }
+5
src/applications/herald/phid/HeraldRulePHIDType.php
··· 45 45 } 46 46 } 47 47 48 + /** 49 + * Check whether a named object is of this PHID type 50 + * @param string $name Object name 51 + * @return bool True if the named object is of this PHID type 52 + */ 48 53 public function canLoadNamedObject($name) { 49 54 return preg_match('/^H\d*[1-9]\d*$/i', $name); 50 55 }
+5
src/applications/legalpad/phid/PhabricatorLegalpadDocumentPHIDType.php
··· 42 42 } 43 43 } 44 44 45 + /** 46 + * Check whether a named object is of this PHID type 47 + * @param string $name Object name 48 + * @return bool True if the named object is of this PHID type 49 + */ 45 50 public function canLoadNamedObject($name) { 46 51 return preg_match('/^L\d*[1-9]\d*$/i', $name); 47 52 }
+5
src/applications/maniphest/phid/ManiphestTaskPHIDType.php
··· 44 44 } 45 45 } 46 46 47 + /** 48 + * Check whether a named object is of this PHID type 49 + * @param string $name Object name 50 + * @return bool True if the named object is of this PHID type 51 + */ 47 52 public function canLoadNamedObject($name) { 48 53 return preg_match('/^T\d*[1-9]\d*$/i', $name); 49 54 }
+5
src/applications/owners/phid/PhabricatorOwnersPackagePHIDType.php
··· 54 54 } 55 55 } 56 56 57 + /** 58 + * Check whether a named object is of this PHID type 59 + * @param string $name Object name 60 + * @return bool True if the named object is of this PHID type 61 + */ 57 62 public function canLoadNamedObject($name) { 58 63 return preg_match('/^O\d*[1-9]\d*$/i', $name); 59 64 }
+5
src/applications/passphrase/phid/PassphraseCredentialPHIDType.php
··· 44 44 } 45 45 } 46 46 47 + /** 48 + * Check whether a named object is of this PHID type 49 + * @param string $name Object name 50 + * @return bool True if the named object is of this PHID type 51 + */ 47 52 public function canLoadNamedObject($name) { 48 53 return preg_match('/^K\d*[1-9]\d*$/i', $name); 49 54 }
+5
src/applications/paste/phid/PhabricatorPastePastePHIDType.php
··· 41 41 } 42 42 } 43 43 44 + /** 45 + * Check whether a named object is of this PHID type 46 + * @param string $name Object name 47 + * @return bool True if the named object is of this PHID type 48 + */ 44 49 public function canLoadNamedObject($name) { 45 50 return preg_match('/^P\d*[1-9]\d*$/i', $name); 46 51 }
+5
src/applications/people/phid/PhabricatorPeopleUserPHIDType.php
··· 86 86 } 87 87 } 88 88 89 + /** 90 + * Check whether a named object is of this PHID type 91 + * @param string $name Object name 92 + * @return bool True if the named object is of this PHID type 93 + */ 89 94 public function canLoadNamedObject($name) { 90 95 return preg_match('/^@.+/', $name); 91 96 }
+5
src/applications/phid/type/PhabricatorPHIDType.php
··· 125 125 array $handles, 126 126 array $objects); 127 127 128 + /** 129 + * Check whether a named object is of this PHID type 130 + * @param string $name Object name 131 + * @return bool True if the named object is of this PHID type 132 + */ 128 133 public function canLoadNamedObject($name) { 129 134 return false; 130 135 }
+5
src/applications/pholio/phid/PholioMockPHIDType.php
··· 45 45 } 46 46 } 47 47 48 + /** 49 + * Check whether a named object is of this PHID type 50 + * @param string $name Object name 51 + * @return bool True if the named object is of this PHID type 52 + */ 48 53 public function canLoadNamedObject($name) { 49 54 return preg_match('/^M\d*[1-9]\d*$/i', $name); 50 55 }
+5
src/applications/phriction/phid/PhrictionDocumentPHIDType.php
··· 47 47 } 48 48 } 49 49 50 + /** 51 + * Check whether a named object is of this PHID type 52 + * @param string $name Object name 53 + * @return bool True if the named object is of this PHID type 54 + */ 50 55 public function canLoadNamedObject($name) { 51 56 return preg_match('/.*\/$/', $name); 52 57 }
+5
src/applications/phurl/phid/PhabricatorPhurlURLPHIDType.php
··· 43 43 } 44 44 } 45 45 46 + /** 47 + * Check whether a named object is of this PHID type 48 + * @param string $name Object name 49 + * @return bool True if the named object is of this PHID type 50 + */ 46 51 public function canLoadNamedObject($name) { 47 52 return preg_match('/^U[1-9]\d*$/i', $name); 48 53 }
+5
src/applications/ponder/phid/PonderQuestionPHIDType.php
··· 40 40 } 41 41 } 42 42 43 + /** 44 + * Check whether a named object is of this PHID type 45 + * @param string $name Object name 46 + * @return bool True if the named object is of this PHID type 47 + */ 43 48 public function canLoadNamedObject($name) { 44 49 return preg_match('/^Q\d*[1-9]\d*$/i', $name); 45 50 }
+5
src/applications/project/phid/PhabricatorProjectProjectPHIDType.php
··· 70 70 return '[^\s,#]+'; 71 71 } 72 72 73 + /** 74 + * Check whether a named object is of this PHID type 75 + * @param string $name Object name 76 + * @return bool True if the named object is of this PHID type 77 + */ 73 78 public function canLoadNamedObject($name) { 74 79 $fragment = self::getProjectMonogramPatternFragment(); 75 80 return preg_match('/^#'.$fragment.'$/i', $name);
+5
src/applications/repository/phid/PhabricatorRepositoryCommitPHIDType.php
··· 96 96 '[a-f0-9]{'.$min_unqualified.',40}'; 97 97 } 98 98 99 + /** 100 + * Check whether a named object is of this PHID type 101 + * @param string $name Object name 102 + * @return bool True if the named object is of this PHID type 103 + */ 99 104 public function canLoadNamedObject($name) { 100 105 $pattern = self::getCommitObjectNamePattern(); 101 106 return preg_match('(^'.$pattern.'$)', $name);
+5
src/applications/repository/phid/PhabricatorRepositoryRepositoryPHIDType.php
··· 53 53 } 54 54 } 55 55 56 + /** 57 + * Check whether a named object is of this PHID type 58 + * @param string $name Object name 59 + * @return bool True if the named object is of this PHID type 60 + */ 56 61 public function canLoadNamedObject($name) { 57 62 return preg_match('/^(r[A-Z]+|R[1-9]\d*)\z/', $name); 58 63 }
+5
src/applications/slowvote/phid/PhabricatorSlowvotePollPHIDType.php
··· 38 38 } 39 39 } 40 40 41 + /** 42 + * Check whether a named object is of this PHID type 43 + * @param string $name Object name 44 + * @return bool True if the named object is of this PHID type 45 + */ 41 46 public function canLoadNamedObject($name) { 42 47 return preg_match('/^V\d*[1-9]\d*$/i', $name); 43 48 }
+5
src/applications/spaces/phid/PhabricatorSpacesNamespacePHIDType.php
··· 48 48 } 49 49 } 50 50 51 + /** 52 + * Check whether a named object is of this PHID type 53 + * @param string $name Object name 54 + * @return bool True if the named object is of this PHID type 55 + */ 51 56 public function canLoadNamedObject($name) { 52 57 return preg_match('/^S[1-9]\d*$/i', $name); 53 58 }