src/Plugin/Field/FieldWidget/ReactParagraphsWidgetBase.php
The method __construct has 10 parameters. Consider reducing the number of parameters to less than 10. Wontfix
Wontfix
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, SelectionPluginManagerInterface $selection_manager, EntityTypeManagerInterface $entity_type_manager, EditorManager $editor_manager, EntityFieldManagerInterface $field_manager, AccountProxyInterface $current_user) {
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->selectionManager = $selection_manager;
$this->entityTypeManager = $entity_type_manager;
$this->editorManager = $editor_manager;
- Exclude checks
The class ReactParagraphsWidgetBase has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13. Wontfix
Wontfix
abstract class ReactParagraphsWidgetBase extends WidgetBase implements ContainerFactoryPluginInterface {
/**
* Selection plugin manager service.
*
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '178', column '17'). Open
Open
throw new \Exception('Invalid field');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}