Function buildForm
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$configuration = array();
$maxColumns = 0;
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method buildForm
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$configuration = array();
$maxColumns = 0;
- Create a ticketCreate a ticket
Function buildView
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function buildView(FormView $view, FormInterface $form, array $options)
{
foreach ($this->groupRolesConfiguration as $fieldset => $tableConfiguration) {
foreach ($tableConfiguration as $table => $configuration) {
if (!empty($configuration)) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid unused parameters such as '$form'. Open
public function buildView(FormView $view, FormInterface $form, array $options)
- Read upRead up
- Create a ticketCreate a ticket
- 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 unused parameters such as '$options'. Open
public function buildForm(FormBuilderInterface $builder, array $options)
- Read upRead up
- Create a ticketCreate a ticket
- 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 unused local variables such as '$fieldset'. Open
foreach ($this->groupRolesConfiguration as $fieldset => $tables) {
- Read upRead up
- Create a ticketCreate a ticket
- 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
Avoid unused parameters such as '$options'. Open
public function buildView(FormView $view, FormInterface $form, array $options)
- Read upRead up
- Create a ticketCreate a ticket
- 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
Parameter $translator
has undeclared type \Symfony\Component\Translation\TranslatorInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method trans
from undeclared class \Symfony\Component\Translation\TranslatorInterface
Open
$configuration[$tableName]['column'][$chekListName] = $this->translator->trans('open_orchestra_backoffice.form.role.' . $chekListName);
- Create a ticketCreate a ticket
- Exclude checks
Call to method trans
from undeclared class \Symfony\Component\Translation\TranslatorInterface
Open
$configuration[$tableName]['row'][] = $this->translator->trans($columnConfiguration['label']);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $view
has undeclared type \Symfony\Component\Form\FormView
Open
public function buildView(FormView $view, FormInterface $form, array $options)
- Create a ticketCreate a ticket
- Exclude checks
Call to method trans
from undeclared class \Symfony\Component\Translation\TranslatorInterface
Open
$configuration[$tableName]['help'][] = $this->translator->trans($columnConfiguration['help']);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $builder
has undeclared type \Symfony\Component\Form\FormBuilderInterface
Open
public function buildForm(FormBuilderInterface $builder, array $options)
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property vars
from undeclared class \Symfony\Component\Form\FormView
Open
$view->vars['configuration'][$fieldset][] = $table;
- Create a ticketCreate a ticket
- Exclude checks
Call to method add
from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open
$builder
- Create a ticketCreate a ticket
- Exclude checks
Parameter $form
has undeclared type \Symfony\Component\Form\FormInterface
Open
public function buildView(FormView $view, FormInterface $form, array $options)
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \Symfony\Component\Form\AbstractType
Open
class GroupRoleType extends AbstractType
- Create a ticketCreate a ticket
- Exclude checks
Avoid excessively long variable names like $groupRolesConfiguration. Keep variable name length under 20. Open
protected $groupRolesConfiguration;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $groupRolesConfiguration. Keep variable name length under 20. Open
array $groupRolesConfiguration
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Line exceeds 120 characters; contains 159 characters Open
$configuration[$tableName]['column'][$chekListName] = $this->translator->trans('open_orchestra_backoffice.form.role.' . $chekListName);
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$configuration[$tableName]['help'][] = $this->translator->trans($columnConfiguration['help']);
- Create a ticketCreate a ticket
- Exclude checks