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

[8.x] Add newLine() method to InteractsWithIO trait #34754

merged 2 commits into from Oct 8, 2020


Copy link

@squatto squatto commented Oct 8, 2020

When generating output in artisan commands and needing to output a blank line, I am constantly finding myself doing things like this:

$this->info('Parsing CSV file');

// or:

$this->info("\nParsing CSV file\n");

// or even worse:

$this->info(PHP_EOL . "Parsing CSV file" . PHP_EOL);

You can do it the "right" way by calling the newLine() method defined in the Symfony console StyleInterface:


That feel's a bit too verbose/heavy though. This PR simply makes the newLine() method directly accessible from the command itself:


Doing it this way ensures that the newline is output according to the current OutputStyle.

No tests are included in the PR because I wasn't able to find any existing tests that checked command output.

Copy link
Contributor Author

@squatto squatto commented Oct 8, 2020

Given that this is a simple change that would most definitely be backward-compatible with 7.x, I'd be happy to submit a PR to that branch as well.

@driesvints driesvints changed the title Add newLine() method to InteractsWithIO trait [8.x] Add newLine() method to InteractsWithIO trait Oct 8, 2020
Copy link

@driesvints driesvints commented Oct 8, 2020

@squatto 7.x isn't maintained anymore.

@taylorotwell taylorotwell merged commit 5408874 into laravel:8.x Oct 8, 2020
7 checks passed
@squatto squatto deleted the add-newline-method-to-io branch Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants