chore: fixes coding style issues

This commit is contained in:
Nuno Maduro
2022-11-09 21:08:19 +00:00
parent acd6bb2234
commit bb56d32643
6 changed files with 17 additions and 19 deletions

View File

@ -20,6 +20,11 @@ $rules = [
], ],
'concat_space' => ['spacing' => 'one'], 'concat_space' => ['spacing' => 'one'],
'not_operator_with_space' => false, 'not_operator_with_space' => false,
'global_namespace_import' => [
'import_classes' => true,
'import_functions' => true,
'import_constants' => true,
],
]; ];
$rules['increment_style'] = ['style' => 'post']; $rules['increment_style'] = ['style' => 'post'];

View File

@ -90,11 +90,6 @@ parameters:
count: 1 count: 1
path: src/Expectation.php path: src/Expectation.php
-
message: "#^Parameter \\#1 \\$actualJson of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertJson\\(\\) expects string, mixed given\\.$#"
count: 1
path: src/Expectation.php
- -
message: "#^Parameter \\#1 \\$directory of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertDirectoryExists\\(\\) expects string, mixed given\\.$#" message: "#^Parameter \\#1 \\$directory of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertDirectoryExists\\(\\) expects string, mixed given\\.$#"
count: 1 count: 1
@ -250,16 +245,6 @@ parameters:
count: 1 count: 1
path: src/Support/ExceptionTrace.php path: src/Support/ExceptionTrace.php
-
message: "#^Cannot access offset 'file' on mixed\\.$#"
count: 1
path: src/Support/ExceptionTrace.php
-
message: "#^Parameter \\#1 \\$haystack of function mb_strpos expects string, mixed given\\.$#"
count: 1
path: src/Support/ExceptionTrace.php
- -
message: "#^Parameter \\#2 \\$array of function key_exists expects array, mixed given\\.$#" message: "#^Parameter \\#2 \\$array of function key_exists expects array, mixed given\\.$#"
count: 1 count: 1

View File

@ -9,6 +9,9 @@ use Pest\Support\ChainableClosure;
use Pest\Support\ExceptionTrace; use Pest\Support\ExceptionTrace;
use Pest\TestSuite; use Pest\TestSuite;
use PHPUnit\Framework\ExecutionOrderDependency; use PHPUnit\Framework\ExecutionOrderDependency;
use function sprintf;
use Throwable; use Throwable;
/** /**
@ -257,7 +260,7 @@ trait Testable
*/ */
public function toString(): string public function toString(): string
{ {
return \sprintf( return sprintf(
'%s::%s', '%s::%s',
self::$__filename, self::$__filename,
$this->__description $this->__description

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Pest\Console; namespace Pest\Console;
use function is_dir;
use Pest\Actions\AddsDefaults; use Pest\Actions\AddsDefaults;
use Pest\Actions\AddsTests; use Pest\Actions\AddsTests;
use Pest\Actions\InteractsWithPlugins; use Pest\Actions\InteractsWithPlugins;
@ -81,7 +83,7 @@ final class Command extends BaseCommand
$testSuite = $this->arguments['test']; $testSuite = $this->arguments['test'];
if (is_string($testSuite)) { if (is_string($testSuite)) {
if (\is_dir($testSuite)) { if (is_dir($testSuite)) {
/** @var string[] $files */ /** @var string[] $files */
$files = (new FileIteratorFacade())->getFilesAsArray( $files = (new FileIteratorFacade())->getFilesAsArray(
$testSuite, $testSuite,

View File

@ -102,7 +102,7 @@ final class TestCall
* Runs the current test multiple times with * Runs the current test multiple times with
* each item of the given `iterable`. * each item of the given `iterable`.
* *
* @param array<\Closure|iterable<int|string, mixed>|string> $data * @param array<Closure|iterable<int|string, mixed>|string> $data
*/ */
public function with(...$data): TestCall public function with(...$data): TestCall
{ {

View File

@ -5,6 +5,9 @@ declare(strict_types=1);
namespace Pest\Support; namespace Pest\Support;
use Closure; use Closure;
use const PHP_MAJOR_VERSION;
use ReflectionClass; use ReflectionClass;
use Throwable; use Throwable;
@ -132,7 +135,7 @@ final class HigherOrderMessage
private static function getUndefinedMethodMessage(object $target, string $methodName): string private static function getUndefinedMethodMessage(object $target, string $methodName): string
{ {
if (\PHP_MAJOR_VERSION >= 8) { if (PHP_MAJOR_VERSION >= 8) {
return sprintf(sprintf(self::UNDEFINED_METHOD, sprintf('%s::%s()', get_class($target), $methodName))); return sprintf(sprintf(self::UNDEFINED_METHOD, sprintf('%s::%s()', get_class($target), $methodName)));
} }