Showing 83 of 83 total issues
Avoid variables with short names like $em. Configured minimum length is 3. Open
Open
$em = $this->doctrine->getManager();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $em. Configured minimum length is 3. Open
Open
$em = $this->doctrine->getManager();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
Open
public $id;
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
Open
public function setId($id): self
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid unused parameters such as '$options'. Open
Open
public function buildForm(FormBuilderInterface $builder, array $options): void
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid assigning values to variables in if clauses and the like (line '75', column '23'). Open
Open
public function removeRole(string $role): self
{
if (false !== $key = array_search(strtoupper($role), $this->roles, true))
{
unset($this->roles[$key]);
- 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
Avoid unused local variables such as '$config'. Open
Open
$config = $this->processConfiguration($configuration, $configs);
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Expected 1 space after closing parenthesis; found 9 Open
Open
if ($this->isGranted('IS_AUTHENTICATED_FULLY'))
- Exclude checks
Expected 1 space after closing parenthesis; found 9 Open
Open
if (!in_array($role, $this->roles, true))
- Exclude checks
Expected 1 space after closing parenthesis; found 9 Open
Open
if (false !== $key = array_search(strtoupper($role), $this->roles, true))
- Exclude checks
Expected 1 space after closing parenthesis; found 9 Open
Open
if ($form->isSubmitted() && $form->isValid())
- Exclude checks
Expected 1 space after closing parenthesis; found 9 Open
Open
if ($role === BaseUser::ROLE_DEFAULT)
- Exclude checks
Parameter $user
has undeclared type \Symfony\Component\Security\Core\User\UserInterface
Open
Open
public function isEqualTo(UserInterface $user): bool
- Exclude checks
Reference to constant class
from undeclared class \Symfony\Component\Form\Extension\Core\Type\SubmitType
Open
Open
$builder->add('submit', SubmitType::class);
- Exclude checks
Call to undeclared method \PlumeSolution\UserBundle\Controllers\LoginController::redirectToRoute
Open
Open
return $this->redirectToRoute('index');
- Exclude checks
Call to method createView
from undeclared class \Symfony\Component\Form\FormInterface
Open
Open
return $this->render('@PSUser/Login/login.html.twig', ['form' => $form->createView()]);
- Exclude checks
Reference to undeclared property \PlumeSolution\UserBundle\Credentials\NicknamePasswordTrait->nickname
Open
Open
return $this->nickname;
- Exclude checks
Call to method add
from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open
Open
$builder->add('remember', CheckboxType::class);
- Exclude checks
Call to method add
from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open
Open
$builder->add('submit', SubmitType::class);
- Exclude checks
Reference to undeclared property \PlumeSolution\UserBundle\Fields\EqualTrait->nickname
Open
Open
$this->nickname,
- Exclude checks