Closed SebSept closed 2 years ago
Thanks for reviewing. That's right multi words domains are not handled. Your example is relevant. But currently, none exists and I'm used to don't code thing that are not needed. I think it's a better option to code things when they are needed not because we imagine they could exists. Our code must be ready to accept changes, but that's another question.
However, I'll give it a try tonight.
I'll add some tests and we'll fix what's possible or not..
Added tests with the current real data. Only one command is not correct (mine 😠😄 )
Formats : ( domain and action are placeholders )
FOP\Console\Commands\Domain\DomainAction
fop:domain:action
fop.console.domain.action.command
Words separators :
-
(action words can also be separated by :
(image generation commands).)_
see ./Resources/commands-realworld.csv
and Resources/commands-realworld.csv
for examples.
I rewrote the class. It was a need while I was implementing the phpstan rule (#97). The basis still the same even if a lot of code has changed. The tests provided were a must to do this refactoring (gg @Kaudaj).
Features :
validate()
has now 3 parameters instead of 4, domain(=namespace) and class name are replaced by Fully Qualified Class Name (no need to extract them before using the validator).checkCommandNameIsConsistentWithClassName()
, ...COMMAND_REGEXP
, ...validate()
returns aValidationResults
class which embed all results (positive and negative) (classValidateResult
)