akubiczek /
applicake-backend
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace App\Http\Middleware; |
||||
| 4 | |||||
| 5 | use App\Services\TenantManager; |
||||
| 6 | use Closure; |
||||
| 7 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
||||
| 8 | |||||
| 9 | class IdentifyTenant |
||||
| 10 | { |
||||
| 11 | /** |
||||
| 12 | * @var App\Services\TenantManager |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 13 | */ |
||||
| 14 | protected $tenantManager; |
||||
| 15 | |||||
| 16 | public function __construct(TenantManager $tenantManager) |
||||
| 17 | { |
||||
| 18 | $this->tenantManager = $tenantManager; |
||||
|
0 ignored issues
–
show
It seems like
$tenantManager of type App\Services\TenantManager is incompatible with the declared type App\Http\Middleware\App\Services\TenantManager of property $tenantManager.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||||
| 19 | } |
||||
| 20 | |||||
| 21 | /** |
||||
| 22 | * Handle an incoming request. |
||||
| 23 | * |
||||
| 24 | * @param \Illuminate\Http\Request $request |
||||
| 25 | * @param \Closure $next |
||||
| 26 | * |
||||
| 27 | * @return mixed |
||||
| 28 | */ |
||||
| 29 | public function handle($request, Closure $next) |
||||
| 30 | { |
||||
| 31 | if ($this->tenantManager->loadTenant($request->route('tenant'))) { |
||||
|
0 ignored issues
–
show
The method
route() does not exist on Illuminate\Http\Request.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||
| 32 | $request->route()->forgetParameter('tenant'); |
||||
| 33 | |||||
| 34 | return $next($request); |
||||
| 35 | } |
||||
| 36 | |||||
| 37 | throw new NotFoundHttpException('Tenant not found'); |
||||
| 38 | } |
||||
| 39 | } |
||||
| 40 |