Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Command::initialize and command argument inferences #398

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

VincentLanglet
Copy link
Contributor

This follow the same idea of #391.

When looking at the execute method of the Symfony command
https://github.com/symfony/symfony/blob/c0e30bb06bb4c12efc8bad13f7cb732954cb0182/src/Symfony/Component/Console/Command/Command.php#L231-L280

The order of the call are

$this->initialize($input, $output);
$this->interact($input, $output);
if ($input->hasArgument('command') && null === $input->getArgument('command')) {
     $input->setArgument('command', $this->getName());
}
$input->validate();
$this->execute($input, $output);

Which means that:

  • In the initialize method the command argument might be missing
  • In the interact method the command argument might be missing
  • In the initialize method, like in the interact one` option might be missing since they are not yet validated.

@ondrejmirtes ondrejmirtes merged commit 1bd7c33 into phpstan:1.4.x Jun 26, 2024
31 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants