docker-php
docker-php copied to clipboard
pecl-event incompatible with Laravel
Bug ? Notice ?
pecl-event registers class Event::class
laravel has own "Facade" system and register Event as Illuminate\Support\Facades\Event::class
but can not, pecl-event has already done this
Laravel's Event::dispatch(something)
ends with error.
Hi @TKr, sorry for the issue. Can you help me reproduce? Can you please write which libraries are you installing and their versions? Maybe try attaching your composer.json
redacting anything that you don't want to share…?
I show this on php7.4 and laravel 6.X (but wersion do not matter in this case)
- docker run -it chialab/php:7.4 bash
- composer create-project --prefer-dist laravel/laravel test "6.*"
- cd test
- ./artisan tinker
- Event::dispatch()
PHP Error: Call to undefined method Event::dispatch() in Psy Shell code on line 1
should returnTypeError: Too few arguments to function Illuminate\Events\Dispatcher::dispatch(), 0 passed in ....
- class_parents(Event::class)
=> []
should return=> [ "Illuminate\Support\Facades\Facade" => "Illuminate\Support\Facades\Facade", ]
Instead of returning Laravel Facade Event class comes from extension
https://www.php.net/manual/en/class.event.php
I know. Facade is "invented" for laravel and good practice is to not use them. But unfortunately there is many projects which use it that way.
Example 2: event package removed from Dockerfile (mine local build):
Event comes from Laravel as expected
I don know is this a bug, which should be fixed, and event
extension removed. I just noticing that some frameworks with event
enabled my not working correctly.