From: epriestley Date: Tue, 20 Jan 2015 23:39:21 +0000 (-0800) Subject: Don't use newInstanceWithoutConstructor in Arcanist unit test X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=1cc8f3f377f6ccc680b1062494ba2b90709655ce;p=arcanist.git Don't use newInstanceWithoutConstructor in Arcanist unit test Summary: This requires PHP 5.4. Use `newv()` instead. I don't think the "without constructor" part is meaningful (or desirable). Simplify slightly. Test Plan: `arc unit --everything` Reviewers: hach-que, joshuaspence Reviewed By: joshuaspence Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D11450 --- diff --git a/src/lint/linter/__tests__/ArcanistLinterTestCase.php b/src/lint/linter/__tests__/ArcanistLinterTestCase.php index 40cfe375..4785d9e7 100644 --- a/src/lint/linter/__tests__/ArcanistLinterTestCase.php +++ b/src/lint/linter/__tests__/ArcanistLinterTestCase.php @@ -11,20 +11,13 @@ abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase { * @return ArcanistLinter */ protected final function getLinter() { - $matches = array(); - - if (!preg_match('/^(\w+Linter)TestCase$/', get_class($this), $matches)) { - throw new Exception(pht('Unable to infer linter class name.')); - } - - $linter = id(new ReflectionClass($matches[1])) - ->newInstanceWithoutConstructor(); - - if (!$linter instanceof ArcanistLinter) { + $matches = null; + if (!preg_match('/^(\w+Linter)TestCase$/', get_class($this), $matches) || + !is_subclass_of($matches[1], 'ArcanistLinter')) { throw new Exception(pht('Unable to infer linter class name.')); } - return $linter; + return newv($matches[1], array()); } public abstract function testLinter();