code: public function assertMessages($negate, $type, TableNode $messages)
      {
          foreach ($messages->getRowsHash() as $message => $placeholders) {
              $args = [];
  
              foreach ((array) $placeholders as $placeholder) {
                  // Group values: !name => Text.
                  $data = array_map('trim', explode('=>', $placeholder, 2));
  
                  if (count($data) === 2) {
                      $args[$data[0]] = $data[1];
                  }
              }
  
              $this->assertMessage($negate, $type, $message, $args);
          }
      }
docs: @example
  Then should see the following error messages:
  | !name field is required.  | !name => E-mail address |
  
  @param string $negate
  Indicates that user should or should not see message on the page.
  @param string $type
  Message type: error, warning, success. Could be empty.
  @param TableNode $messages
  Messages to found. Placeholders allowed.
  
  @Then /^(?:|I )should(| not) see the following (.* )messages:$/