From 5466451b76cda98a7807f7b7317c9a8fb7ccbc8b Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Thu, 25 Jun 2015 22:30:33 +1000 Subject: [PATCH] Return `$this` from setter methods Summary: Return `$this` from a bunch of setter methods for consistency. See also D13422. Test Plan: Eyeball it. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D13423 --- src/configuration/ArcanistConfigurationManager.php | 2 ++ src/lint/linter/xhpast/ArcanistXHPASTLinterRule.php | 1 + src/unit/engine/NoseTestEngine.php | 2 +- src/unit/engine/XUnitTestEngine.php | 4 ++-- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/configuration/ArcanistConfigurationManager.php b/src/configuration/ArcanistConfigurationManager.php index d2284742..3473a0bd 100644 --- a/src/configuration/ArcanistConfigurationManager.php +++ b/src/configuration/ArcanistConfigurationManager.php @@ -13,6 +13,7 @@ final class ArcanistConfigurationManager extends Phobject { public function setWorkingCopyIdentity( ArcanistWorkingCopyIdentity $working_copy) { $this->workingCopy = $working_copy; + return $this; } /* -( Get config )--------------------------------------------------------- */ @@ -243,6 +244,7 @@ final class ArcanistConfigurationManager extends Phobject { $this->customArcrcFilename = $custom_arcrc; $this->userConfigCache = null; + return $this; } public function getUserConfigurationFileLocation() { diff --git a/src/lint/linter/xhpast/ArcanistXHPASTLinterRule.php b/src/lint/linter/xhpast/ArcanistXHPASTLinterRule.php index 00c44194..b98636f6 100644 --- a/src/lint/linter/xhpast/ArcanistXHPASTLinterRule.php +++ b/src/lint/linter/xhpast/ArcanistXHPASTLinterRule.php @@ -69,6 +69,7 @@ abstract class ArcanistXHPASTLinterRule extends Phobject { final public function setLinter(ArcanistXHPASTLinter $linter) { $this->linter = $linter; + return $this; } /** diff --git a/src/unit/engine/NoseTestEngine.php b/src/unit/engine/NoseTestEngine.php index 9af83c56..5e5870e1 100644 --- a/src/unit/engine/NoseTestEngine.php +++ b/src/unit/engine/NoseTestEngine.php @@ -64,7 +64,7 @@ final class NoseTestEngine extends ArcanistUnitTestEngine { foreach ($futures as $test_path => $future) { try { list($stdout, $stderr) = $future->resolvex(); - } catch(CommandException $exc) { + } catch (CommandException $exc) { if ($exc->getError() > 1) { // 'nose' returns 1 when tests are failing/broken. throw $exc; diff --git a/src/unit/engine/XUnitTestEngine.php b/src/unit/engine/XUnitTestEngine.php index d97c6f0e..803880af 100644 --- a/src/unit/engine/XUnitTestEngine.php +++ b/src/unit/engine/XUnitTestEngine.php @@ -250,7 +250,7 @@ class XUnitTestEngine extends ArcanistUnitTestEngine { try { $regenerate_future->resolvex(); $result->setResult(ArcanistUnitTestResult::RESULT_PASS); - } catch(CommandException $exc) { + } catch (CommandException $exc) { if ($exc->getError() > 1) { throw $exc; } @@ -296,7 +296,7 @@ class XUnitTestEngine extends ArcanistUnitTestEngine { try { $future->resolvex(); $result->setResult(ArcanistUnitTestResult::RESULT_PASS); - } catch(CommandException $exc) { + } catch (CommandException $exc) { if ($exc->getError() > 1) { throw $exc; }