diff --git a/phpstan.neon b/phpstan.neon index e08938a..399349b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -15,3 +15,4 @@ parameters: ignoreErrors: - "#has a nullable return type declaration.#" - "# with a nullable type declaration.#" + - "#has parameter \\$closure with null as default value.#" diff --git a/src/Autoload.php b/src/Autoload.php index 2a8d0a1..ad99ee3 100644 --- a/src/Autoload.php +++ b/src/Autoload.php @@ -3,10 +3,9 @@ declare(strict_types=1); use Pest\Arch\Concerns\Architectable; -use Pest\Concerns\Expectable; use Pest\PendingCalls\TestCall; use Pest\Plugin; -use PHPUnit\Framework\TestCase; +use Pest\Support\HigherOrderTapProxy; Plugin::uses(Architectable::class); @@ -15,11 +14,13 @@ * Adds the given closure as an architecture test. The first * argument is the test description; the second argument * is a closure that contains the test expectations. - * - * @return Expectable|TestCall|TestCase|mixed */ function arch(string $description, Closure $closure = null): TestCall { - return test($description, $closure)->group('arch'); + $test = test($description, $closure); + + assert(! $test instanceof HigherOrderTapProxy); + + return $test->group('arch'); } } diff --git a/src/Plugin.php b/src/Plugin.php index 2352cdd..6a9a3cf 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -1,31 +1,29 @@ hasArgument('--arch', $arguments)) { - return $arguments; + if ($this->hasArgument('--arch', $arguments)) { + return $this->pushArgument('--group=arch', $this->popArgument('--arch', $arguments)); } - return $this->popArgument('--arch', $arguments); - } + if ($this->hasArgument('--exclude-arch', $arguments)) { + return $this->pushArgument('--exclude-group=arch', $this->popArgument('--exclude-arch', $arguments)); + } - public function boot(): void - { + return $arguments; } } diff --git a/src/Support/CommandArgumentMode.php b/src/Support/CommandArgumentMode.php deleted file mode 100644 index 9623cd7..0000000 --- a/src/Support/CommandArgumentMode.php +++ /dev/null @@ -1,10 +0,0 @@ -