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

Fix command return type hints so they are consistent and match what S… #719

Merged
merged 1 commit into from
Jun 4, 2018

Conversation

jwage
Copy link
Member

@jwage jwage commented Jun 4, 2018

Q A
Type improvement
BC Break no

Summary

Working on updating DoctrineMigrationsBundle and I noticed the return type hints for the commands were not consistent and inline with what the Symfony console return type is defined as.

@jwage jwage added this to the 2.0 milestone Jun 4, 2018
@jwage jwage self-assigned this Jun 4, 2018
@jwage jwage merged commit 4cdd363 into master Jun 4, 2018
@jwage jwage deleted the fix-command-return-type-hints branch June 4, 2018 19:55
@@ -47,7 +47,7 @@ protected function configure() : void
parent::configure();
}

public function execute(InputInterface $input, OutputInterface $output) : void
public function execute(InputInterface $input, OutputInterface $output) : ?int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return types shouldn't be nullable, you never return null.
Also if upstream ever adds ?int return type, removing nullability is valid covariant change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it match what the Symfony console doc block has currently. You are correct that in our commands we never return null, so we could change this here.

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

Successfully merging this pull request may close these issues.

2 participants