src/CoreBundle/Controller/ResetPasswordController.php
The class ResetPasswordController has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. Open
Open
class ResetPasswordController extends AbstractController
{
use ResetPasswordControllerTrait;
private ResetPasswordHelperInterface $resetPasswordHelper;
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Avoid assigning values to variables in if clauses and the like (line '69', column '23'). Open
Open
public function checkEmail(): Response
{
// Generate a fake token if the user does not exist or someone hit this page directly.
// This prevents exposing whether or not a user was found with the given email address or not
if (null === ($resetToken = $this->getTokenObjectFromSession())) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
You must use "/**" style comments for a function comment Open
Open
public function request(Request $request, MailerInterface $mailer): Response
- Exclude checks
You must use "/**" style comments for a class comment Open
Open
class ResetPasswordController extends AbstractController
- Exclude checks
Missing function doc comment Open
Open
public function __construct(
- Exclude checks
Add a single space around assignment operators Open
Open
declare(strict_types=1);
- Exclude checks
You must use "/**" style comments for a function comment Open
Open
public function reset(Request $request, UserPasswordHasherInterface $passwordHasher, ?string $token = null): Response
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/reset-password')]
- Exclude checks
You must use "/**" style comments for a function comment Open
Open
public function checkEmail(): Response
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/reset/{token}', name: 'app_reset_password')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('', name: 'app_forgot_password_request')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Route('/check-email', name: 'app_check_email')]
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
private EntityManagerInterface $entityManager,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
private UserRepository $userRepository
- Exclude checks