mirror of
https://github.com/dg/dibi.git
synced 2025-08-09 07:37:08 +02:00
removed deprecated stuff
This commit is contained in:
@@ -48,27 +48,10 @@ class Connection implements IConnection
|
||||
* - file => file to log
|
||||
* - substitutes (array) => map of driver specific substitutes (under development)
|
||||
* - onConnect (array) => list of SQL queries to execute (by Connection::query()) after connection is established
|
||||
* @param array $config connection parameters
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($config, string $name = null)
|
||||
public function __construct(array $config, string $name = null)
|
||||
{
|
||||
if (is_string($config)) {
|
||||
trigger_error(__METHOD__ . '() Configuration should be array.', E_USER_DEPRECATED);
|
||||
parse_str($config, $config);
|
||||
|
||||
} elseif ($config instanceof Traversable) {
|
||||
trigger_error(__METHOD__ . '() Configuration should be array.', E_USER_DEPRECATED);
|
||||
$tmp = [];
|
||||
foreach ($config as $key => $val) {
|
||||
$tmp[$key] = $val instanceof Traversable ? iterator_to_array($val) : $val;
|
||||
}
|
||||
$config = $tmp;
|
||||
|
||||
} elseif (!is_array($config)) {
|
||||
throw new \InvalidArgumentException('Configuration must be array.');
|
||||
}
|
||||
|
||||
Helpers::alias($config, 'username', 'user');
|
||||
Helpers::alias($config, 'password', 'pass');
|
||||
Helpers::alias($config, 'host', 'hostname');
|
||||
@@ -316,16 +299,6 @@ class Connection implements IConnection
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function affectedRows(): int
|
||||
{
|
||||
trigger_error(__METHOD__ . '() is deprecated, use getAffectedRows()', E_USER_DEPRECATED);
|
||||
return $this->getAffectedRows();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
|
||||
* @throws Exception
|
||||
@@ -343,16 +316,6 @@ class Connection implements IConnection
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function insertId(string $sequence = null): int
|
||||
{
|
||||
trigger_error(__METHOD__ . '() is deprecated, use getInsertId()', E_USER_DEPRECATED);
|
||||
return $this->getInsertId($sequence);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Begins a transaction (if supported).
|
||||
*/
|
||||
|
@@ -32,77 +32,8 @@ class DateTime extends \DateTimeImmutable
|
||||
}
|
||||
|
||||
|
||||
/** @deprecated use modify() */
|
||||
public function modifyClone(string $modify = ''): self
|
||||
{
|
||||
trigger_error(__METHOD__ . '() is deprecated, use modify()', E_USER_DEPRECATED);
|
||||
$dolly = clone $this;
|
||||
return $modify ? $dolly->modify($modify) : $dolly;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->format('Y-m-d H:i:s.u');
|
||||
}
|
||||
|
||||
|
||||
/********************* immutable usage detector ****************d*g**/
|
||||
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
|
||||
if (isset($trace[0]['file'], $trace[1]['function']) && $trace[0]['file'] === __FILE__ && $trace[1]['function'] !== '__construct') {
|
||||
trigger_error(__CLASS__ . ' is immutable now, check how it is used in ' . $trace[1]['file'] . ':' . $trace[1]['line'], E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function add($interval)
|
||||
{
|
||||
return parent::add($interval);
|
||||
}
|
||||
|
||||
|
||||
public function modify($modify)
|
||||
{
|
||||
return parent::modify($modify);
|
||||
}
|
||||
|
||||
|
||||
public function setDate($year, $month, $day)
|
||||
{
|
||||
return parent::setDate($year, $month, $day);
|
||||
}
|
||||
|
||||
|
||||
public function setISODate($year, $week, $day = 1)
|
||||
{
|
||||
return parent::setISODate($year, $week, $day);
|
||||
}
|
||||
|
||||
|
||||
public function setTime($hour, $minute, $second = 0, $micro = 0)
|
||||
{
|
||||
return parent::setTime($hour, $minute, $second, $micro);
|
||||
}
|
||||
|
||||
|
||||
public function setTimestamp($unixtimestamp)
|
||||
{
|
||||
return parent::setTimestamp($unixtimestamp);
|
||||
}
|
||||
|
||||
|
||||
public function setTimezone($timezone)
|
||||
{
|
||||
return parent::setTimezone($timezone);
|
||||
}
|
||||
|
||||
|
||||
public function sub($interval)
|
||||
{
|
||||
return parent::sub($interval);
|
||||
}
|
||||
}
|
||||
|
@@ -52,10 +52,6 @@ class OracleDriver implements Dibi\Driver
|
||||
}
|
||||
|
||||
$foo = &$config['charset'];
|
||||
|
||||
if (isset($config['formatDate']) || isset($config['formatDateTime'])) {
|
||||
trigger_error('OracleDriver: options formatDate and formatDateTime are deprecated.', E_USER_DEPRECATED);
|
||||
}
|
||||
$this->nativeDate = $config['nativeDate'] ?? true;
|
||||
|
||||
if (isset($config['resource'])) {
|
||||
|
@@ -29,12 +29,6 @@ trait Strict
|
||||
*/
|
||||
public function __call(string $name, array $args)
|
||||
{
|
||||
$class = get_class($this);
|
||||
if ($cb = self::extensionMethod($class . '::' . $name)) { // back compatiblity
|
||||
trigger_error("Extension methods such as $class::$name() are deprecated", E_USER_DEPRECATED);
|
||||
array_unshift($args, $this);
|
||||
return $cb(...$args);
|
||||
}
|
||||
$class = method_exists($this, $name) ? 'parent' : get_class($this);
|
||||
$items = (new ReflectionClass($this))->getMethods(ReflectionMethod::IS_PUBLIC);
|
||||
$hint = ($t = Helpers::getSuggestion($items, $name)) ? ", did you mean $t()?" : '.';
|
||||
@@ -102,39 +96,4 @@ trait Strict
|
||||
$class = get_class($this);
|
||||
throw new \LogicException("Attempt to unset undeclared property $class::$$name.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @deprecated
|
||||
*/
|
||||
public static function extensionMethod(string $name, callable $callback = null)
|
||||
{
|
||||
if (strpos($name, '::') === false) {
|
||||
$class = get_called_class();
|
||||
} else {
|
||||
[$class, $name] = explode('::', $name);
|
||||
$class = (new ReflectionClass($class))->getName();
|
||||
}
|
||||
|
||||
$list = &self::$extMethods[strtolower($name)];
|
||||
if ($callback === null) { // getter
|
||||
$cache = &$list[''][$class];
|
||||
if (isset($cache)) {
|
||||
return $cache;
|
||||
}
|
||||
|
||||
foreach ([$class] + class_parents($class) + class_implements($class) as $cl) {
|
||||
if (isset($list[$cl])) {
|
||||
return $cache = $list[$cl];
|
||||
}
|
||||
}
|
||||
return $cache = false;
|
||||
|
||||
} else { // setter
|
||||
trigger_error("Extension methods such as $class::$name() are deprecated", E_USER_DEPRECATED);
|
||||
$list[$class] = $callback;
|
||||
$list[''] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -145,26 +145,6 @@ class dibi
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function affectedRows(): int
|
||||
{
|
||||
trigger_error(__METHOD__ . '() is deprecated, use getAffectedRows()', E_USER_DEPRECATED);
|
||||
return self::getConnection()->getAffectedRows();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static function insertId(string $sequence = null): int
|
||||
{
|
||||
trigger_error(__METHOD__ . '() is deprecated, use getInsertId()', E_USER_DEPRECATED);
|
||||
return self::getConnection()->getInsertId($sequence);
|
||||
}
|
||||
|
||||
|
||||
/********************* misc tools ****************d*g**/
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user