Skip to content

Commit

Permalink
clean up method argument handling
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Oct 31, 2023
1 parent e77088a commit c53a6e9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions AbstractBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,8 @@ public function getRequest(): object
*
* @param array $serverParameters An array of server parameters
*/
public function click(Link $link/* , array $serverParameters = [] */): Crawler
public function click(Link $link, array $serverParameters = []): Crawler
{
$serverParameters = 1 < \func_num_args() ? func_get_arg(1) : [];

if ($link instanceof Form) {
return $this->submit($link, [], $serverParameters);
}
Expand All @@ -271,10 +269,8 @@ public function click(Link $link/* , array $serverParameters = [] */): Crawler
* @param string $linkText The text of the link or the alt attribute of the clickable image
* @param array $serverParameters An array of server parameters
*/
public function clickLink(string $linkText/* , array $serverParameters = [] */): Crawler
public function clickLink(string $linkText, array $serverParameters = []): Crawler
{
$serverParameters = 1 < \func_num_args() ? func_get_arg(1) : [];

$crawler = $this->crawler ?? throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));

return $this->click($crawler->selectLink($linkText)->link(), $serverParameters);
Expand Down

0 comments on commit c53a6e9

Please sign in to comment.