Closed weierophinney closed 4 years ago
w00t! Green! Ready for one last round of review!
Of course we need more tests to cover all this functionality. I see I've added just one with int param type, but we definitely need more there.
Right - I've waited to write tests until we're sure of the architecture - which I think we're getting close to now.
My thought is to have you merge this to the feature/command-params branch, and then I can start writing tests and pushing them to that branch before we publish #20 (it's still in Draft status); sound good?
I can then start working on the command chain functionality with regards to options that you and I discussed in Slack earlier.
Description
This patch builds on #20, and makes the following changes:
Laminas\Cli\Input\InputParamInterface
, which defines common setter and getter methods for all input parameter types; the interface is mostly fulfilled byLaminas\Cli\Input\InputParamTrait
, other than the methodsgetOptionType()
andgetQuestion()
.BoolParam
ChoiceParam
IntParam
PathParam
IntParam
Laminas\Cli\Input\ParamAwareInputInterface
, which extends symfony/console'sInputInterface
andStreamableInputInterface
, and adds the methodgetParam(string $name): mixed
. There are two internal implementations, one targeting each of symfony/console v4 and v5.InputParamTrait
toLaminas\Cli\Command\ParamAwareCommandTrait
. The trait defines the methodaddParam(InputParamInterface $param)
, and overridesrun()
to decorate the incoming input in aParamAwareInputInterface
instance before calling the parentrun()
method.Application
instance, as it's no longer necessary with the above changes.Documentation is provided, as well as basic workflow tests; more tests will be necessary before we do a release; I'm waiting to do these until we complete any further architecture changes.