khalyomede / khalyomede/command-parser
Parse definition should be checked
- Dominant language
- PHP
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Specifying wrong format for the argument of `CommandParser::parse()` will throw numerous general PHP exceptions.
**To Reproduce**
_command.php_
```php
CommandParser::parse(['arguments' => 'wrong', 'flags' => 'also wrong']);
```
```bash
php command.php
```
**Expected value**
```bash
Uncaught InvalidArgumentException: ...
```
**Actual value**
```bash
PHP Fatal error: Uncaught Khalyomede\Exception\NotEnoughArgumentsException: found 0 arguments, but the command requires 1 arguments in command-parser\src\CommandParser.php:200
Stack trace:
#0 command-parser\example\example-1.php(7): Khalyomede\CommandParser::parse(Array)
#1 {main}
thrown in command-parser\src\CommandParser.php on line 200
Fatal error: Uncaught Khalyomede\Exception\NotEnoughArgumentsException: found 0 arguments, but the command requires 1 arguments in command-parser\src\CommandParser.php:200
Stack trace:
#0 command-parser\example\example-1.php(7): Khalyomede\CommandParser::parse(Array)
#1 {main}
thrown in command-parser\src\CommandParser.php on line 200
```
**Version**
0.2.0
**Suggestions**
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with CommandParser::parse() in command-parser/src/CommandParser.php, especially the path around line 200, and reproduce the example from command.php with the malformed arguments and flags shown. Trace how the input is validated and compare the resulting exception with the requested InvalidArgumentException. Done means malformed parse definitions produce the expected exception instead of unrelated argument errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100