Issues (185)

app/Http/Middleware/SilentlyIdentifyTenant.php (3 issues)

1
<?php
2
3
namespace App\Http\Middleware;
4
5
use App\Services\TenantManager;
6
use Closure;
7
8
class SilentlyIdentifyTenant
9
{
10
    /**
11
     * @var App\Services\TenantManager
0 ignored issues
show
The type App\Http\Middleware\App\Services\TenantManager was not found. Did you mean App\Services\TenantManager? If so, make sure to prefix the type with \.
Loading history...
12
     */
13
    protected $tenantManager;
14
15
    public function __construct(TenantManager $tenantManager)
16
    {
17
        $this->tenantManager = $tenantManager;
0 ignored issues
show
Documentation Bug introduced by
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...
18
    }
19
20
    /**
21
     * Handle an incoming request.
22
     *
23
     * @param \Illuminate\Http\Request $request
24
     * @param \Closure                 $next
25
     *
26
     * @return mixed
27
     */
28
    public function handle($request, Closure $next)
29
    {
30
        if ($this->tenantManager->loadTenantByUsername($request->get('email'))) {
0 ignored issues
show
The method get() 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 ignore-call  annotation

30
        if ($this->tenantManager->loadTenantByUsername($request->/** @scrutinizer ignore-call */ get('email'))) {

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...
31
            return $next($request);
32
        }
33
34
        return response('', 200);
35
    }
36
}
37