title: How can I get array key => errorMessage from $violations. Symfony 4
body: <p>Here is my code</p>
  
  <pre><code> $arParams = $request-&gt;all();
  
      $validator = Validation::createValidator();
  
      $groups = new GroupSequence(['Default', 'custom']);
  
      $constraint = new Assert\Collection([
          'name' =&gt; new Assert\Length(['min' =&gt; 2]),
          'city' =&gt; new Assert\Length(['min' =&gt; 2]),
          'email' =&gt; new Assert\Email(),
          'phone' =&gt; new Assert\Length(['min' =&gt; 18]),
          'message' =&gt; new Assert\NotNull()
      ]);
  
      $violations = $validator-&gt;validate($arParams, $constraint, $groups);
  </code></pre>
  
  <p>If i get some errors, how can I get an array like
  ['name' => not enough symbols, 'email' => wrong email]?</p>
  
  <p>I tried to use foreach on $violations but cant find all the methods of its elements Phpstorm sign $violation as mixed. I found only $violation->getMessage() and ->getCode()</p>