This PR converts returning integer exit codes to returning the constants defined in Symfony Commands class, making the code more expressive and easier to understand.
Example
class MyCommand extends Command
{
public function handle(): int
{
// do something that fails...
return 1;
}
}
class MyCommand extends Command
{
public function handle(): int
{
// do something that fails...
return static::FAILURE;
}
}
Additional Changes
Return success exit code where command is returning failure or void, ensuring the handle methods always returns an integer, never void.
Declare return type int on handle methods.
Possible Breaking Changes
If the user is extending one of the commands the package provides and are overriding the handle method without the int return type an exception will be thrown. I can remove the return type declaration added if this is a concern.
Summary
This PR converts returning integer exit codes to returning the constants defined in Symfony Commands class, making the code more expressive and easier to understand.
Example
Additional Changes
handle
methods always returns an integer, never void.int
onhandle
methods.Possible Breaking Changes
If the user is extending one of the commands the package provides and are overriding the
handle
method without theint
return type an exception will be thrown. I can remove the return type declaration added if this is a concern.