Skip to content

Commit

Permalink
Always return int from start()
Browse files Browse the repository at this point in the history
Returning `null` (which is what happens when the command succeeds)
triggers an error from Symfony Command, which expects
`HM\Local_VIP\Composer\Command::execute()` to always return an integer.
Everything seems to work even if the error is thrown, but nobody likes
seeing an error.
  • Loading branch information
alwaysblank committed Jul 21, 2022
1 parent 4800163 commit 9f28b01
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion inc/composer/class-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ protected function get_env() : array {
*
* @param InputInterface $input Command input object.
* @param OutputInterface $output Command output object.
* @return int|null
* @return int
*/
protected function start( InputInterface $input, OutputInterface $output ) {
$output->writeln( '<info>Starting...</>' );
Expand Down Expand Up @@ -301,6 +301,8 @@ protected function start( InputInterface $input, OutputInterface $output ) {
$output->writeln( '<info>Startup completed.</>' );
$output->writeln( '<info>To access your site visit:</> <comment>' . $site_url . '</>' );

// Symfony complains if we don't return an integer.
return 0;
}

/**
Expand Down

0 comments on commit 9f28b01

Please sign in to comment.