for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Knp\FriendlyContexts\Builder;
use Http\Client\HttpClient;
use Http\Discovery\HttpClientDiscovery;
use Http\Message\RequestFactory;
abstract class AbstractRequestBuilder implements RequestBuilderInterface
{
/**
* @var RequestFactory
*/
protected $requestFactory;
* @var HttpClient
protected $client;
* @param RequestFactory $requestFactory
* @param 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.
public function __construct(RequestFactory $requestFactory, HttpClient $client = null)
$this->requestFactory = $requestFactory;
$this->client = $client ?: HttpClientDiscovery::find();
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
}
public function getRequestFactory()
return $this->requestFactory;
public function getClient()
return $this->client;
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.