Backoffice/GeneratePerimeter/Strategy/NodeGeneratePerimeterStrategy.php
The method formatConfiguration uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
Open
} else {
$children = $treeNodes['child'];
unset($treeNodes['child']);
foreach ($children as $child) {
$treeNodes['children'][] = $this->formatConfiguration($child);
- 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
Reference to constant ENTITY_TYPE
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
return NodeInterface::ENTITY_TYPE;
- Create a ticketCreate a ticket
- Exclude checks
Call to method findTreeNode
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
Open
$treeNodes = $this->nodeRepository->findTreeNode(
- Create a ticketCreate a ticket
- Exclude checks
Parameter $nodeRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
Open
public function __construct(NodeRepositoryInterface $nodeRepository, ContextBackOfficeInterface $contextManager)
- Create a ticketCreate a ticket
- Exclude checks
Call to method findTreeNode
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
Open
$treeNodes = $this->nodeRepository->findTreeNode(
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant ROOT_PARENT_ID
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
NodeInterface::ROOT_PARENT_ID
- Create a ticketCreate a ticket
- Exclude checks
When fetching an array index from a value of type array|array<int>|array<int>,</int></int>
found an array index of type 'child',
but expected the index to be of type int
Open
Open
foreach ($treeNodes['child'] as &$child) {
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant ROOT_PARENT_ID
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
NodeInterface::ROOT_PARENT_ID
- Create a ticketCreate a ticket
- Exclude checks