for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace DSchoenbauer\Sql\Command;
use DSchoenbauer\Sql\Exception\NoRecordsAffectedException;
use PDOStatement;
/**
* Description of ErrorTrait
*
* @author David Schoenbauer
abstract class AbstractCommand implements CommandInterface
{
private $isStrict = false;
public function getIsStrict()
return $this->isStrict;
}
public function setIsStrict($isStrict = true)
$this->isStrict = boolval($isStrict);
return $this;
* Throws an exception if no records are found / affected
* @param PDOStatement $statement
* @param \Exception $exceptionToThrow
* @return boolean
$exceptionToThrow
null|\Exception
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.
* @throws NoRecordsAffectedException
public function checkAffected(PDOStatement $statement, \Exception $exceptionToThrow = null)
if (!$exceptionToThrow instanceof \Exception) {
$exceptionToThrow = new NoRecordsAffectedException();
if (!boolval($statement->rowCount()) && $this->getIsStrict()) {
throw $exceptionToThrow;
return true;
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.