style: apply Rector changes

This commit is contained in:
Owen Voke
2020-08-12 14:45:55 +01:00
parent 98ed779424
commit 38344c99f1
7 changed files with 14 additions and 9 deletions

View File

@ -9,6 +9,7 @@ use Pest\Expectation;
use Pest\Support\ExceptionTrace; use Pest\Support\ExceptionTrace;
use Pest\TestSuite; use Pest\TestSuite;
use PHPUnit\Util\Test; use PHPUnit\Util\Test;
use Throwable;
/** /**
* To avoid inheritance conflicts, all the fields related * To avoid inheritance conflicts, all the fields related
@ -143,7 +144,7 @@ trait TestCase
* *
* @return mixed * @return mixed
* *
* @throws \Throwable * @throws Throwable
*/ */
public function __test() public function __test()
{ {
@ -153,7 +154,7 @@ trait TestCase
/** /**
* @return mixed * @return mixed
* *
* @throws \Throwable * @throws Throwable
*/ */
private function __callClosure(Closure $closure, array $arguments) private function __callClosure(Closure $closure, array $arguments)
{ {

View File

@ -6,6 +6,7 @@ namespace Pest\Laravel\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\File;
use Pest\Console\Thanks;
use Pest\Exceptions\InvalidConsoleArgument; use Pest\Exceptions\InvalidConsoleArgument;
use Pest\Support\Str; use Pest\Support\Str;
@ -61,7 +62,7 @@ final class PestInstallCommand extends Command
$this->output->success('`tests/Helpers.php` created successfully.'); $this->output->success('`tests/Helpers.php` created successfully.');
if (!(bool) $this->option('no-interaction')) { if (!(bool) $this->option('no-interaction')) {
(new \Pest\Console\Thanks($this->output))(); (new Thanks($this->output))();
} }
} }

View File

@ -11,6 +11,7 @@ use Pest\Exceptions\TestCaseClassOrTraitNotFound;
use Pest\Factories\TestCaseFactory; use Pest\Factories\TestCaseFactory;
use Pest\Support\Str; use Pest\Support\Str;
use Pest\TestSuite; use Pest\TestSuite;
use PHPUnit\Framework\TestCase;
/** /**
* @internal * @internal
@ -52,7 +53,7 @@ final class TestRepository
if ((!is_dir($path) && $filename === $path) || (is_dir($path) && $startsWith($filename, $path))) { if ((!is_dir($path) && $filename === $path) || (is_dir($path) && $startsWith($filename, $path))) {
foreach ($classOrTraits as $class) { foreach ($classOrTraits as $class) {
if (class_exists($class)) { if (class_exists($class)) {
if ($testCase->class !== \PHPUnit\Framework\TestCase::class) { if ($testCase->class !== TestCase::class) {
throw new TestCaseAlreadyInUse($testCase->class, $class, $filename); throw new TestCaseAlreadyInUse($testCase->class, $class, $filename);
} }
$testCase->class = $class; $testCase->class = $class;

View File

@ -20,7 +20,7 @@ final class ExceptionTrace
* *
* @return mixed * @return mixed
* *
* @throws \Throwable * @throws Throwable
*/ */
public static function ensure(Closure $closure) public static function ensure(Closure $closure)
{ {

View File

@ -77,7 +77,7 @@ final class HigherOrderMessage
Reflection::setPropertyValue($throwable, 'line', $this->line); Reflection::setPropertyValue($throwable, 'line', $this->line);
if ($throwable->getMessage() === self::getUndefinedMethodMessage($target, $this->methodName)) { if ($throwable->getMessage() === self::getUndefinedMethodMessage($target, $this->methodName)) {
/** @var \ReflectionClass $reflection */ /** @var ReflectionClass $reflection */
$reflection = new ReflectionClass($target); $reflection = new ReflectionClass($target);
/* @phpstan-ignore-next-line */ /* @phpstan-ignore-next-line */
$reflection = $reflection->getParentClass() ?: $reflection; $reflection = $reflection->getParentClass() ?: $reflection;

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Pest\Support; namespace Pest\Support;
use ReflectionClass; use ReflectionClass;
use Throwable;
/** /**
* @internal * @internal
@ -51,12 +52,12 @@ final class HigherOrderTapProxy
try { try {
// @phpstan-ignore-next-line // @phpstan-ignore-next-line
return $this->target->{$property}; return $this->target->{$property};
} catch (\Throwable $throwable) { } catch (Throwable $throwable) {
Reflection::setPropertyValue($throwable, 'file', Backtrace::file()); Reflection::setPropertyValue($throwable, 'file', Backtrace::file());
Reflection::setPropertyValue($throwable, 'line', Backtrace::line()); Reflection::setPropertyValue($throwable, 'line', Backtrace::line());
if (Str::startsWith($message = $throwable->getMessage(), self::UNDEFINED_PROPERTY)) { if (Str::startsWith($message = $throwable->getMessage(), self::UNDEFINED_PROPERTY)) {
/** @var \ReflectionClass $reflection */ /** @var ReflectionClass $reflection */
$reflection = (new ReflectionClass($this->target))->getParentClass(); $reflection = (new ReflectionClass($this->target))->getParentClass();
Reflection::setPropertyValue($throwable, 'message', sprintf('Undefined property %s::$%s', $reflection->getName(), $property)); Reflection::setPropertyValue($throwable, 'message', sprintf('Undefined property %s::$%s', $reflection->getName(), $property));
} }

View File

@ -10,6 +10,7 @@ use Pest\Repositories\AfterEachRepository;
use Pest\Repositories\BeforeAllRepository; use Pest\Repositories\BeforeAllRepository;
use Pest\Repositories\BeforeEachRepository; use Pest\Repositories\BeforeEachRepository;
use Pest\Repositories\TestRepository; use Pest\Repositories\TestRepository;
use PHPUnit\Framework\TestCase;
/** /**
* @internal * @internal
@ -19,7 +20,7 @@ final class TestSuite
/** /**
* Holds the current test case. * Holds the current test case.
* *
* @var \PHPUnit\Framework\TestCase|null * @var TestCase|null
*/ */
public $test; public $test;