Skip to content
Snippets Groups Projects
Commit 9bee2b63 authored by Camille Simiand's avatar Camille Simiand
Browse files

Increase and fix errors phpstan level 7

parent 6091e5b2
No related branches found
No related tags found
1 merge request!27tuleap-108-add-stricter-code-quality-tools-configuration
Pipeline #667 passed
parameters:
level: 6
level: 7
paths:
- tests/
symfony:
......
parameters:
level: 6
level: 7
paths:
- src/
symfony:
......
......@@ -12,7 +12,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Address;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\Routing\Annotation\Route;
use SymfonyCasts\Bundle\ResetPassword\Controller\ResetPasswordControllerTrait;
......@@ -102,6 +101,9 @@ class ResetPasswordController extends AbstractController
try {
$user = $this->resetPasswordHelper->validateTokenAndFetchUser($token);
if (! $user instanceof User) {
throw new \Exception("User should be an instance of UserPasswordHasherInterface");
}
} catch (ResetPasswordExceptionInterface $e) {
$this->addFlash('reset_password_error', sprintf(
'There was a problem validating your reset request - %s',
......
......@@ -30,6 +30,7 @@ class ResetPasswordRequestRepository extends ServiceEntityRepository implements
string $selector,
string $hashedToken
): ResetPasswordRequestInterface {
/** @phpstan-ignore-next-line */
return new ResetPasswordRequest($user, $expiresAt, $selector, $hashedToken);
}
}
......@@ -32,14 +32,15 @@ class AppCustomAuthenticator extends AbstractLoginFormAuthenticator
public function authenticate(Request $request): PassportInterface
{
$email = $request->request->get('email', '');
$password = $request->request->get('password', '');
$request->getSession()->set(Security::LAST_USERNAME, $email);
return new Passport(
new UserBadge($email),
new PasswordCredentials($request->request->get('password', '')),
new UserBadge((string) $email),
new PasswordCredentials((string) $password),
[
new CsrfTokenBadge('authenticate', $request->request->get('_csrf_token')),
new CsrfTokenBadge('authenticate', (string) $request->request->get('_csrf_token')),
]
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment