Backoffice/Form/Type/Component/KeywordsChoiceType.php
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
CsvToReferenceKeywordTransformer $csvToReferenceKeywordTransformer,
ConditionToReferenceKeywordTransformer $conditionToReferenceKeywordTransformer,
KeywordRepositoryInterface $keywordRepository,
RouterInterface $router,
AuthorizationCheckerInterface $authorizationChecker
- Create a ticketCreate a ticket
The method buildForm uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
Open
else {
$builder->addModelTransformer($this->csvToReferenceKeywordTransformer);
}
- 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
Parameter $router
has undeclared type \Symfony\Component\Routing\RouterInterface
Open
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method findAll
from undeclared class \OpenOrchestra\ModelInterface\Repository\KeywordRepositoryInterface
Open
Open
$keywords = $this->keywordRepository->findAll();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $keywordRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\KeywordRepositoryInterface
Open
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method isGranted
from undeclared class \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface
Open
Open
$isGranted = $this->authorizationChecker->isGranted(ContributionActionInterface::CREATE, KeywordInterface::ENTITY_TYPE);
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \Symfony\Component\Form\AbstractType
Open
Open
class KeywordsChoiceType extends AbstractType
- Create a ticketCreate a ticket
- Exclude checks
Parameter $authorizationChecker
has undeclared type \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface
Open
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Suspicious array access to \Symfony\Component\OptionsResolver\Options
Open
Open
$default['class'] = $options['is_condition'] ? 'select-boolean' : 'select2';
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant ENTITY_TYPE
from undeclared class \OpenOrchestra\ModelInterface\Model\KeywordInterface
Open
Open
$isGranted = $this->authorizationChecker->isGranted(ContributionActionInterface::CREATE, KeywordInterface::ENTITY_TYPE);
- Create a ticketCreate a ticket
- Exclude checks
Call to method addModelTransformer
from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open
Open
$builder->addModelTransformer($this->conditionToReferenceKeywordTransformer);
- Create a ticketCreate a ticket
- Exclude checks
Call to method generate
from undeclared class \Symfony\Component\Routing\RouterInterface
Open
Open
'data-check' => $this->router->generate('open_orchestra_api_check_keyword', array()),
- Create a ticketCreate a ticket
- Exclude checks
Parameter $options
has undeclared type \Symfony\Component\OptionsResolver\Options
Open
Open
'attr' => function(Options $options) use ($isGranted) {
- Create a ticketCreate a ticket
- Exclude checks
Suspicious array access to \Symfony\Component\OptionsResolver\Options
Open
Open
return array_replace($default, $options['new_attr']);
- 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
Parameter $resolver
has undeclared type \Symfony\Component\OptionsResolver\OptionsResolver
Open
Open
public function configureOptions(OptionsResolver $resolver)
- Create a ticketCreate a ticket
- Exclude checks
Call to method addModelTransformer
from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open
Open
$builder->addModelTransformer($this->csvToReferenceKeywordTransformer);
- 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
Avoid excessively long variable names like $csvToReferenceKeywordTransformer. Keep variable name length under 20. Open
Open
protected $csvToReferenceKeywordTransformer;
- 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 $conditionToReferenceKeywordTransformer. Keep variable name length under 20. Open
Open
protected $conditionToReferenceKeywordTransformer;
- 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 $conditionToReferenceKeywordTransformer. Keep variable name length under 20. Open
Open
ConditionToReferenceKeywordTransformer $conditionToReferenceKeywordTransformer,
- 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 $csvToReferenceKeywordTransformer. Keep variable name length under 20. Open
Open
CsvToReferenceKeywordTransformer $csvToReferenceKeywordTransformer,
- 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
There must be a single space between the closing parenthesis and the opening brace of a multi-line function declaration; found 0 spaces Open
Open
){
- Create a ticketCreate a ticket
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
Open
'attr' => function(Options $options) use ($isGranted) {
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
Open
$isGranted = $this->authorizationChecker->isGranted(ContributionActionInterface::CREATE, KeywordInterface::ENTITY_TYPE);
- Create a ticketCreate a ticket
- Exclude checks
Expected 1 space after closing brace; newline found Open
Open
}
- Create a ticketCreate a ticket
- Exclude checks