Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
[5.8] Add view path to end of compiled blade view #28117
The main difference with this approach is that it takes into account the issue from #27996. By not introducing a newline it doesn't changes anything to the rendered view itself. The path is now applied as the final piece of code. This doesn't allows IDE's to rely on it being the last line though. Instead we use
@bzixilu this would provide a "unique" way for PHPStorm to pick up the path. I suspect changes on PHPStorm's end are needed to make this work. But you could, in theory, always rely on the path being between the
Hi all, thank you for taking care of the debug feature.
Both suggested variants - encoding of a view path into a compiled view filename as well as the movement of the debug info to the line above - will work to provide a debug info to PhpStorm since we can in both cases somehow retrieve a view path from a compiled view. Each of the proposed solutions requires changes from our side that we will be able to provide only in PhpStorm 2019.1.1. But that is ok. Completely losing the feature is much worst.
Below are a couple of thoughts about base64 encoding.
Base64 encoding works in both directions, so in the future, we will be able to provide the additional info, e.g., line mappings that can also be easily decoded for the debug needs (I would avoid one-way encryption for our purposes).
But there are a few things that should be taken into account if you choose this way:
Maybe there is something else that didn't come up to my mind.
To summarize, I would vote for the human-readable comment like you've implemented in this PR.
Apr 5, 2019
referenced this pull request
Apr 5, 2019
This looks like it produces invalid files for blade views ending with an open php block. I believe the fix is to check if there's an open php block, and close it before appending the path comment.
To be clear, here's an example file of what I mean:
This file becomes