Custom form block not working In my custom module I have created custom for like below:
Path: custom_module/src/Form/UserType/UserType.php

&lt;?php
/**
 * @file
 * Contains \Drupal\resume\Form\UserType.
 */
namespace Drupal\custom_module\Form\UserType;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

class userType extends FormBase {
  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'user_type_form';
  }
  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $user_types = \Drupal::entityManager()-&gt;getStorage('taxonomy_term')-&gt;loadTree('user_type');
    $user_type_options = array();
    foreach ($user_types as $user_type) {
        $user_type_options[$user_type-&gt;tid] = $user_type-&gt;name;
    }

    $form['user_type'] = array(
      '#type' =&gt; 'select',
      '#options' =&gt; $user_type_options,
    );
    return $form;
  }
  /**
   * {@inheritdoc}
   */
  public function submitForm(array &amp;$form, FormStateInterface $form_state) {

  }
}


Then I created a block in following path:
custom_module/src/Plugin/Block/UserTypeBlock.php

&lt;?php
/**
 * @file
 * Contains \Drupal\custom_module\Plugin\Block\UserTypeBlock.
 */
namespace Drupal\custom_module\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormInterface;
/**
 * Provides a 'user_type' block.
 *
 * @Block(
 *   id = "user_type_block",
 *   admin_label = @Translation("User Type block"),
 *   category = @Translation("Custom")
 * )
 */
class UserTypeBlock extends BlockBase {
  /**
   * {@inheritdoc}
   */
  public function build() {
    $form = \Drupal::formBuilder()-&gt;getForm('Drupal\custom_module\Form\UserType');
    return $form;
   }
}


But after assign the block in to a region I'm getting following error:


  InvalidArgumentException: The form argument
  Drupal\custom_module\Form\UserType is not a valid form. in
  Drupal\Core\Form\FormBuilder->getFormId() (line 190 of
  C:\wamp\www\www_mysite_com\core\lib\Drupal\Core\Form\FormBuilder.php).
The php file of the form is in a subfolder, but the class name in getForm() does not reflect this.

Change the location of the php file from

custom_module/src/Form/UserType/UserType.php


to

custom_module/src/Form/UserType.php


and 

namespace Drupal\custom_module\Form\UserType;


to

namespace Drupal\custom_module\Form;