1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 14:52:40 +01:00

Fix errors found by PHPStan

Test Plan:
Ran `phpstan analyze -a autoload.php arcanist/src` with `autoload.php` containing:

  <?php
  require_once 'libphutil/src/__phutil_library_init__.php';
  require_once 'arcanist/src/__phutil_library_init__.php';

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17367
This commit is contained in:
Jakub Vrana 2017-02-16 13:54:43 +00:00 committed by vrana
parent 460b0e46ee
commit d0353d2381
11 changed files with 16 additions and 17 deletions

View file

@ -59,7 +59,7 @@ final class ArcanistGitLandEngine
public function __destruct() {
if ($this->restoreWhenDestroyed) {
$this->writeWARN(
$this->writeWarn(
pht('INTERRUPTED!'),
pht('Restoring working copy to its original state.'));

View file

@ -189,7 +189,7 @@ abstract class ArcanistBaseXHPASTLinter extends ArcanistFutureLinter {
* Get a path's parse exception from the responsible linter.
*
* @param string Path to retrieve exception for.
* @return Exeption|null Parse exception, if available.
* @return Exception|null Parse exception, if available.
* @task sharing
*/
final protected function getXHPASTExceptionForPath($path) {

View file

@ -3,11 +3,14 @@
final class ArcanistClosureLinterTestCase
extends ArcanistExternalLinterTestCase {
public function testLinter() {
protected function getLinter() {
$linter = new ArcanistClosureLinter();
$linter->setFlags(array('--additional_extensions=lint-test'));
return $linter;
}
$this->executeTestsInDirectory(dirname(__FILE__).'/gjslint/', $linter);
public function testLinter() {
$this->executeTestsInDirectory(dirname(__FILE__).'/gjslint/');
}
}

View file

@ -28,7 +28,7 @@ final class XUnitTestResultParserTestCase extends PhutilTestCase {
$parsed_results = id(new ArcanistXUnitTestResultParser())
->parseTestResults('');
$this->failTest(pht('Should throw on empty input'));
$this->assertFailure(pht('Should throw on empty input'));
} catch (Exception $e) {
// OK
}
@ -43,7 +43,7 @@ final class XUnitTestResultParserTestCase extends PhutilTestCase {
$parsed_results = id(new ArcanistXUnitTestResultParser())
->parseTestResults($stubbed_results);
$this->failTest(pht('Should throw on non-xml input'));
$this->assertFailure(pht('Should throw on non-xml input'));
} catch (Exception $e) {
// OK
}

View file

@ -514,9 +514,7 @@ EOTEXT
$this->branch = head($branch);
$this->keepBranch = $this->getArgument('keep-branch');
$update_strategy = $this->getConfigFromAnySource(
'arc.land.update.default',
'merge');
$update_strategy = $this->getConfigFromAnySource('arc.land.update.default');
$this->shouldUpdateWithRebase = $update_strategy == 'rebase';
if ($this->getArgument('update-with-rebase')) {
$this->shouldUpdateWithRebase = true;

View file

@ -227,7 +227,7 @@ EOTEXT
}
if ($everything) {
$paths = iterator_to_array($this->getRepositoryApi()->getAllFiles());
$paths = iterator_to_array($this->getRepositoryAPI()->getAllFiles());
$this->shouldLintAll = true;
} else {
$paths = $this->selectPathsForWorkflow($paths, $rev);

View file

@ -76,7 +76,7 @@ EOTEXT
"%s: %s\n\n",
pht('Started'),
implode(', ', ipull($phid_query, 'fullName')));
$this->printCurrentTracking(true);
$this->printCurrentTracking();
}
}

View file

@ -105,7 +105,7 @@ EOTEXT
"%s %s\n\n",
pht('Stopped:'),
implode(', ', ipull($phid_query, 'fullName')));
$this->printCurrentTracking(true);
$this->printCurrentTracking();
}
}

View file

@ -81,7 +81,7 @@ EOTEXT
$unassigned = $this->getArgument('unassigned');
if ($owner) {
$owner_phid = $this->findOwnerPhid($owner);
$owner_phid = $this->findOwnerPHID($owner);
} else if ($unassigned) {
$owner_phid = null;
} else {

View file

@ -140,7 +140,7 @@ EOTEXT
}
if ($everything) {
$paths = iterator_to_array($this->getRepositoryApi()->getAllFiles());
$paths = iterator_to_array($this->getRepositoryAPI()->getAllFiles());
} else {
$paths = $this->selectPathsForWorkflow($paths, $rev);
}

View file

@ -1008,9 +1008,7 @@ abstract class ArcanistWorkflow extends Phobject {
}
$should_commit = true;
} else {
$permit_autostash = $this->getConfigFromAnySource(
'arc.autostash',
false);
$permit_autostash = $this->getConfigFromAnySource('arc.autostash');
if ($permit_autostash && $api->canStashChanges()) {
echo pht(
'Stashing uncommitted changes. (You can restore them with `%s`).',