TwigBridge icon indicating copy to clipboard operation
TwigBridge copied to clipboard

Quick'n'Dirty fix for command reflection exceptions after upgrading to 5.5-dev branch of Laravel

Open renebakx opened this issue 7 years ago • 8 comments

I just noticed that the package breaks with 5.5-dev because the fire method was changed into handle. (see https://laravel.com/docs/master/upgrade)

[ReflectionException]
Method TwigBridge\Command\TwigBridge::handle() does not exist

I'am not a hardcore Laravel developer, but adding this to the 3 commands (TwigBridge,Clean and Lint) fixed my reflection errors after I upgraded from 5.4 -> 5.5 issue.

Guess this way the same package can be used by 5.4 and 5.5.

public function handle() {
    return $this->fire();
  }

renebakx avatar Aug 13 '17 15:08 renebakx

Can you make a PR to rename to fire?

barryvdh avatar Aug 14 '17 08:08 barryvdh

Really? A PR for a change that can be done using the github editor?

To be honest, it would take me more time to clone, setup local git, change code, push it and make a pull request than it would take somebody with write access on this repo to open the 3 files and change the name of the method ;)

renebakx avatar Aug 14 '17 08:08 renebakx

You can make the edits through the github editor also. Just edit the file and choose to fork it. Then go to your repo to the patch-x branch, edit the other files and click the PR button.

barryvdh avatar Aug 14 '17 09:08 barryvdh

Come to think of it, renaming the methods would cause more damage then adding the above code since renaming would render the bridge useless for projects that can't make the move to 5.5.

renebakx avatar Aug 14 '17 09:08 renebakx

I think older versions support both names.

barryvdh avatar Aug 14 '17 09:08 barryvdh

This commit to Laravel is the first instance of both fire and handle being acceptable: https://github.com/laravel/framework/commit/970836c5368642d975c56aa71f8aecafddcd3fd8#diff-2aaa23817a4aeafde63888bd631364e7

This change seems to have been applicable since Laravel 5.0.0 (up until the current version of Laravel, 5.5 of course).

With this, would it be best to just go with the pull request garret-gunter pushed, or change the method names from fire to handle?

StevenMHernandez avatar Nov 03 '17 15:11 StevenMHernandez

Hi, can you fix(rename fire->handle) it and release new version ?

for twig:lint and twig:clean Method TwigBridge\Command\Lint::handle() does not exist

now it;s not possible to use TwigBridge package in newest Laravel 5.5 because alias handle>fire disappeared.

Thx

gulios avatar Nov 13 '17 12:11 gulios

Hi I have the same issue. Laravel 5.5 doesn't support the fire() method. Please, fix it

greatkir avatar Jan 17 '18 08:01 greatkir