for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ntentan\atiaa;
use ntentan\panie\Container;
use ntentan\utils\Text;
class DbContext
{
private $driver;
private $driverFactory;
private static $instance;
private function __construct(DriverFactory $driverFactory)
$this->driverFactory = $driverFactory;
self::$instance = $this;
}
public static function initialize(DriverFactory $driverFactory)
self::$instance = new self($driverFactory);
return self::$instance;
public static function getInstance(): DbContext
if(!self::$instance) {
throw new \Exception("The database context has not been initialized");
/**
*
* @return Driver
*/
public function getDriver() : Driver
if (is_null($this->driver)) {
$this->driver = $this->driverFactory->createDriver();
$this->driver->connect();
return $this->driver;
public function query($query, $bindData = false)
return $this->getDriver()->query($query, $bindData);
$bindData
boolean
false|array<integer,*>
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);
public static function destroy()
self::$instance->getDriver()->disconnect();
self::$instance = null;