PHPStorm, PHP 7.4 IDE highlights $container->get('date.formatter'), with
"Expected parameter of type '\Drupal\Core\Datetime\DateFormatterInterface', 'object' provided"
This function is an exact copy of the core TimestampFormatter (which also shows the error)
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$plugin_id,
$plugin_definition,
$configuration['field_definition'],
$configuration['settings'],
$configuration['label'],
$configuration['view_mode'],
$configuration['third_party_settings'],
$container->get('date.formatter'),
$container->get('entity_type.manager')->getStorage('date_format')
);
}
The __construct is looking for a DateFormatterInterface (see below) and not sure how this works in core, but my "viewElements" is never firing since this error started.
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, **DateFormatterInterface $date_formatter**, EntityStorageInterface $date_format_storage) {
What is the proper container->get to use to return a proper date.formatter and not an object which causes the create to fail without any errors logged that I can see?