-
Notifications
You must be signed in to change notification settings - Fork 890
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
Let commands write errors to STDERR if available (fix issue 2270) #2317
base: 0.x
Are you sure you want to change the base?
Conversation
@@ -204,7 +204,7 @@ public function connect(): void | |||
*/ | |||
public static function getSuffix(array $options): string | |||
{ | |||
if ($options['name'] === self::MEMORY) { | |||
if (($options['name'] ?? '') === self::MEMORY) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This produced a notice when running tests (with error_reporting = E_ALL
in php.ini)
@@ -4,6 +4,12 @@ | |||
|
|||
<rule ref="CakePHP"/> | |||
|
|||
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests do not contain all necessary imports (uses) right now because without this PHPCS will complain.
I added the missing imports to MigrateTest and will leave the rest for someone else to clean up.
Fixes #2270.
In the end I chose to copy/adapt OutputStyle::getErrorOutput as a new protected method on the abstract command rather than using SymfonyStyle because:
I also fixed the exit code for the case where no aliases exist, applying the rule "error output -> exit code 1".