8000 Added types and tweaked PHPdoc of clickLink() and submitForm() methods · symfony/symfony@48aa504 · GitHub
[go: up one dir, main page]

Skip to content

Commit 48aa504

Browse files
committed
Added types and tweaked PHPdoc of clickLink() and submitForm() methods
1 parent eb112a5 commit 48aa504

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -291,17 +291,13 @@ public function click(Link $link)
291291
}
292292

293293
/**
294-
* Finds link by given text and then clicks on it.
294+
* Clicks the first link (or clickable image) that contains the given text.
295295
*
296-
* @param string $value The link text
297-
*
298-
* @return Crawler
296+
* @param string $linkText The text of the link or the alt attribute of a clickable image
299297
*/
300-
public function clickLink($value)
298+
public function clickLink(string $linkText): Crawler
301299
{
302-
$link = $this->getCrawler()->selectLink($value)->link();
303-
304-
return $this->click($link);
300+
return $this->click($this->getCrawler()->selectLink($linkText)->link());
305301
}
306302

307303
/**
@@ -322,18 +318,17 @@ public function submit(Form $form, array $values = array()/*, array $serverParam
322318
}
323319

324320
/**
325-
* Finds a form by submit button text and then submits it.
321+
* Finds the first form that contains a button with the given content and
322+
* uses it to submit the given form field values.
326323
*
327-
* @param string $button The button text
328-
* @param array $values An array of form field values
329-
* @param string $method The method for the form
330-
*
331-
* @return Crawler
324+
* @param string $button The text content, id, value or name of the form <button> or <input type="submit">
325+
* @param array $fieldValues Use this syntax: array('my_form[name]' => '...', 'my_form[email]' => '...')
326+
* @param string $method The HTTP method used to submit the form
332327
*/
333-
public function submitForm($button, $values, $method)
328+
public function submitForm(string $button, array $fieldValues, string $method = 'POST'): Crawler
334329
{
335330
$buttonNode = $this->getCrawler()->selectButton($button);
336-
$form = $buttonNode->form($values, $method);
331+
$form = $buttonNode->form($fieldValues, $method);
337332

338333
return $this->submit($form);
339334
}

0 commit comments

Comments
 (0)
0