mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
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
This commit is contained in:
parent
a439ea7190
commit
9f3cde4db7
20 changed files with 33 additions and 29 deletions
|
@ -69,7 +69,7 @@ final class CalendarTimeUtil extends Phobject {
|
|||
|
||||
$today_epoch = PhabricatorTime::parseLocalTime('today', $user);
|
||||
$today = new DateTime('@'.$today_epoch);
|
||||
$today->setTimeZone($timezone);
|
||||
$today->setTimezone($timezone);
|
||||
|
||||
if (strtolower($start_day_str) == 'today' ||
|
||||
$today->format('l') == $start_day_str) {
|
||||
|
@ -79,7 +79,7 @@ final class CalendarTimeUtil extends Phobject {
|
|||
'last '.$start_day_str,
|
||||
$user);
|
||||
$start_day = new DateTime('@'.$start_epoch);
|
||||
$start_day->setTimeZone($timezone);
|
||||
$start_day->setTimezone($timezone);
|
||||
}
|
||||
return array(
|
||||
'today' => $today,
|
||||
|
|
|
@ -47,7 +47,7 @@ final class PhabricatorDaemonManagementRestartWorkflow
|
|||
|
||||
return $this->executeStartCommand(
|
||||
array(
|
||||
'reserve' => (float)$args->getArg('autoscale-reserve', 0.0),
|
||||
'reserve' => (float)$args->getArg('autoscale-reserve'),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ final class PhabricatorDaemonManagementStartWorkflow
|
|||
array(
|
||||
'keep-leases' => $args->getArg('keep-leases'),
|
||||
'force' => $args->getArg('force'),
|
||||
'reserve' => (float)$args->getArg('autoscale-reserve', 0.0),
|
||||
'reserve' => (float)$args->getArg('autoscale-reserve'),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ final class DiffusionBrowseQueryConduitAPIMethod
|
|||
$commit,
|
||||
$path);
|
||||
} catch (CommandException $e) {
|
||||
$stderr = $e->getStdErr();
|
||||
$stderr = $e->getStderr();
|
||||
if (preg_match('/^fatal: Not a valid object name/', $stderr)) {
|
||||
// Grab two logs, since the first one is when the object was deleted.
|
||||
list($stdout) = $repository->execxLocalCommand(
|
||||
|
|
|
@ -446,7 +446,7 @@ final class DiffusionRepositoryController extends DiffusionController {
|
|||
$header->setHeader(pht('Branches'));
|
||||
|
||||
if ($more_branches) {
|
||||
$header->setSubHeader(pht('Showing %d branches.', $limit));
|
||||
$header->setSubheader(pht('Showing %d branches.', $limit));
|
||||
}
|
||||
|
||||
$button = new PHUIButtonView();
|
||||
|
@ -505,7 +505,7 @@ final class DiffusionRepositoryController extends DiffusionController {
|
|||
$header->setHeader(pht('Tags'));
|
||||
|
||||
if ($more_tags) {
|
||||
$header->setSubHeader(
|
||||
$header->setSubheader(
|
||||
pht('Showing the %d most recent tags.', $tag_limit));
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,6 @@ final class DiffusionCommitEditEngine
|
|||
->setValue($object->getAuditorPHIDsForEdit());
|
||||
|
||||
$reason = $data->getCommitDetail('autocloseReason', false);
|
||||
$reason = PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED;
|
||||
if ($reason !== false) {
|
||||
switch ($reason) {
|
||||
case PhabricatorRepository::BECAUSE_REPOSITORY_IMPORTING:
|
||||
|
|
|
@ -46,7 +46,7 @@ final class HeraldPreCommitContentAdapter extends HeraldPreCommitAdapter {
|
|||
|
||||
if ($this->changesets instanceof Exception) {
|
||||
$ex_class = get_class($this->changesets);
|
||||
$ex_message = $this->changesets->getmessage();
|
||||
$ex_message = $this->changesets->getMessage();
|
||||
if ($type === 'name') {
|
||||
return array("<{$ex_class}: {$ex_message}>");
|
||||
} else {
|
||||
|
|
|
@ -271,13 +271,13 @@ final class DiffusionLowLevelResolveRefsQuery
|
|||
try {
|
||||
list($stdout) = $future->resolvex();
|
||||
} catch (CommandException $ex) {
|
||||
if (preg_match('/ambiguous identifier/', $ex->getStdErr())) {
|
||||
if (preg_match('/ambiguous identifier/', $ex->getStderr())) {
|
||||
// This indicates that the ref ambiguously matched several things.
|
||||
// Eventually, it would be nice to return all of them, but it is
|
||||
// unclear how to best do that. For now, treat it as a miss instead.
|
||||
continue;
|
||||
}
|
||||
if (preg_match('/unknown revision/', $ex->getStdErr())) {
|
||||
if (preg_match('/unknown revision/', $ex->getStderr())) {
|
||||
// No matches for this ref.
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ final class DivinerPHPAtomizer extends DivinerAtomizer {
|
|||
|
||||
private function parseParams(DivinerAtom $atom, AASTNode $func) {
|
||||
$params = $func
|
||||
->getChildByIndex(3, 'n_DECLARATAION_PARAMETER_LIST')
|
||||
->getChildOfType(3, 'n_DECLARATAION_PARAMETER_LIST')
|
||||
->selectDescendantsOfType('n_DECLARATION_PARAMETER');
|
||||
|
||||
$param_spec = array();
|
||||
|
|
|
@ -340,6 +340,9 @@ final class PhabricatorMetaMTAMail
|
|||
return $this->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return this
|
||||
*/
|
||||
public function save() {
|
||||
if ($this->getID()) {
|
||||
return parent::save();
|
||||
|
|
|
@ -86,7 +86,7 @@ final class PhabricatorPhortuneManagementInvoiceWorkflow
|
|||
|
||||
$auto_range = $args->getArg('auto-range');
|
||||
$last_arg = $args->getArg('last');
|
||||
$next_arg = $args->getARg('next');
|
||||
$next_arg = $args->getArg('next');
|
||||
|
||||
if (!$auto_range && !$last_arg && !$next_arg) {
|
||||
throw new PhutilArgumentUsageException(
|
||||
|
|
|
@ -233,7 +233,7 @@ final class PhabricatorRepositoryDiscoveryEngine
|
|||
$limit,
|
||||
$repository->getSubversionBaseURI($at_rev));
|
||||
} catch (CommandException $ex) {
|
||||
$stderr = $ex->getStdErr();
|
||||
$stderr = $ex->getStderr();
|
||||
if (preg_match('/(path|File) not found/', $stderr)) {
|
||||
// We've gone all the way back through history and this path was not
|
||||
// affected by earlier commits.
|
||||
|
|
|
@ -108,7 +108,7 @@ final class PhabricatorRepositoryMirrorEngine
|
|||
->setCWD($repository->getLocalPath())
|
||||
->resolvex();
|
||||
} catch (CommandException $ex) {
|
||||
if (preg_match('/no changes found/', $ex->getStdOut())) {
|
||||
if (preg_match('/no changes found/', $ex->getStdout())) {
|
||||
// mercurial says nothing changed, but that's good
|
||||
} else {
|
||||
throw $ex;
|
||||
|
|
|
@ -471,7 +471,7 @@ final class PhabricatorRepositoryPullEngine
|
|||
$future->resolvex();
|
||||
} catch (CommandException $ex) {
|
||||
$err = $ex->getError();
|
||||
$stdout = $ex->getStdOut();
|
||||
$stdout = $ex->getStdout();
|
||||
|
||||
// NOTE: Between versions 2.1 and 2.1.1, Mercurial changed the behavior
|
||||
// of "hg pull" to return 1 in case of a successful pull with no changes.
|
||||
|
|
|
@ -111,7 +111,7 @@ final class PhabricatorMarkupEngine extends Phobject {
|
|||
}
|
||||
|
||||
if (!$keys) {
|
||||
return;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$objects = array_select_keys($this->objects, $keys);
|
||||
|
|
|
@ -1521,6 +1521,7 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
|||
|
||||
|
||||
/**
|
||||
* @return this
|
||||
* @task edgelogic
|
||||
*/
|
||||
public function withEdgeLogicConstraints($edge_type, array $constraints) {
|
||||
|
|
|
@ -1094,12 +1094,12 @@ abstract class LiskDAO extends Phobject {
|
|||
|
||||
|
||||
/**
|
||||
* Save this object, forcing the query to use INSERT regardless of object
|
||||
* state.
|
||||
* Save this object, forcing the query to use INSERT regardless of object
|
||||
* state.
|
||||
*
|
||||
* @return this
|
||||
* @return this
|
||||
*
|
||||
* @task save
|
||||
* @task save
|
||||
*/
|
||||
public function insert() {
|
||||
$this->isEphemeralCheck();
|
||||
|
@ -1108,12 +1108,12 @@ abstract class LiskDAO extends Phobject {
|
|||
|
||||
|
||||
/**
|
||||
* Save this object, forcing the query to use UPDATE regardless of object
|
||||
* state.
|
||||
* Save this object, forcing the query to use UPDATE regardless of object
|
||||
* state.
|
||||
*
|
||||
* @return this
|
||||
* @return this
|
||||
*
|
||||
* @task save
|
||||
* @task save
|
||||
*/
|
||||
public function update() {
|
||||
$this->isEphemeralCheck();
|
||||
|
@ -1192,6 +1192,7 @@ abstract class LiskDAO extends Phobject {
|
|||
* Internal implementation of INSERT and REPLACE.
|
||||
*
|
||||
* @param const Either "INSERT" or "REPLACE", to force the desired mode.
|
||||
* @return this
|
||||
*
|
||||
* @task save
|
||||
*/
|
||||
|
|
|
@ -64,7 +64,7 @@ final class PhabricatorTime extends Phobject {
|
|||
public static function getTodayMidnightDateTime($viewer) {
|
||||
$timezone = new DateTimeZone($viewer->getTimezoneIdentifier());
|
||||
$today = new DateTime('@'.time());
|
||||
$today->setTimeZone($timezone);
|
||||
$today->setTimezone($timezone);
|
||||
$year = $today->format('Y');
|
||||
$month = $today->format('m');
|
||||
$day = $today->format('d');
|
||||
|
@ -74,7 +74,7 @@ final class PhabricatorTime extends Phobject {
|
|||
|
||||
public static function getDateTimeFromEpoch($epoch, PhabricatorUser $viewer) {
|
||||
$datetime = new DateTime('@'.$epoch);
|
||||
$datetime->setTimeZone($viewer->getTimeZone());
|
||||
$datetime->setTimezone($viewer->getTimeZone());
|
||||
return $datetime;
|
||||
}
|
||||
|
||||
|
|
|
@ -577,7 +577,7 @@ final class PHUICalendarMonthView extends AphrontView {
|
|||
private function getTodayMidnight() {
|
||||
$viewer = $this->getUser();
|
||||
$today = new DateTime('@'.time());
|
||||
$today->setTimeZone($viewer->getTimeZone());
|
||||
$today->setTimezone($viewer->getTimeZone());
|
||||
$today->setTime(0, 0, 0);
|
||||
|
||||
return $today;
|
||||
|
|
|
@ -88,7 +88,7 @@ function phabricator_format_local_time($epoch, $user, $format) {
|
|||
"raised an exception.", $epoch));
|
||||
}
|
||||
|
||||
$date->setTimeZone($zone);
|
||||
$date->setTimezone($zone);
|
||||
|
||||
return PhutilTranslator::getInstance()->translateDate($format, $date);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue