Skip to content
Snippets Groups Projects
Commit 31dce88d authored by Camille Simiand's avatar Camille Simiand Committed by Sebastien
Browse files

Increase and fix errors phpstan level 7

parent e933c09c
Branches
Tags
3 merge requests!43tuleap-83-access-my-capsules,!42Draft: access-my-capsules-conflicts-fixed,!40Draft: Tuleap 83 access my capsules
parameters: parameters:
level: 6 level: 7
paths: paths:
- tests/ - tests/
symfony: symfony:
......
parameters: parameters:
level: 6 level: 7
paths: paths:
- src/ - src/
symfony: symfony:
......
...@@ -12,7 +12,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse; ...@@ -12,7 +12,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Address;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use SymfonyCasts\Bundle\ResetPassword\Controller\ResetPasswordControllerTrait; use SymfonyCasts\Bundle\ResetPassword\Controller\ResetPasswordControllerTrait;
...@@ -102,6 +101,9 @@ class ResetPasswordController extends AbstractController ...@@ -102,6 +101,9 @@ class ResetPasswordController extends AbstractController
try { try {
$user = $this->resetPasswordHelper->validateTokenAndFetchUser($token); $user = $this->resetPasswordHelper->validateTokenAndFetchUser($token);
if (! $user instanceof User) {
throw new \Exception("User should be an instance of UserPasswordHasherInterface");
}
} catch (ResetPasswordExceptionInterface $e) { } catch (ResetPasswordExceptionInterface $e) {
$this->addFlash('reset_password_error', sprintf( $this->addFlash('reset_password_error', sprintf(
'There was a problem validating your reset request - %s', 'There was a problem validating your reset request - %s',
......
...@@ -30,6 +30,7 @@ class ResetPasswordRequestRepository extends ServiceEntityRepository implements ...@@ -30,6 +30,7 @@ class ResetPasswordRequestRepository extends ServiceEntityRepository implements
string $selector, string $selector,
string $hashedToken string $hashedToken
): ResetPasswordRequestInterface { ): ResetPasswordRequestInterface {
/** @phpstan-ignore-next-line */
return new ResetPasswordRequest($user, $expiresAt, $selector, $hashedToken); return new ResetPasswordRequest($user, $expiresAt, $selector, $hashedToken);
} }
} }
...@@ -32,14 +32,15 @@ class AppCustomAuthenticator extends AbstractLoginFormAuthenticator ...@@ -32,14 +32,15 @@ class AppCustomAuthenticator extends AbstractLoginFormAuthenticator
public function authenticate(Request $request): PassportInterface public function authenticate(Request $request): PassportInterface
{ {
$email = $request->request->get('email', ''); $email = $request->request->get('email', '');
$password = $request->request->get('password', '');
$request->getSession()->set(Security::LAST_USERNAME, $email); $request->getSession()->set(Security::LAST_USERNAME, $email);
return new Passport( return new Passport(
new UserBadge($email), new UserBadge((string) $email),
new PasswordCredentials($request->request->get('password', '')), 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