@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

Fix errors found by PHPStan

Test Plan: None.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D17377

authored by

Jakub Vrana and committed by
vrana
9f3cde4d a439ea71

+33 -29
+2 -2
src/applications/calendar/util/CalendarTimeUtil.php
··· 69 69 70 70 $today_epoch = PhabricatorTime::parseLocalTime('today', $user); 71 71 $today = new DateTime('@'.$today_epoch); 72 - $today->setTimeZone($timezone); 72 + $today->setTimezone($timezone); 73 73 74 74 if (strtolower($start_day_str) == 'today' || 75 75 $today->format('l') == $start_day_str) { ··· 79 79 'last '.$start_day_str, 80 80 $user); 81 81 $start_day = new DateTime('@'.$start_epoch); 82 - $start_day->setTimeZone($timezone); 82 + $start_day->setTimezone($timezone); 83 83 } 84 84 return array( 85 85 'today' => $today,
+1 -1
src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php
··· 47 47 48 48 return $this->executeStartCommand( 49 49 array( 50 - 'reserve' => (float)$args->getArg('autoscale-reserve', 0.0), 50 + 'reserve' => (float)$args->getArg('autoscale-reserve'), 51 51 )); 52 52 } 53 53
+1 -1
src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php
··· 34 34 array( 35 35 'keep-leases' => $args->getArg('keep-leases'), 36 36 'force' => $args->getArg('force'), 37 - 'reserve' => (float)$args->getArg('autoscale-reserve', 0.0), 37 + 'reserve' => (float)$args->getArg('autoscale-reserve'), 38 38 )); 39 39 } 40 40
+1 -1
src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php
··· 52 52 $commit, 53 53 $path); 54 54 } catch (CommandException $e) { 55 - $stderr = $e->getStdErr(); 55 + $stderr = $e->getStderr(); 56 56 if (preg_match('/^fatal: Not a valid object name/', $stderr)) { 57 57 // Grab two logs, since the first one is when the object was deleted. 58 58 list($stdout) = $repository->execxLocalCommand(
+2 -2
src/applications/diffusion/controller/DiffusionRepositoryController.php
··· 446 446 $header->setHeader(pht('Branches')); 447 447 448 448 if ($more_branches) { 449 - $header->setSubHeader(pht('Showing %d branches.', $limit)); 449 + $header->setSubheader(pht('Showing %d branches.', $limit)); 450 450 } 451 451 452 452 $button = new PHUIButtonView(); ··· 505 505 $header->setHeader(pht('Tags')); 506 506 507 507 if ($more_tags) { 508 - $header->setSubHeader( 508 + $header->setSubheader( 509 509 pht('Showing the %d most recent tags.', $tag_limit)); 510 510 } 511 511
-1
src/applications/diffusion/editor/DiffusionCommitEditEngine.php
··· 111 111 ->setValue($object->getAuditorPHIDsForEdit()); 112 112 113 113 $reason = $data->getCommitDetail('autocloseReason', false); 114 - $reason = PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED; 115 114 if ($reason !== false) { 116 115 switch ($reason) { 117 116 case PhabricatorRepository::BECAUSE_REPOSITORY_IMPORTING:
+1 -1
src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php
··· 46 46 47 47 if ($this->changesets instanceof Exception) { 48 48 $ex_class = get_class($this->changesets); 49 - $ex_message = $this->changesets->getmessage(); 49 + $ex_message = $this->changesets->getMessage(); 50 50 if ($type === 'name') { 51 51 return array("<{$ex_class}: {$ex_message}>"); 52 52 } else {
+2 -2
src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php
··· 271 271 try { 272 272 list($stdout) = $future->resolvex(); 273 273 } catch (CommandException $ex) { 274 - if (preg_match('/ambiguous identifier/', $ex->getStdErr())) { 274 + if (preg_match('/ambiguous identifier/', $ex->getStderr())) { 275 275 // This indicates that the ref ambiguously matched several things. 276 276 // Eventually, it would be nice to return all of them, but it is 277 277 // unclear how to best do that. For now, treat it as a miss instead. 278 278 continue; 279 279 } 280 - if (preg_match('/unknown revision/', $ex->getStdErr())) { 280 + if (preg_match('/unknown revision/', $ex->getStderr())) { 281 281 // No matches for this ref. 282 282 continue; 283 283 }
+1 -1
src/applications/diviner/atomizer/DivinerPHPAtomizer.php
··· 128 128 129 129 private function parseParams(DivinerAtom $atom, AASTNode $func) { 130 130 $params = $func 131 - ->getChildByIndex(3, 'n_DECLARATAION_PARAMETER_LIST') 131 + ->getChildOfType(3, 'n_DECLARATAION_PARAMETER_LIST') 132 132 ->selectDescendantsOfType('n_DECLARATION_PARAMETER'); 133 133 134 134 $param_spec = array();
+3
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
··· 340 340 return $this->save(); 341 341 } 342 342 343 + /** 344 + * @return this 345 + */ 343 346 public function save() { 344 347 if ($this->getID()) { 345 348 return parent::save();
+1 -1
src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php
··· 86 86 87 87 $auto_range = $args->getArg('auto-range'); 88 88 $last_arg = $args->getArg('last'); 89 - $next_arg = $args->getARg('next'); 89 + $next_arg = $args->getArg('next'); 90 90 91 91 if (!$auto_range && !$last_arg && !$next_arg) { 92 92 throw new PhutilArgumentUsageException(
+1 -1
src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
··· 233 233 $limit, 234 234 $repository->getSubversionBaseURI($at_rev)); 235 235 } catch (CommandException $ex) { 236 - $stderr = $ex->getStdErr(); 236 + $stderr = $ex->getStderr(); 237 237 if (preg_match('/(path|File) not found/', $stderr)) { 238 238 // We've gone all the way back through history and this path was not 239 239 // affected by earlier commits.
+1 -1
src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php
··· 108 108 ->setCWD($repository->getLocalPath()) 109 109 ->resolvex(); 110 110 } catch (CommandException $ex) { 111 - if (preg_match('/no changes found/', $ex->getStdOut())) { 111 + if (preg_match('/no changes found/', $ex->getStdout())) { 112 112 // mercurial says nothing changed, but that's good 113 113 } else { 114 114 throw $ex;
+1 -1
src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
··· 471 471 $future->resolvex(); 472 472 } catch (CommandException $ex) { 473 473 $err = $ex->getError(); 474 - $stdout = $ex->getStdOut(); 474 + $stdout = $ex->getStdout(); 475 475 476 476 // NOTE: Between versions 2.1 and 2.1.1, Mercurial changed the behavior 477 477 // of "hg pull" to return 1 in case of a successful pull with no changes.
+1 -1
src/infrastructure/markup/PhabricatorMarkupEngine.php
··· 111 111 } 112 112 113 113 if (!$keys) { 114 - return; 114 + return $this; 115 115 } 116 116 117 117 $objects = array_select_keys($this->objects, $keys);
+1
src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
··· 1521 1521 1522 1522 1523 1523 /** 1524 + * @return this 1524 1525 * @task edgelogic 1525 1526 */ 1526 1527 public function withEdgeLogicConstraints($edge_type, array $constraints) {
+9 -8
src/infrastructure/storage/lisk/LiskDAO.php
··· 1094 1094 1095 1095 1096 1096 /** 1097 - * Save this object, forcing the query to use INSERT regardless of object 1098 - * state. 1097 + * Save this object, forcing the query to use INSERT regardless of object 1098 + * state. 1099 1099 * 1100 - * @return this 1100 + * @return this 1101 1101 * 1102 - * @task save 1102 + * @task save 1103 1103 */ 1104 1104 public function insert() { 1105 1105 $this->isEphemeralCheck(); ··· 1108 1108 1109 1109 1110 1110 /** 1111 - * Save this object, forcing the query to use UPDATE regardless of object 1112 - * state. 1111 + * Save this object, forcing the query to use UPDATE regardless of object 1112 + * state. 1113 1113 * 1114 - * @return this 1114 + * @return this 1115 1115 * 1116 - * @task save 1116 + * @task save 1117 1117 */ 1118 1118 public function update() { 1119 1119 $this->isEphemeralCheck(); ··· 1192 1192 * Internal implementation of INSERT and REPLACE. 1193 1193 * 1194 1194 * @param const Either "INSERT" or "REPLACE", to force the desired mode. 1195 + * @return this 1195 1196 * 1196 1197 * @task save 1197 1198 */
+2 -2
src/infrastructure/time/PhabricatorTime.php
··· 64 64 public static function getTodayMidnightDateTime($viewer) { 65 65 $timezone = new DateTimeZone($viewer->getTimezoneIdentifier()); 66 66 $today = new DateTime('@'.time()); 67 - $today->setTimeZone($timezone); 67 + $today->setTimezone($timezone); 68 68 $year = $today->format('Y'); 69 69 $month = $today->format('m'); 70 70 $day = $today->format('d'); ··· 74 74 75 75 public static function getDateTimeFromEpoch($epoch, PhabricatorUser $viewer) { 76 76 $datetime = new DateTime('@'.$epoch); 77 - $datetime->setTimeZone($viewer->getTimeZone()); 77 + $datetime->setTimezone($viewer->getTimeZone()); 78 78 return $datetime; 79 79 } 80 80
+1 -1
src/view/phui/calendar/PHUICalendarMonthView.php
··· 577 577 private function getTodayMidnight() { 578 578 $viewer = $this->getUser(); 579 579 $today = new DateTime('@'.time()); 580 - $today->setTimeZone($viewer->getTimeZone()); 580 + $today->setTimezone($viewer->getTimeZone()); 581 581 $today->setTime(0, 0, 0); 582 582 583 583 return $today;
+1 -1
src/view/viewutils.php
··· 88 88 "raised an exception.", $epoch)); 89 89 } 90 90 91 - $date->setTimeZone($zone); 91 + $date->setTimezone($zone); 92 92 93 93 return PhutilTranslator::getInstance()->translateDate($format, $date); 94 94 }