lumen-framework: Laravel\Lumen\Application does not implement Illuminate\Contracts\Foundation\Application
- Lumen Version: 5.8
- PHP Version: any
- Database Driver & Version: any
Description:
Laravel\Lumen\Application is meant as a replacement for Illuminate\Foundation\Application, however, it doesn’t implement Illuminate\Contracts\Foundation\Application.
This causes certain DocBlocks to be inaccurate when a library is used with Lumen.
Additionally, some libraries use specific type-hinting, and these can fail in Lumen, even though there’s nothing in the code that would prevent Lumen from being used.
There’s nothing in Laravel Cashier’s code that prevents it from being compatible with Lumen, however this middleware can’t be used, because it requires that the $app be an implementation of Illuminate\Contracts\Foundation\Application, which Laravel\Lumen\Application is not.
Changes needed:
The following errors occur when Laravel\Lumen\Application implements Illuminate\Contracts\Foundation\Application:
-
PHP Fatal error: Declaration of Laravel\Lumen\Application::register($provider) must be compatible with Illuminate\Contracts\Foundation\Application::register($provider, $force = false) in /home/drj/repos/work/medology/raven/vendor/laravel/lumen-framework/src/Application.php on line 21 -
PHP Fatal error: Declaration of Laravel\Lumen\Application::registerDeferredProvider($provider) must be compatible with Illuminate\Contracts\Foundation\Application::registerDeferredProvider($provider, $service = NULL) in /home/drj/repos/work/medology/raven/vendor/laravel/lumen-framework/src/Application.php on line 21 -
PHP Fatal error: Class Laravel\Lumen\Application contains 5 abstract methods and must therefore be declared abstract or implement the remaining methods (Illuminate\Contracts\Foundation\Application::registerConfiguredProviders, Illuminate\Contracts\Foundation\Application::booting, Illuminate\Contracts\Foundation\Application::booted, ...) in /home/drj/repos/work/medology/raven/vendor/laravel/lumen-framework/src/Application.php on line 21
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 22 (11 by maintainers)
@driesvints The issue isn’t about making Lumen compatible with Cashier. That would be a side effect, but it’s not the issue. The issue is making Lumen more compatible with Laravel.
There are many places in the Laravel codebase in which
$appis typed (in DocBlock) asIlluminate\Foundation\Application|Illuminate\Contracts\Foundation\Application, butLaravel\Lumen\Applicationis neither of those. HavingLaravel\Lumen\Applicationimplement that interface would fix this.@goodevilgenius currently a bit swamped but will try to take a look next thursday
@lloricode I just checked - everything seems to work now!