Backoffice/Form/Type/Extension/CollectionExtension.php
The method buildView uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
Open
} else {
$view->vars['attr'] = array_merge_recursive($view->vars['attr'], array('class' => 'collection-sortable'));
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid unused parameters such as '$form'. Open
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 $resolver
has undeclared type \Symfony\Component\OptionsResolver\OptionsResolver
Open
Open
public function configureOptions(OptionsResolver $resolver)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $form
has undeclared type \Symfony\Component\Form\FormInterface
Open
Open
public function buildView(FormView $view, FormInterface $form, array $options)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $builder
has undeclared type \Symfony\Component\Form\FormBuilderInterface
Open
Open
public function buildForm(FormBuilderInterface $builder, array $options)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $view
has undeclared type \Symfony\Component\Form\FormView
Open
Open
public function buildView(FormView $view, FormInterface $form, array $options)
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property vars
from undeclared class \Symfony\Component\Form\FormView
Open
Open
if (array_key_exists('class', $view->vars['attr'])) {
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property vars
from undeclared class \Symfony\Component\Form\FormView
Open
Open
$view->vars['sortable'] = true;
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \Symfony\Component\Form\AbstractTypeExtension
Open
Open
class CollectionExtension extends AbstractTypeExtension
- Create a ticketCreate a ticket
- Exclude checks
Call to method addEventSubscriber
from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open
Open
$builder->addEventSubscriber(new SortableCollectionSubscriber());
- Create a ticketCreate a ticket
- Exclude checks
Call to method setDefaults
from undeclared class \Symfony\Component\OptionsResolver\OptionsResolver
Open
Open
$resolver->setDefaults(array(
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property vars
from undeclared class \Symfony\Component\Form\FormView
Open
Open
$view->vars['attr']['class'] = $view->vars['attr']['class'] . ' collection-sortable';
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property vars
from undeclared class \Symfony\Component\Form\FormView
Open
Open
$view->vars['attr'] = array_merge_recursive($view->vars['attr'], array('class' => 'collection-sortable'));
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
Open
$view->vars['attr'] = array_merge_recursive($view->vars['attr'], array('class' => 'collection-sortable'));
- Create a ticketCreate a ticket
- Exclude checks