Backoffice/EventSubscriber/ContentTypeStatusableSubscriber.php
The method preSubmit uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
Open
} else {
$status = $this->statusRepository->findOneByOutOfWorkflow();
}
- 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
Call to method findOneByOutOfWorkflow
from undeclared class \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open
Open
$status = $this->statusRepository->findOneByOutOfWorkflow();
- Create a ticketCreate a ticket
- Exclude checks
Call to method isDefiningStatusable
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open
Open
&& $contentType->isDefiningStatusable() != $data['definingStatusable']
- Create a ticketCreate a ticket
- Exclude checks
Parameter $event
has undeclared type \Symfony\Component\Form\FormEvent
Open
Open
public function preSubmit(FormEvent $event)
- 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 updateStatusByContentType
from undeclared class \OpenOrchestra\ModelInterface\Repository\ContentRepositoryInterface
Open
Open
$this->contentRepository->updateStatusByContentType($status, $contentType->getContentTypeId());
- Create a ticketCreate a ticket
- Exclude checks
Class implements undeclared interface \Symfony\Component\EventDispatcher\EventSubscriberInterface
Open
Open
class ContentTypeStatusableSubscriber implements EventSubscriberInterface
- Create a ticketCreate a ticket
- Exclude checks
Call to method findOneByInitial
from undeclared class \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open
Open
$status = $this->statusRepository->findOneByInitial();
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant PRE_SUBMIT
from undeclared class \Symfony\Component\Form\FormEvents
Open
Open
FormEvents::PRE_SUBMIT => 'preSubmit',
- Create a ticketCreate a ticket
- Exclude checks
Parameter $contentRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\ContentRepositoryInterface
Open
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Parameter $statusRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method getContentTypeId
from undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open
Open
$this->contentRepository->updateStatusByContentType($status, $contentType->getContentTypeId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getForm
from undeclared class \Symfony\Component\Form\FormEvent
Open
Open
$contentType = $event->getForm()->getData();
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open
Open
if ($contentType instanceof ContentTypeInterface
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
Open
$data['definingStatusable'] = !array_key_exists('definingStatusable', $data) ? false : $data['definingStatusable'];
- Create a ticketCreate a ticket
- Exclude checks