From d0353d238113bfc1c1a3341288e29a7d26128a52 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Thu, 16 Feb 2017 13:54:43 +0000 Subject: [PATCH] Fix errors found by PHPStan Test Plan: Ran `phpstan analyze -a autoload.php arcanist/src` with `autoload.php` containing: restoreWhenDestroyed) { - $this->writeWARN( + $this->writeWarn( pht('INTERRUPTED!'), pht('Restoring working copy to its original state.')); diff --git a/src/lint/linter/ArcanistBaseXHPASTLinter.php b/src/lint/linter/ArcanistBaseXHPASTLinter.php index 72a9bd7e..f0f44827 100644 --- a/src/lint/linter/ArcanistBaseXHPASTLinter.php +++ b/src/lint/linter/ArcanistBaseXHPASTLinter.php @@ -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) { diff --git a/src/lint/linter/__tests__/ArcanistClosureLinterTestCase.php b/src/lint/linter/__tests__/ArcanistClosureLinterTestCase.php index 50c01ca5..f02dc21b 100644 --- a/src/lint/linter/__tests__/ArcanistClosureLinterTestCase.php +++ b/src/lint/linter/__tests__/ArcanistClosureLinterTestCase.php @@ -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/'); } } diff --git a/src/unit/parser/__tests__/XUnitTestResultParserTestCase.php b/src/unit/parser/__tests__/XUnitTestResultParserTestCase.php index c26356d0..960bb46c 100644 --- a/src/unit/parser/__tests__/XUnitTestResultParserTestCase.php +++ b/src/unit/parser/__tests__/XUnitTestResultParserTestCase.php @@ -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 } diff --git a/src/workflow/ArcanistLandWorkflow.php b/src/workflow/ArcanistLandWorkflow.php index 884f3a54..8323ce24 100644 --- a/src/workflow/ArcanistLandWorkflow.php +++ b/src/workflow/ArcanistLandWorkflow.php @@ -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; diff --git a/src/workflow/ArcanistLintWorkflow.php b/src/workflow/ArcanistLintWorkflow.php index bb53cde7..36126c5d 100644 --- a/src/workflow/ArcanistLintWorkflow.php +++ b/src/workflow/ArcanistLintWorkflow.php @@ -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); diff --git a/src/workflow/ArcanistStartWorkflow.php b/src/workflow/ArcanistStartWorkflow.php index b940265e..b39cea5a 100644 --- a/src/workflow/ArcanistStartWorkflow.php +++ b/src/workflow/ArcanistStartWorkflow.php @@ -76,7 +76,7 @@ EOTEXT "%s: %s\n\n", pht('Started'), implode(', ', ipull($phid_query, 'fullName'))); - $this->printCurrentTracking(true); + $this->printCurrentTracking(); } } diff --git a/src/workflow/ArcanistStopWorkflow.php b/src/workflow/ArcanistStopWorkflow.php index 1e9f2518..2af72edb 100644 --- a/src/workflow/ArcanistStopWorkflow.php +++ b/src/workflow/ArcanistStopWorkflow.php @@ -105,7 +105,7 @@ EOTEXT "%s %s\n\n", pht('Stopped:'), implode(', ', ipull($phid_query, 'fullName'))); - $this->printCurrentTracking(true); + $this->printCurrentTracking(); } } diff --git a/src/workflow/ArcanistTasksWorkflow.php b/src/workflow/ArcanistTasksWorkflow.php index 95cc7de4..3b9a0789 100644 --- a/src/workflow/ArcanistTasksWorkflow.php +++ b/src/workflow/ArcanistTasksWorkflow.php @@ -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 { diff --git a/src/workflow/ArcanistUnitWorkflow.php b/src/workflow/ArcanistUnitWorkflow.php index a1aadd3b..00ef8a59 100644 --- a/src/workflow/ArcanistUnitWorkflow.php +++ b/src/workflow/ArcanistUnitWorkflow.php @@ -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); } diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php index 2365083a..192cf243 100644 --- a/src/workflow/ArcanistWorkflow.php +++ b/src/workflow/ArcanistWorkflow.php @@ -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`).',