src/CoreBundle/Entity/Group.php
Avoid assigning values to variables in if clauses and the like (line '74', column '23'). Open
Open
public function removeRole(string $role): self
{
if (false !== $key = array_search(strtoupper($role), $this->roles, true)) {
unset($this->roles[$key]);
$this->roles = array_values($this->roles);
- 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
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Assert\NotBlank]
- Exclude checks
Missing function doc comment Open
Open
public function __toString(): string
- Exclude checks
Missing function doc comment Open
Open
public function getRoles(): array
- Exclude checks
Missing function doc comment Open
Open
public function __construct(
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[ORM\Column(name: 'id', type: 'integer')]
- Exclude checks
Missing function doc comment Open
Open
public function getTitle(): string
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[Assert\NotBlank]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[ORM\Column(name: 'code', type: 'string', length: 40, nullable: false, unique: true)]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[ORM\Entity]
- Exclude checks
Missing function doc comment Open
Open
public function removeRole(string $role): self
- Exclude checks
Add a single space around assignment operators Open
Open
declare(strict_types=1);
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'groups')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[ORM\Table(name: 'fos_group')]
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[ORM\Id]
- Exclude checks
You must use "/**" style comments for a class comment Open
Open
class Group implements Stringable
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[ORM\GeneratedValue(strategy: 'AUTO')]
- Exclude checks
The first parameter of a multi-line function declaration must be on the line after the opening bracket Open
Open
protected string $title,
- Exclude checks
Missing function doc comment Open
Open
public function setTitle(string $title): self
- Exclude checks
Missing function doc comment Open
Open
public function addRole(string $role): self
- Exclude checks
Missing function doc comment Open
Open
public function setCode(string $code): self
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[ORM\Column(name: 'roles', type: 'array')]
- Exclude checks
Missing function doc comment Open
Open
public function setRoles(array $roles): self
- Exclude checks
Missing function doc comment Open
Open
public function getCode(): string
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
Open
#[ORM\Column(name: 'title', type: 'string', length: 255, unique: true, nullable: false)]
- Exclude checks
Missing function doc comment Open
Open
public function hasRole(string $role): bool
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
protected array $roles = [
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
protected string $title,
- Exclude checks