title: Symfony 5 - Forms and Entities - NotBlank constraint with not nullable string entity attribute
body: <p>I create a form to edit an existing object in database.</p>
  <p>One of the field is a string, and cannot be blank or empty.</p>
  <p>In order to display a validation error message if the value is blank at form submit, I add the following <code>NotBlank</code> constraint into the form type class:</p>
  <pre><code>...
  -&gt;add(
      'firstname',
      null,
      [
          'label' =&gt; 'user.firstname',
          'constraints' =&gt; [
              new Assert\NotBlank()
          ]
      ]
  )
  ...
  </code></pre>
  <p>I also specify the attribute type (<code>string</code>) into the entity:</p>
  <pre><code>...
  private string $firstname;
  ...
  public function setFirstname(string $firstname) {
      $this-&gt;firstname = $firstname;
  }
  ...
  public function getFirstname(): string {
      return $this-&gt;firstname;
  }
  </code></pre>
  <p>When I submit the form with a blank value, I expect to see a normal form validation error message telling me the value cannot be blank. Instead, I get the following Symfony error:</p>
  <pre><code>Expected argument of type &quot;string&quot;, &quot;null&quot; given at property path &quot;firstname&quot;.
  </code></pre>
  <p>If I remove the type <code>string</code> from the entity attribute declaration, then I do not get that Symfony error anymore and the validation error message is displayed as expected.</p>
  <p>Is there anyway to keep declaring attributes types while applying a <code>NotBlank</code> constraint on it ?</p>
  <p>I have noticed that unexpected behavior only occurs when I use a form to edit an existing object but not when I create a brand new object in database. In that last case, setting a blank value with a <code>NotBlank</code> constraint and declaring the attribute type into the entity (<code>private string $firstname</code>) does not cause any issue and the form validation error message (telling the field cannot be blank) is displayed correctly.</p>