Problem/Motivation
In src/Plugin/Condition/MobileDetectCondition.php file i am seeing class implementing ContainerFactoryPluginInterface but no service injection are added.If no service injection,then why using ContainerFactoryPluginInterface in the class
public function __construct(array $configuration, $plugin_id, array $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
$plugin_definition
);
}
Proposed resolution
Remove use and implments ContainerFactoryPluginInterface
Comments
Comment #2
marcusvsouza commentedPatch created.
Comment #3
guilhermevp commentedPatch applies cleanly and work as intended, but while reviewing it I notice that since there is no new implementations related to the MobileDetectCondition class, you can remove create and __construct functions entirely for code cleanliness.
Comment #4
marcusvsouza commentedRemoved __construct function.
Comment #5
marcusvsouza commentedNew patch with removed create and __construct functions.
Comment #6
guilhermevp commentedHi Marcus! Thanks for the patch! It applies cleanly, but further testing revealed that we indeed need the create & construct classes for configuration purposes so we should move on with patch #2.
RTBC!
Comment #8
guilhermevp commentedThanks Marcus!