open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/Form/Type/Component/NodeChoiceType.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused parameters such as '$form'.
Open

    public function buildView(FormView $view, FormInterface $form ,array $options)

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

Class extends undeclared class \Symfony\Component\Form\AbstractType
Open

class NodeChoiceType extends AbstractType

Call to method setDefaults from undeclared class \Symfony\Component\OptionsResolver\OptionsResolver
Open

        $resolver->setDefaults(

Parameter $resolver has undeclared type \Symfony\Component\OptionsResolver\OptionsResolver
Open

    public function configureOptions(OptionsResolver $resolver)

Reference to instance property vars from undeclared class \Symfony\Component\Form\FormView
Open

        $view->vars['choices'] = $result;

Reference to constant ROOT_NODE_ID from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open

        $orderedNodes = $this->nodeRepository->findTreeNode($siteId, $language, NodeInterface::ROOT_NODE_ID);

Call to method __construct from undeclared class \Symfony\Component\Form\ChoiceList\View\ChoiceView
Open

            $result[] = new ChoiceView(

Parameter $form has undeclared type \Symfony\Component\Form\FormInterface
Open

    public function buildView(FormView $view, FormInterface $form ,array $options)

Call to method findTreeNode from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open

        $orderedNodes = $this->nodeRepository->findTreeNode($siteId, $language, NodeInterface::ROOT_NODE_ID);

Parameter $options has undeclared type \Symfony\Component\OptionsResolver\Options
Open

                'choices' => function(Options $options) {

Parameter $nodeRepository has undeclared type \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open

    public function __construct(NodeRepositoryInterface $nodeRepository, ContextBackOfficeInterface $currentSiteManager)

Suspicious array access to \Symfony\Component\OptionsResolver\Options
Open

                    return $this->getChoices($options['siteId'], $options['language']);

Parameter $view has undeclared type \Symfony\Component\Form\FormView
Open

    public function buildView(FormView $view, FormInterface $form ,array $options)

Reference to constant ROOT_NODE_ID from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open

        $orderedNodes = $this->nodeRepository->findTreeNode($options['siteId'], $options['language'], NodeInterface::ROOT_NODE_ID);

Call to method findTreeNode from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open

        $orderedNodes = $this->nodeRepository->findTreeNode($options['siteId'], $options['language'], NodeInterface::ROOT_NODE_ID);

Reference to instance property vars from undeclared class \Symfony\Component\Form\FormView
Open

        foreach ($view->vars['choices'] as $node) {

Avoid excessively long variable names like $orderedNodesAttributs. Keep variable name length under 20.
Open

        $orderedNodesAttributs = $this->getHierarchicalChoicesAttributes($orderedNodes);

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

Expected 0 spaces between argument "$form" and comma; 1 found
Open

    public function buildView(FormView $view, FormInterface $form ,array $options)

Expected 1 space between comma and type hint "array"; 0 found
Open

    public function buildView(FormView $view, FormInterface $form ,array $options)

Function closing brace must go on the next line following the body; found 1 blank lines before brace
Open

    }

Function closing brace must go on the next line following the body; found 1 blank lines before brace
Open

    }

Expected 1 space after FUNCTION keyword; 0 found
Open

                'choices' => function(Options $options) {

Line exceeds 120 characters; contains 131 characters
Open

        $orderedNodes = $this->nodeRepository->findTreeNode($options['siteId'], $options['language'], NodeInterface::ROOT_NODE_ID);

There are no issues that match your filters.

Category
Status