Skip to content

Commit 6decfa3

Browse files
authored
Merge pull request #248 from woocommerce/25-02/zero-as-required-value
Allow to use integer zero as value for required option built from schema
2 parents de9c064 + d675451 commit 6decfa3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/src/Commands/DynamicCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected function validate_required_options( InputInterface $input ): void {
2727
foreach ( $options as $option ) {
2828
$name = $option->getName();
2929
$value = $input->getOption( $name );
30-
if ( $option->isValueRequired() && empty( $value ) ) {
30+
if ( $option->isValueRequired() && ( is_null( $value ) || $value === '' ) ) {
3131
throw new \InvalidArgumentException( sprintf( 'The required option "%s" is not set. Run the command with --help for more information.', $name ) );
3232
}
3333
}

0 commit comments

Comments
 (0)