Skip to content
Snippets Groups Projects
Commit 2ccc7cbb authored by Alberto Paderno's avatar Alberto Paderno
Browse files

Issue #3474067: Too few arguments are passed to Drupal\Core\Form\ConfigFormBase

parent 6b42c28b
No related branches found
No related tags found
1 merge request!36Issue #3474067: Too few arguments are passed to Drupal\Core\Form\ConfigFormBase
Pipeline #283044 passed
......@@ -3,6 +3,7 @@
namespace Drupal\graph_mail\Form;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
......@@ -13,6 +14,8 @@
*/
class MailSettingsForm extends ConfigFormBase {
// phpcs:disable Generic.Files.LineLength.TooLong
/**
* Constructs a new Drupal\graph_mail\Form\MailSettingsForm object.
*
......@@ -20,20 +23,31 @@ class MailSettingsForm extends ConfigFormBase {
* The configuration factory service.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation service.
* @param ?\Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
* The typed config manager.
*/
public function __construct(ConfigFactoryInterface $config_factory, TranslationInterface $string_translation) {
parent::__construct($config_factory);
public function __construct(ConfigFactoryInterface $config_factory, TranslationInterface $string_translation, ?TypedConfigManagerInterface $typed_config_manager = NULL) {
if (!$typed_config_manager instanceof TypedConfigManagerInterface) {
$type = get_debug_type($typed_config_manager);
$typed_config_manager = \Drupal::getContainer()->get('config.typed');
@trigger_error("Passing {$type} to the \$typed_config_manager parameter of MailSettingsForm::__construct() is deprecated in graph_mail:2.0.0 and must be an instance of \\Drupal\\Core\\Config\\TypedConfigManagerInterface in graph_mail:3.0.0. See https://www.drupal.org/node/3404140", E_USER_DEPRECATED);
}
parent::__construct($config_factory, $typed_config_manager);
$this->setStringTranslation($string_translation);
}
// phpcs:enable
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
public static function create(ContainerInterface $container): static {
return new static(
$container->get('config.factory'),
$container->get('string_translation')
$container->get('string_translation'),
$container->get('config.typed')
);
}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment