Sortie du snippet Symfony "Validation de la présence et du type des clés d'un tableau avec Symfony"

Environnement :

  • Strangebuzz Snippet VM : 6.4.2
  • Symfony : 6.4.5

Sortie du code exécuté :

✅ All needed keys of the array:
array (
  'bar' => 'string',
  'babar' => true,
  'john' => 555,
  'fab' => 
  array (
    0 => '4545',
  ),
)
are present and of the good type.

❌ needed keys of the array
\array (
  'bar' => false,
  'babar' => 'true',
  'john' => 0.1,
  'fab' => 
  (object) array(
  ),
  'extra' => NULL,
)
are NOT correct:
Array[bar]:
    This value should be of type string. (code ba785a8c-82cb-4283-967c-3cf342181b40)
Array[babar]:
    This value should be of type bool. (code ba785a8c-82cb-4283-967c-3cf342181b40)
Array[john]:
    This value should be of type int. (code ba785a8c-82cb-4283-967c-3cf342181b40)
Array[fab]:
    This value should be of type array. (code ba785a8c-82cb-4283-967c-3cf342181b40)
Array[extra]:
    This field was not expected. (code 7703c766-b5d5-4cef-ace7-ae0dd82304e9)