Backoffice/Manager/BlockManager.php
Avoid assigning values to variables in if clauses and the like (line '80', column '39'). Open
Open
protected function setDefaultAttributes(BlockInterface $block)
{
$defaultConfiguration = $this->generateFormManager->getDefaultConfiguration($block);
foreach ($defaultConfiguration as $key => $value) {
if (in_array($key, $this->fixedParameters) &&
- 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
Avoid using static access to class '\Doctrine\Common\Util\Inflector' in method 'setDefaultAttributes'. Open
Open
method_exists($block, $setter = 'set' . Inflector::classify($key))
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Call to method getLabel
from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open
Open
$block->setLabel($block->getLabel()."[".$oldLanguage."]");
- Create a ticketCreate a ticket
- Exclude checks
Parameter $block
has undeclared type \OpenOrchestra\ModelInterface\Model\BlockInterface
Open
Open
protected function setDefaultAttributes(BlockInterface $block)
- Create a ticketCreate a ticket
- Exclude checks
Call to method setLabel
from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open
Open
$block->setLabel($block->getLabel()."[".$oldLanguage."]");
- Create a ticketCreate a ticket
- Exclude checks
Return type of createToTranslateBlock()
is undeclared type \OpenOrchestra\ModelInterface\Model\BlockInterface
Open
Open
public function createToTranslateBlock(BlockInterface $block, $language)
- Create a ticketCreate a ticket
- Exclude checks
Call to method setLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open
Open
$block->setLanguage($language);
- Create a ticketCreate a ticket
- Exclude checks
Return type of initializeBlock()
is undeclared type \OpenOrchestra\ModelInterface\Model\BlockInterface
Open
Open
public function initializeBlock($component, $siteId, $language, $isTransverse)
- Create a ticketCreate a ticket
- Exclude checks
Call to method classify
from undeclared class \Doctrine\Common\Util\Inflector
Open
Open
method_exists($block, $setter = 'set' . Inflector::classify($key))
- Create a ticketCreate a ticket
- Exclude checks
Call to method setAttributes
from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open
Open
$block->setAttributes($defaultConfiguration);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $block
has undeclared type \OpenOrchestra\ModelInterface\Model\BlockInterface
Open
Open
public function createToTranslateBlock(BlockInterface $block, $language)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open
Open
$oldLanguage = $block->getLanguage();
- Create a ticketCreate a ticket
- Exclude checks
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