for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace GuzzleHttp\Profiling\Debugbar;
use DebugBar\DataCollector\ExceptionsCollector;
use GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
class ExceptionMiddleware
{
/**
* @var \DebugBar\DataCollector\ExceptionsCollector
*/
private $collector;
* ExceptionMiddleware constructor.
*
* @param \DebugBar\DataCollector\ExceptionsCollector $collector
public function __construct(ExceptionsCollector $collector)
$this->collector = $collector;
}
* @param callable $handler
* @return callable
public function __invoke(callable $handler)
return function (RequestInterface $request, array $options) use ($handler) {
return $handler($request, $options)
->then(function (ResponseInterface $response) {
return $response;
}, function (GuzzleException $exception) {
$this->collector->addException($exception);
$exception
object<GuzzleHttp\Exception\GuzzleException>
object<Exception>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
throw $exception;
});
};
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: