I'm having an issue passing a PSR-7 message response (generated by Guzzle) into a class constructor.
The message is generated by:
$client = new \GuzzleHttp\Client();
$res = $client->request('GET', 'http://pagecrawler/cache.html');
And my class constructor:
Class Test {
protected $response;
public function __construct($response, $db = null)
{
$this->$response = $response; /* Line 18 */
}
}
The error I'm getting is:
PHP Catchable fatal error: Object of class GuzzleHttp\Psr7\Response could not be converted to string
I'd assumed that, as I'm not setting a type for $this->response
, it would assign the variable without issue.