for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Phuria\QueryBuilder;
use Phuria\QueryBuilder\Connection\ConnectionInterface;
use Phuria\QueryBuilder\Parameter\ParameterManagerInterface;
use Phuria\QueryBuilder\Statement\StatementInterface;
/**
* @author Beniamin Jonatan Šimko <[email protected]>
*/
class Query
{
* @var string $sql
private $sql;
* @var ParameterManagerInterface $parameterManager
private $parameterManager;
* @var ConnectionInterface $connection
private $connection;
* @param string $sql
* @param ParameterManagerInterface $parameterManager
* @param ConnectionInterface $connection
$connection
null|ConnectionInterface
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(
$sql,
ParameterManagerInterface $parameterManager,
ConnectionInterface $connection = null
) {
$this->sql = $sql;
$this->parameterManager = $parameterManager;
$this->connection = $connection;
}
* @return string
public function getSQL()
return $this->sql;
* @return StatementInterface
public function buildStatement()
$stmt = $this->connection->prepare($this->sql);
$this->parameterManager->bindStatement($stmt);
return $stmt;
* @return mixed
public function fetchScalar()
$stmt = $this->buildStatement();
$stmt->execute();
return $stmt->fetchScalar();
* @param int|string $name
* @param mixed $value
*
* @return $this
public function setParameter($name, $value)
$this->parameterManager->createOrGetParameter($name)->setValue($value);
return $this;
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.