Skip to content

Conversation

osbre
Copy link
Contributor

@osbre osbre commented Apr 17, 2025

PHP natively supports group imports since PHP 7.0:

use MySpace\{Foo, Bar};

Currently, the @use directive mistakenly treats these as aliases. For example,

@use(MySpace\{Foo, Bar})

Results in:

use MySpace\Foo as Bar.

This PR fixes it so that the blade code above, produces output equal to PHP's original feature:

use MySpace\{Foo, Bar};

@osbre osbre marked this pull request as draft April 17, 2025 21:22
@osbre
Copy link
Contributor Author

osbre commented Apr 17, 2025

Marking as draft since this PR currently breaks some behaviour that wasn't covered by tests. I have made a fix to the tests to document the behaviour that this PR would've broken: #55462

@osbre osbre force-pushed the fix/blade-@use-grouping branch from 0c06ba3 to 1865edd Compare April 18, 2025 19:37
@osbre osbre force-pushed the fix/blade-@use-grouping branch from 1865edd to db8f790 Compare April 18, 2025 19:39
@osbre
Copy link
Contributor Author

osbre commented Apr 18, 2025

Alright. Updated, now nothing breaks.

@osbre osbre marked this pull request as ready for review April 18, 2025 19:43
@taylorotwell taylorotwell merged commit c01bb8d into laravel:12.x Apr 18, 2025
1 check passed
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