Issues (2)

EloquentUserProviderWithPasswordUpdate.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace SamAsEnd\NeedsAutoRehash\Providers;
4
5
use Illuminate\Auth\EloquentUserProvider;
6
use Illuminate\Contracts\Auth\Authenticatable;
7
8
class EloquentUserProviderWithPasswordUpdate extends EloquentUserProvider implements ProviderWithPasswordUpdate
9
{
10 2
    public function __construct(EloquentUserProvider $provider)
11
    {
12 2
        parent::__construct($provider->hasher, $provider->model);
13 2
    }
14
15 2
    public function updatePassword(Authenticatable $user, $plainPassword)
16
    {
17 2
        $user->password = $this->hasher->make($plainPassword);
0 ignored issues
show
Accessing password on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
18
19 2
        $timestamps = $user->timestamps;
0 ignored issues
show
Accessing timestamps on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
20
21 2
        $user->timestamps = false;
22
23 2
        $user->save();
24
25 2
        $user->timestamps = $timestamps;
26 2
    }
27
}
28