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\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)
{

View File

@ -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))();
}
}

View File

@ -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;

View File

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

View File

@ -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;

View File

@ -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));
}

View File

@ -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;