title: UnexpectedTypeException in FormFactory.php
body: <p>I'am under Silex ~2.0.
  I have a problem with FormServiceProvider, I got this error :</p>
  
  <blockquote>
    <p>UnexpectedTypeException in FormFactory.php line 64: Expected argument of type "string", "SocialWall\Form\Type\CommentType" given</p>
  </blockquote>
  
  <pre><code>in FormFactory.php line 64
  at FormFactory-&gt;createBuilder(object(CommentType), object(Comment), array()) in FormFactory.php line 39
  at FormFactory-&gt;create(object(CommentType), object(Comment)) in routes.php line 23
  at {closure}('2', object(Request))
  at call_user_func_array(object(Closure), array('2', object(Request))) in HttpKernel.php line 153
  at HttpKernel-&gt;handleRaw(object(Request), '1') in HttpKernel.php line 68
  at HttpKernel-&gt;handle(object(Request), '1', true) in Application.php line 496
  at Application-&gt;handle(object(Request)) in Application.php line 477
  at Application-&gt;run() in index.php line 11
  </code></pre>
  
  <p>my route.php</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  use Symfony\Component\HttpFoundation\Request;
  use SocialWall\Domain\Comment;
  use SocialWall\Form\Type\CommentType;
  
  // Home page
  $app-&gt;get('/', function () use ($app) {
      $articles = $app['dao.article']-&gt;findAll();
      return $app['twig']-&gt;render('index.html.twig', array('articles' =&gt; $articles));
  })-&gt;bind('home');
  
  // Article details with comments
  $app-&gt;match('/article/{id}', function ($id, Request $request) use ($app) {
      $article = $app['dao.article']-&gt;find($id);
      $commentFormView = null;
      if ($app['security.authorization_checker']-&gt;isGranted('IS_AUTHENTICATED_FULLY')) {
          // A user is fully authenticated : he can add comments
          $comment = new Comment();
          $comment-&gt;setArticle($article);
          $user = $app['user'];
          $comment-&gt;setAuthor($user);
          $commentForm = $app['form.factory']-&gt;create(new CommentType(), $comment);
          $commentForm-&gt;handleRequest($request);
          if ($commentForm-&gt;isSubmitted() &amp;&amp; $commentForm-&gt;isValid()) {
              $app['dao.comment']-&gt;save($comment);
              $app['session']-&gt;getFlashBag()-&gt;add('success', 'Your comment was succesfully added.');
          }
          $commentFormView = $commentForm-&gt;createView();
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Form/Type/CommentType.php</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  namespace SocialWall\Form\Type;
  
  use Symfony\Component\Form\AbstractType;
  use Symfony\Component\Form\FormBuilderInterface;
  
  
  class CommentType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder-&gt;add('content', 'textarea');
      }
  
      public function getName()
      {
          return 'comment';
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have another error :
  With PhpStorm I see handleRequest, isSubmitted, isValid and createView methods are not found.</p>
  
  <p>Please save my day !</p>