Standard way of getting a form inside block I'm using :

public function build() {

    $form = $this-&gt;formBuilder-&gt;getForm('Drupal\mymodule\Form\Myformclass');
    return $form;
  }


to get form inside block. But Drupal community doesn't find it as an appropriate way to get form inside a block.

According to Drupal community module reviewing team, Do not hard-code class names in strings. I tried calling class directly but that is not serving my purpose, giving 505 error.

What's the right way to get a form inside a block?
You can get the fully qualified class name by using ClassName::class:

use Drupal\mymodule\Form\Myformclass;

  public function build() {

    $form = $this-&gt;formBuilder-&gt;getForm(Myformclass::class);
    return $form;
  }


If you want to avoid the full classname in code.