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

[9.x] Avoid matching multi-line imports in GenerateCommand stub templates #43093

Merged
merged 1 commit into from
Jul 12, 2022

Conversation

n8man
Copy link
Contributor

@n8man n8man commented Jul 7, 2022

Sorting of multi-line use-imports are broken in *.stub templates.

Input:

use Illuminate\Foundation\Testing\{
    DatabaseTransactions,
    WithFaker,
};

Results in output:

    DatabaseTransactions,
    WithFaker,
use Illuminate\Foundation\Testing\{
};

This regex change avoids matching multi-line use-imports. It's an improvement in that the rendered stub is no longer generating invalid php code. The downside is that sorting will not include any multi-line imports.

Multi-line imports are broken:
```
use Illuminate\Foundation\Testing\{
    DatabaseTransactions,
    WithFaker,
};
```
Results in output:
```
    DatabaseTransactions,
    WithFaker,
use Illuminate\Foundation\Testing\{
};
```
@n8man n8man changed the title Avoid matching multi-line imports Avoid matching multi-line imports in GenerateCommand stub templates Jul 7, 2022
@taylorotwell taylorotwell merged commit ca490ca into laravel:9.x Jul 12, 2022
@n8man n8man deleted the stub-multi-import branch July 12, 2022 15:45
@GrahamCampbell GrahamCampbell changed the title Avoid matching multi-line imports in GenerateCommand stub templates [9.x] Avoid matching multi-line imports in GenerateCommand stub templates Jul 14, 2022
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.

2 participants