for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace drupol\Yaroc\Http;
use Http\Client\HttpClient;
use Http\Discovery\HttpClientDiscovery;
use Http\Discovery\MessageFactoryDiscovery;
use Http\Message\MessageFactory;
/**
* Class AbstractClient.
*/
abstract class AbstractClient
{
* The HTTP client.
*
* @var \Http\Client\HttpClient
private $httpClient;
* The HTTP message factory.
* @var \Http\Message\MessageFactory|null
private $messageFactory;
* AbstractClient constructor.
* @param \Http\Client\HttpClient $client
$client
null|HttpClient
This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.
@param
It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.
* @param \Http\Message\MessageFactory|null $messageFactory
* @SuppressWarnings(PHPMD.StaticAccess)
public function __construct(HttpClient $client = null, MessageFactory $messageFactory = null)
$this->httpClient = $client ?? HttpClientDiscovery::find();
$this->messageFactory = $messageFactory ?? MessageFactoryDiscovery::find();
}
* @param \Http\Client\HttpClient $httpClient
* @return \drupol\Yaroc\Http\AbstractClient
public function withHttpClient(HttpClient $httpClient) :AbstractClient
$clone = clone $this;
$clone->httpClient = $httpClient;
return $clone;
* Returns the HTTP adapter.
* @return HttpClient
public function getHttpClient(): HttpClient
return $this->httpClient;
* Get the message factory.
* @return MessageFactory
public function getMessageFactory(): MessageFactory
return $this->messageFactory;
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.