Backoffice/EventSubscriber/RedirectionTypeSubscriber.php
Avoid assigning values to variables in if clauses and the like (line '25', column '28'). Open
Open
public function postSubmit(FormEvent $event)
{
$form = $event->getForm();
/** @var RedirectionInterface $data */
$data = $event->getData();
- Read upRead up
- Create a ticketCreate a ticket
- 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
Parameter $event
has undeclared type \Symfony\Component\Form\FormEvent
Open
Open
public function postSubmit(FormEvent $event)
- Create a ticketCreate a ticket
- Exclude checks
Class implements undeclared interface \Symfony\Component\EventDispatcher\EventSubscriberInterface
Open
Open
class RedirectionTypeSubscriber implements EventSubscriberInterface
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
Open
if ($data instanceof RedirectionInterface) {
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant POST_SUBMIT
from undeclared class \Symfony\Component\Form\FormEvents
Open
Open
FormEvents::POST_SUBMIT => 'postSubmit',
- Create a ticketCreate a ticket
- Exclude checks
Call to method setSiteName
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
Open
$data->setSiteName($siteName);
- Create a ticketCreate a ticket
- Exclude checks
Call to method getData
from undeclared class \Symfony\Component\Form\FormEvent
Open
Open
$data = $event->getData();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
Open
if (false !== ($siteName = array_search($data->getSiteId(), $form->get('siteId')->getConfig()->getOption('choices')))) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getForm
from undeclared class \Symfony\Component\Form\FormEvent
Open
Open
$form = $event->getForm();
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
Open
if (false !== ($siteName = array_search($data->getSiteId(), $form->get('siteId')->getConfig()->getOption('choices')))) {
- Create a ticketCreate a ticket
- Exclude checks