rector icon indicating copy to clipboard operation
rector copied to clipboard

Explore way Rector or another tool can process blade templates

Open TomasVotruba opened this issue 1 year ago • 2 comments

This is one of pain points when using Rector with Laravel. It works well on PHP code, but fails on Blade.

Often Blade uses simle structures like PHP functions calls, that ought to be refactored.

Ref: https://x.com/_damms005/status/1802693660405866911

Brainstorm ideas:

  • have a separate command for blade templates
  • it would run Rector in a simple way, parsing only code inside {{ ... }}, and @php tags
  • it would not reprint the whole file, but a just these snippets using str_replace

TomasVotruba avatar Jun 20 '24 01:06 TomasVotruba

Is there a way to help out with this? I'm currently running into this missing feature of Rector

megawubs avatar Jul 10 '24 08:07 megawubs

I made a WIP few weeks ago, but it needs more work ↓

Here it is :) https://github.com/rectorphp/rector-src/pull/6136

TomasVotruba avatar Jul 10 '24 10:07 TomasVotruba

Not a priority atm

TomasVotruba avatar Mar 20 '25 09:03 TomasVotruba