Skip to content

Commit

Permalink
Cleanup: remove constructor lazy checker
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Jan 3, 2024
1 parent a9ea546 commit 43d9925
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
5 changes: 0 additions & 5 deletions src/DI/ConsoleExtension.php
Expand Up @@ -4,7 +4,6 @@

use Contributte\Console\Application;
use Contributte\Console\CommandLoader\ContainerCommandLoader;
use Contributte\Console\Exception\Logical\InvalidArgumentException;
use Nette\DI\CompilerExtension;
use Nette\DI\Definitions\ServiceDefinition;
use Nette\DI\Definitions\Statement;
Expand Down Expand Up @@ -32,10 +31,6 @@ class ConsoleExtension extends CompilerExtension

public function __construct(bool $cliMode = false)
{
if (func_num_args() <= 0) {
throw new InvalidArgumentException(sprintf('Provide CLI mode, e.q. %s(%%consoleMode%%).', self::class));
}

$this->cliMode = $cliMode;
}

Expand Down
10 changes: 0 additions & 10 deletions src/Exception/Logical/InvalidArgumentException.php

This file was deleted.

8 changes: 0 additions & 8 deletions tests/cases/DI/ConsoleExtension.phpt
Expand Up @@ -2,7 +2,6 @@

use Contributte\Console\Application;
use Contributte\Console\DI\ConsoleExtension;
use Contributte\Console\Exception\Logical\InvalidArgumentException;
use Contributte\Tester\Environment;
use Contributte\Tester\Toolkit;
use Nette\Bridges\HttpDI\HttpExtension;
Expand Down Expand Up @@ -72,13 +71,6 @@ Toolkit::test(function (): void {
Assert::equal('https://contributte.org/', (string) $container->getService('http.request')->getUrl());
});

// No mode provided
Toolkit::test(function (): void {
Assert::exception(function (): void {
new ConsoleExtension();
}, InvalidArgumentException::class, 'Provide CLI mode, e.q. Contributte\Console\DI\ConsoleExtension(%consoleMode%).');
});

// Non-CLI mode
Toolkit::test(function (): void {
$loader = new ContainerLoader(Environment::getTestDir(), true);
Expand Down

0 comments on commit 43d9925

Please sign in to comment.