Colliding class names in view imports
Let's say one view imports App\Book and another view imports App\Models\Book. Both imports will be combined in the final rendered view, and will then collide. The solution is for the user to import one or both as aliases, but there should also be a clear error explaining them what to do
How about adding a self-healing feature, optionally enabling Tempest's view renderer to automatically generate aliases for any conflicting classes based on their FQCN? Not sure whether this should be enabled or disabled by default, though.
I very much like @xHeaven's solution
I'm playing with that idea as well, I'm not sure how easy it would be and how many edge cases we'd run into, but it might be worth exploring. I don't think it should be opt-in though.
Another idea I had is instead of combining imports at the top of each file, to open a new scope for every component and view and keep the imports scoped to that scope. But apparently, namespaces cannot be nested :(
I'm playing with that idea as well, I'm not sure how easy it would be and how many edge cases we'd run into, but it might be worth exploring. I don't think it should be opt-in though.
Another idea I had is instead of combining imports at the top of each file, to open a new scope for every component and view and keep the imports scoped to that scope. But apparently, namespaces cannot be nested :(
I don't think it'd be hard, I made a PoC yesterday, I can make it into a viable MVP and open a PR if needed.
Sure, sounds great!