Skip to content

Commit

Permalink
[8.0] Remove dynamic call method (#3213)
Browse files Browse the repository at this point in the history
* Remove dynamic call method

* Update ClientTest.php
  • Loading branch information
GrahamCampbell committed Mar 31, 2024
1 parent e37fdb8 commit 04ff56e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
22 changes: 0 additions & 22 deletions src/Client.php
Expand Up @@ -70,28 +70,6 @@ public function __construct(array $config = [])
$this->configureDefaults($config);
}

/**
* @param string $method
* @param array $args
*
* @return PromiseInterface|ResponseInterface
*
* @deprecated Client::__call will be removed in guzzlehttp/guzzle:8.0.
*/
public function __call($method, $args)
{
if (\count($args) < 1) {
throw new InvalidArgumentException('Magic request methods require a URI and optional options array');
}

$uri = $args[0];
$opts = $args[1] ?? [];

return \substr($method, -5) === 'Async'
? $this->requestAsync(\substr($method, 0, -5), $uri, $opts)
: $this->request($method, $uri, $opts);
}

/**
* Asynchronously send an HTTP request.
*
Expand Down
9 changes: 0 additions & 9 deletions tests/ClientTest.php
Expand Up @@ -26,15 +26,6 @@ public function testUsesDefaultHandler()
self::assertSame(200, $response->getStatusCode());
}

public function testValidatesArgsForMagicMethods()
{
$client = new Client();

$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Magic request methods require a URI and optional options array');
$client->options();
}

public function testCanSendAsyncGetRequests()
{
$client = new Client();
Expand Down

0 comments on commit 04ff56e

Please sign in to comment.