diff --git a/src/Dibi/Connection.php b/src/Dibi/Connection.php index bec5f78f..6a12d776 100644 --- a/src/Dibi/Connection.php +++ b/src/Dibi/Connection.php @@ -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). */ diff --git a/src/Dibi/DateTime.php b/src/Dibi/DateTime.php index ac2bb65d..c18c1b2c 100644 --- a/src/Dibi/DateTime.php +++ b/src/Dibi/DateTime.php @@ -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); - } } diff --git a/src/Dibi/Drivers/OracleDriver.php b/src/Dibi/Drivers/OracleDriver.php index 6acda56d..aa269b8e 100644 --- a/src/Dibi/Drivers/OracleDriver.php +++ b/src/Dibi/Drivers/OracleDriver.php @@ -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'])) { diff --git a/src/Dibi/Strict.php b/src/Dibi/Strict.php index 7580cc81..08855a37 100644 --- a/src/Dibi/Strict.php +++ b/src/Dibi/Strict.php @@ -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; - } - } } diff --git a/src/Dibi/dibi.php b/src/Dibi/dibi.php index fd29eb33..44d93096 100644 --- a/src/Dibi/dibi.php +++ b/src/Dibi/dibi.php @@ -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**/