Skip to content

Commit 67fd980

Browse files
committed
update readme, simplify Usage
1 parent 6e14073 commit 67fd980

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

README.md

+2-9
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,12 @@ composer require devlop/laravel-console-input-validation
1717

1818
```php
1919
use Devlop\Laravel\Console\ValidateInput;
20-
use InvalidArgumentException;
2120
use Symfony\Component\Console\Input\InputInterface;
22-
use Webmozart\Assert\Assert; // not required, but used in the example below
2321

2422
class DemoCommand extends Command
2523
{
2624
use ValidateInput;
2725

28-
public function __construct()
29-
{
30-
parent::__construct();
31-
}
32-
3326
/**
3427
* Validate the console command input.
3528
*
@@ -39,10 +32,10 @@ class DemoCommand extends Command
3932
{
4033
// Example using manual validation
4134
if (! is_numeric($input->getOption('limit'))) {
42-
throw new RuntimeException('--limit must be numeric');
35+
throw new InvalidArgumentException('--limit must be numeric');
4336
}
4437

45-
// Example using webmozarts/assert:
38+
// Example using webmozarts/assert
4639
Assert::numeric($input->getOption('limit')); // assert that the --limit option got a numeric value
4740
Assert::greaterThan($input->getOption('limit'), 0); // assert that the --limit option get a value greater than 0
4841
}

0 commit comments

Comments
 (0)