mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-02-17 01:08: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:
parent
460b0e46ee
commit
d0353d2381
11 changed files with 16 additions and 17 deletions
|
@ -59,7 +59,7 @@ final class ArcanistGitLandEngine
|
||||||
|
|
||||||
public function __destruct() {
|
public function __destruct() {
|
||||||
if ($this->restoreWhenDestroyed) {
|
if ($this->restoreWhenDestroyed) {
|
||||||
$this->writeWARN(
|
$this->writeWarn(
|
||||||
pht('INTERRUPTED!'),
|
pht('INTERRUPTED!'),
|
||||||
pht('Restoring working copy to its original state.'));
|
pht('Restoring working copy to its original state.'));
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ abstract class ArcanistBaseXHPASTLinter extends ArcanistFutureLinter {
|
||||||
* Get a path's parse exception from the responsible linter.
|
* Get a path's parse exception from the responsible linter.
|
||||||
*
|
*
|
||||||
* @param string Path to retrieve exception for.
|
* @param string Path to retrieve exception for.
|
||||||
* @return Exeption|null Parse exception, if available.
|
* @return Exception|null Parse exception, if available.
|
||||||
* @task sharing
|
* @task sharing
|
||||||
*/
|
*/
|
||||||
final protected function getXHPASTExceptionForPath($path) {
|
final protected function getXHPASTExceptionForPath($path) {
|
||||||
|
|
|
@ -3,11 +3,14 @@
|
||||||
final class ArcanistClosureLinterTestCase
|
final class ArcanistClosureLinterTestCase
|
||||||
extends ArcanistExternalLinterTestCase {
|
extends ArcanistExternalLinterTestCase {
|
||||||
|
|
||||||
public function testLinter() {
|
protected function getLinter() {
|
||||||
$linter = new ArcanistClosureLinter();
|
$linter = new ArcanistClosureLinter();
|
||||||
$linter->setFlags(array('--additional_extensions=lint-test'));
|
$linter->setFlags(array('--additional_extensions=lint-test'));
|
||||||
|
return $linter;
|
||||||
|
}
|
||||||
|
|
||||||
$this->executeTestsInDirectory(dirname(__FILE__).'/gjslint/', $linter);
|
public function testLinter() {
|
||||||
|
$this->executeTestsInDirectory(dirname(__FILE__).'/gjslint/');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ final class XUnitTestResultParserTestCase extends PhutilTestCase {
|
||||||
$parsed_results = id(new ArcanistXUnitTestResultParser())
|
$parsed_results = id(new ArcanistXUnitTestResultParser())
|
||||||
->parseTestResults('');
|
->parseTestResults('');
|
||||||
|
|
||||||
$this->failTest(pht('Should throw on empty input'));
|
$this->assertFailure(pht('Should throw on empty input'));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// OK
|
// OK
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ final class XUnitTestResultParserTestCase extends PhutilTestCase {
|
||||||
$parsed_results = id(new ArcanistXUnitTestResultParser())
|
$parsed_results = id(new ArcanistXUnitTestResultParser())
|
||||||
->parseTestResults($stubbed_results);
|
->parseTestResults($stubbed_results);
|
||||||
|
|
||||||
$this->failTest(pht('Should throw on non-xml input'));
|
$this->assertFailure(pht('Should throw on non-xml input'));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// OK
|
// OK
|
||||||
}
|
}
|
||||||
|
|
|
@ -514,9 +514,7 @@ EOTEXT
|
||||||
$this->branch = head($branch);
|
$this->branch = head($branch);
|
||||||
$this->keepBranch = $this->getArgument('keep-branch');
|
$this->keepBranch = $this->getArgument('keep-branch');
|
||||||
|
|
||||||
$update_strategy = $this->getConfigFromAnySource(
|
$update_strategy = $this->getConfigFromAnySource('arc.land.update.default');
|
||||||
'arc.land.update.default',
|
|
||||||
'merge');
|
|
||||||
$this->shouldUpdateWithRebase = $update_strategy == 'rebase';
|
$this->shouldUpdateWithRebase = $update_strategy == 'rebase';
|
||||||
if ($this->getArgument('update-with-rebase')) {
|
if ($this->getArgument('update-with-rebase')) {
|
||||||
$this->shouldUpdateWithRebase = true;
|
$this->shouldUpdateWithRebase = true;
|
||||||
|
|
|
@ -227,7 +227,7 @@ EOTEXT
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($everything) {
|
if ($everything) {
|
||||||
$paths = iterator_to_array($this->getRepositoryApi()->getAllFiles());
|
$paths = iterator_to_array($this->getRepositoryAPI()->getAllFiles());
|
||||||
$this->shouldLintAll = true;
|
$this->shouldLintAll = true;
|
||||||
} else {
|
} else {
|
||||||
$paths = $this->selectPathsForWorkflow($paths, $rev);
|
$paths = $this->selectPathsForWorkflow($paths, $rev);
|
||||||
|
|
|
@ -76,7 +76,7 @@ EOTEXT
|
||||||
"%s: %s\n\n",
|
"%s: %s\n\n",
|
||||||
pht('Started'),
|
pht('Started'),
|
||||||
implode(', ', ipull($phid_query, 'fullName')));
|
implode(', ', ipull($phid_query, 'fullName')));
|
||||||
$this->printCurrentTracking(true);
|
$this->printCurrentTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ EOTEXT
|
||||||
"%s %s\n\n",
|
"%s %s\n\n",
|
||||||
pht('Stopped:'),
|
pht('Stopped:'),
|
||||||
implode(', ', ipull($phid_query, 'fullName')));
|
implode(', ', ipull($phid_query, 'fullName')));
|
||||||
$this->printCurrentTracking(true);
|
$this->printCurrentTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ EOTEXT
|
||||||
$unassigned = $this->getArgument('unassigned');
|
$unassigned = $this->getArgument('unassigned');
|
||||||
|
|
||||||
if ($owner) {
|
if ($owner) {
|
||||||
$owner_phid = $this->findOwnerPhid($owner);
|
$owner_phid = $this->findOwnerPHID($owner);
|
||||||
} else if ($unassigned) {
|
} else if ($unassigned) {
|
||||||
$owner_phid = null;
|
$owner_phid = null;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -140,7 +140,7 @@ EOTEXT
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($everything) {
|
if ($everything) {
|
||||||
$paths = iterator_to_array($this->getRepositoryApi()->getAllFiles());
|
$paths = iterator_to_array($this->getRepositoryAPI()->getAllFiles());
|
||||||
} else {
|
} else {
|
||||||
$paths = $this->selectPathsForWorkflow($paths, $rev);
|
$paths = $this->selectPathsForWorkflow($paths, $rev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1008,9 +1008,7 @@ abstract class ArcanistWorkflow extends Phobject {
|
||||||
}
|
}
|
||||||
$should_commit = true;
|
$should_commit = true;
|
||||||
} else {
|
} else {
|
||||||
$permit_autostash = $this->getConfigFromAnySource(
|
$permit_autostash = $this->getConfigFromAnySource('arc.autostash');
|
||||||
'arc.autostash',
|
|
||||||
false);
|
|
||||||
if ($permit_autostash && $api->canStashChanges()) {
|
if ($permit_autostash && $api->canStashChanges()) {
|
||||||
echo pht(
|
echo pht(
|
||||||
'Stashing uncommitted changes. (You can restore them with `%s`).',
|
'Stashing uncommitted changes. (You can restore them with `%s`).',
|
||||||
|
|
Loading…
Add table
Reference in a new issue