From 38344c99f1501a9dce5d3a83a511b8db63a76b01 Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Wed, 12 Aug 2020 14:45:55 +0100 Subject: [PATCH] style: apply Rector changes --- src/Concerns/TestCase.php | 5 +++-- src/Laravel/Commands/PestInstallCommand.php | 3 ++- src/Repositories/TestRepository.php | 3 ++- src/Support/ExceptionTrace.php | 2 +- src/Support/HigherOrderMessage.php | 2 +- src/Support/HigherOrderTapProxy.php | 5 +++-- src/TestSuite.php | 3 ++- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Concerns/TestCase.php b/src/Concerns/TestCase.php index 6c1d98ce..58d17059 100644 --- a/src/Concerns/TestCase.php +++ b/src/Concerns/TestCase.php @@ -9,6 +9,7 @@ use Pest\Expectation; use Pest\Support\ExceptionTrace; use Pest\TestSuite; use PHPUnit\Util\Test; +use Throwable; /** * To avoid inheritance conflicts, all the fields related @@ -143,7 +144,7 @@ trait TestCase * * @return mixed * - * @throws \Throwable + * @throws Throwable */ public function __test() { @@ -153,7 +154,7 @@ trait TestCase /** * @return mixed * - * @throws \Throwable + * @throws Throwable */ private function __callClosure(Closure $closure, array $arguments) { diff --git a/src/Laravel/Commands/PestInstallCommand.php b/src/Laravel/Commands/PestInstallCommand.php index c5247548..b1f34a45 100644 --- a/src/Laravel/Commands/PestInstallCommand.php +++ b/src/Laravel/Commands/PestInstallCommand.php @@ -6,6 +6,7 @@ namespace Pest\Laravel\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\File; +use Pest\Console\Thanks; use Pest\Exceptions\InvalidConsoleArgument; use Pest\Support\Str; @@ -61,7 +62,7 @@ final class PestInstallCommand extends Command $this->output->success('`tests/Helpers.php` created successfully.'); if (!(bool) $this->option('no-interaction')) { - (new \Pest\Console\Thanks($this->output))(); + (new Thanks($this->output))(); } } diff --git a/src/Repositories/TestRepository.php b/src/Repositories/TestRepository.php index 09242448..cf36319e 100644 --- a/src/Repositories/TestRepository.php +++ b/src/Repositories/TestRepository.php @@ -11,6 +11,7 @@ use Pest\Exceptions\TestCaseClassOrTraitNotFound; use Pest\Factories\TestCaseFactory; use Pest\Support\Str; use Pest\TestSuite; +use PHPUnit\Framework\TestCase; /** * @internal @@ -52,7 +53,7 @@ final class TestRepository if ((!is_dir($path) && $filename === $path) || (is_dir($path) && $startsWith($filename, $path))) { foreach ($classOrTraits as $class) { if (class_exists($class)) { - if ($testCase->class !== \PHPUnit\Framework\TestCase::class) { + if ($testCase->class !== TestCase::class) { throw new TestCaseAlreadyInUse($testCase->class, $class, $filename); } $testCase->class = $class; diff --git a/src/Support/ExceptionTrace.php b/src/Support/ExceptionTrace.php index 72a1d829..014b88df 100644 --- a/src/Support/ExceptionTrace.php +++ b/src/Support/ExceptionTrace.php @@ -20,7 +20,7 @@ final class ExceptionTrace * * @return mixed * - * @throws \Throwable + * @throws Throwable */ public static function ensure(Closure $closure) { diff --git a/src/Support/HigherOrderMessage.php b/src/Support/HigherOrderMessage.php index 75e351b6..9f363b5a 100644 --- a/src/Support/HigherOrderMessage.php +++ b/src/Support/HigherOrderMessage.php @@ -77,7 +77,7 @@ final class HigherOrderMessage Reflection::setPropertyValue($throwable, 'line', $this->line); if ($throwable->getMessage() === self::getUndefinedMethodMessage($target, $this->methodName)) { - /** @var \ReflectionClass $reflection */ + /** @var ReflectionClass $reflection */ $reflection = new ReflectionClass($target); /* @phpstan-ignore-next-line */ $reflection = $reflection->getParentClass() ?: $reflection; diff --git a/src/Support/HigherOrderTapProxy.php b/src/Support/HigherOrderTapProxy.php index 9e9506d2..4b5664d3 100644 --- a/src/Support/HigherOrderTapProxy.php +++ b/src/Support/HigherOrderTapProxy.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Pest\Support; use ReflectionClass; +use Throwable; /** * @internal @@ -51,12 +52,12 @@ final class HigherOrderTapProxy try { // @phpstan-ignore-next-line return $this->target->{$property}; - } catch (\Throwable $throwable) { + } catch (Throwable $throwable) { Reflection::setPropertyValue($throwable, 'file', Backtrace::file()); Reflection::setPropertyValue($throwable, 'line', Backtrace::line()); if (Str::startsWith($message = $throwable->getMessage(), self::UNDEFINED_PROPERTY)) { - /** @var \ReflectionClass $reflection */ + /** @var ReflectionClass $reflection */ $reflection = (new ReflectionClass($this->target))->getParentClass(); Reflection::setPropertyValue($throwable, 'message', sprintf('Undefined property %s::$%s', $reflection->getName(), $property)); } diff --git a/src/TestSuite.php b/src/TestSuite.php index b9c232b2..63e58f4e 100644 --- a/src/TestSuite.php +++ b/src/TestSuite.php @@ -10,6 +10,7 @@ use Pest\Repositories\AfterEachRepository; use Pest\Repositories\BeforeAllRepository; use Pest\Repositories\BeforeEachRepository; use Pest\Repositories\TestRepository; +use PHPUnit\Framework\TestCase; /** * @internal @@ -19,7 +20,7 @@ final class TestSuite /** * Holds the current test case. * - * @var \PHPUnit\Framework\TestCase|null + * @var TestCase|null */ public $test;