{inheritdoc} 的需求是什么?

What is the needs of {inheritdoc}?

我经常与 Drupal 和 类 打交道,有时我读到类似的东西:

/**
  * {@inheritdoc}
  */

  // return the form definition
  public function buildForm(array $form, FormStateInterface $form_state) {
    $config = $this->config('hello_world.custom_salutation');

    $form['salutation'] = array(
      '#type' => 'textfield',
      '#title' => $this->t('Salutation'),
      '#description' => $this->t('Si prega di inserire il saluto che si desidera usare'),
      '#default_value' => $config->get('salutation'),
    );

inheritdoc是什么意思?

这是一个 docblock 语法,是 Drupal API documentation and comment standards 的一部分:

您可以在 class

中使用 {@inheritdoc}

if you are overriding or implementing a method from a base class or interface, and the documentation should be exactly the same as the base class/interface method

它还声明此 必须是文档块中的唯一行。