title: PHP Notice: 'Array to string conversion' while making symfony form template
body: <p>I'm following <a href="http://symfony.com/doc/current/book/forms.html" rel="nofollow">A symfony tutorial in the official documentation</a>.
  However When I get to <a href="http://symfony.com/doc/current/book/forms.html#field-type-options" rel="nofollow">Field Type Options</a> symfony throws the error
  "An exception has been thrown during the rendering of a template ("Notice: Array to string conversion") in form_div_layout.html.twig at line 13."</p>
  
  <p>I have checked on google and typos, the offending line, from the documentation seems to be: </p>
  
  <pre><code>-&gt;add('dueDate', DateType::class, array('widget' =&gt; 'single_text'))
  </code></pre>
  
  <p>Which is straight from the documentation.
  For context the rest of the file looks like this:</p>
  
  <pre><code>&lt;?php
  
  namespace AppBundle\Controller;
  
  use AppBundle\Entity\Task;
  
  use Symfony\Component\Form\Extension\Core\Type\TextType;
  use Symfony\Component\Form\Extension\Core\Type\DateType;
  use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Symfony\Component\HttpFoundation\Request;
  
  class DefaultController extends Controller
  {
      /**
       * @Route("/", name="homepage")
       */
      public function indexAction(Request $request)
      {
          // replace this example code with whatever you need
          return $this-&gt;render('default/index.html.twig', [
              'base_dir' =&gt; realpath($this-&gt;getParameter('kernel.root_dir').'/..'),
          ]);
      }
  
      /**
       * @Route("/form", name="formmma")
       */
      public function newAction(Request $request)
      {
          // create a task and give it some dummy data for this example
          $task = new Task();
          $task-&gt;setTask('Write a blog post');
  
          $task-&gt;setDueDate(new \DateTime('tomorrow'));
  
          $form = $this-&gt;createFormBuilder($task)
              -&gt;add('task', TextType::class)
             // -&gt;add('dueDate', DateType::class)
              -&gt;add('dueDate', DateType::class, array('widget' =&gt; 'single_text'))
             // -&gt;add('dueDate', null, array(
             //     'widget' =&gt; 'single_text',
             //     'required' =&gt; false
             // ))
  
              -&gt;add('save', SubmitType::class, array('label' =&gt; 'Create Task'))
              -&gt;getForm();
  
          $form-&gt;handleRequest($request);
  
          if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
               // ... perform some action, such as saving the task to the database
  
               return $this-&gt;redirectToRoute('task_success');
          }
  
          return $this-&gt;render('default/new.html.twig', array(
              'form' =&gt; $form-&gt;createView(),
          ));
      }
  }
  </code></pre>