From 4d6d30ae47257e5399cb3d2e7e049f243c4b2a0c Mon Sep 17 00:00:00 2001 From: Fernando Herrero Date: Mon, 23 Oct 2023 12:25:37 +0200 Subject: [PATCH 1/5] Compatibility with CakePHP 4.5 --- src/Config/ConfigTrait.php | 67 +------------------ .../Exception/UnallowedDataTypeException.php | 4 +- src/Database/OCI8/OCI8Exception.php | 4 +- src/Database/OracleConnection.php | 4 +- src/Database/Schema/OracleSchema.php | 9 ++- .../Exception/MissingMethodClassException.php | 4 +- src/ORM/Exception/MissingRequestException.php | 4 +- src/TestSuite/Fixture/MethodTestFixture.php | 2 +- 8 files changed, 21 insertions(+), 77 deletions(-) diff --git a/src/Config/ConfigTrait.php b/src/Config/ConfigTrait.php index a502a7c..f1263d6 100644 --- a/src/Config/ConfigTrait.php +++ b/src/Config/ConfigTrait.php @@ -10,7 +10,7 @@ */ namespace CakeDC\OracleDriver\Config; -use Cake\Core\Exception\Exception; +use Cake\Core\Exception\CakeException; use Cake\Utility\Hash; /** @@ -27,67 +27,6 @@ trait ConfigTrait */ protected $_configInitialized = false; - /** - * ### Usage - * - * Reading the whole config: - * - * ``` - * $this->config(); - * ``` - * - * Reading a specific value: - * - * ``` - * $this->config('key'); - * ``` - * - * Reading a nested value: - * - * ``` - * $this->config('some.nested.key'); - * ``` - * - * Setting a specific value: - * - * ``` - * $this->config('key', $value); - * ``` - * - * Setting a nested value: - * - * ``` - * $this->config('some.nested.key', $value); - * ``` - * - * Updating multiple config settings at the same time: - * - * ``` - * $this->config(['one' => 'value', 'another' => 'value']); - * ``` - * - * @param string|array|null $key The key to get/set, or a complete array of configs. - * @param mixed|null $value The value to set. - * @param bool $merge Whether to recursively merge or overwrite existing config, defaults to true. - * @return mixed Config value being read, or the object itself on write operations. - * @throws \Cake\Core\Exception\Exception When trying to set a key that is invalid. - */ - public function config($key = null, $value = null, $merge = true) - { - if (!$this->_configInitialized) { - $this->_config += $this->_baseConfig; - $this->_configInitialized = true; - } - - if (is_array($key) || func_num_args() >= 2) { - $this->_configWrite($key, $value, $merge); - - return $this; - } - - return $this->_configRead($key); - } - /** * Write a config variable * @@ -136,7 +75,7 @@ protected function _configWrite($key, $value, $merge = false) foreach ($stack as $k) { if (!is_array($update)) { - throw new Exception(sprintf('Cannot set %s value', $key)); + throw new CakeException(sprintf('Cannot set %s value', $key)); } if (!isset($update[$k])) { @@ -170,7 +109,7 @@ protected function _configDelete($key) foreach ($stack as $i => $k) { if (!is_array($update)) { - throw new Exception(sprintf('Cannot unset %s value', $key)); + throw new CakeException(sprintf('Cannot unset %s value', $key)); } if (!isset($update[$k])) { diff --git a/src/Database/Exception/UnallowedDataTypeException.php b/src/Database/Exception/UnallowedDataTypeException.php index 51f98c7..006ce02 100644 --- a/src/Database/Exception/UnallowedDataTypeException.php +++ b/src/Database/Exception/UnallowedDataTypeException.php @@ -12,9 +12,9 @@ */ namespace CakeDC\OracleDriver\Database\Exception; -use Cake\Core\Exception\Exception; +use Cake\Core\Exception\CakeException; -class UnallowedDataTypeException extends Exception +class UnallowedDataTypeException extends CakeException { /** * {@inheritDoc} diff --git a/src/Database/OCI8/OCI8Exception.php b/src/Database/OCI8/OCI8Exception.php index 6e16e9b..40e126e 100644 --- a/src/Database/OCI8/OCI8Exception.php +++ b/src/Database/OCI8/OCI8Exception.php @@ -12,9 +12,9 @@ */ namespace CakeDC\OracleDriver\Database\OCI8; -use Cake\Core\Exception\Exception; +use Cake\Core\Exception\CakeException; -class OCI8Exception extends Exception +class OCI8Exception extends CakeException { /** * OCI Error builder. diff --git a/src/Database/OracleConnection.php b/src/Database/OracleConnection.php index e7cbc6a..0002847 100644 --- a/src/Database/OracleConnection.php +++ b/src/Database/OracleConnection.php @@ -12,7 +12,7 @@ */ namespace CakeDC\OracleDriver\Database; -use Cake\Core\Exception\Exception; +use Cake\Core\Exception\CakeException; use Cake\Database\Connection; use Cake\Database\StatementInterface; use CakeDC\OracleDriver\Database\Log\MethodLogger; @@ -91,7 +91,7 @@ public function methodSchemaCollection(?MethodsCollection $collection = null) public function prepareMethod($sql, $options = []) { if (!method_exists($this->_driver, 'isOci') || !$this->_driver->isOci()) { - throw new Exception('Method calls using PDO layer not supported'); + throw new CakeException('Method calls using PDO layer not supported'); } $options += ['bufferResult' => false]; $statement = $this->_driver->prepareMethod($sql, $options); diff --git a/src/Database/Schema/OracleSchema.php b/src/Database/Schema/OracleSchema.php index 65f280a..534d329 100644 --- a/src/Database/Schema/OracleSchema.php +++ b/src/Database/Schema/OracleSchema.php @@ -12,7 +12,7 @@ */ namespace CakeDC\OracleDriver\Database\Schema; -use Cake\Database\Schema\BaseSchema; +use Cake\Database\Schema\SchemaDialect; use Cake\Database\Schema\TableSchema; use Cake\Utility\Hash; use CakeDC\OracleDriver\Database\Exception\UnallowedDataTypeException; @@ -20,7 +20,7 @@ /** * Schema management/reflection features for Oracle. */ -class OracleSchema extends BaseSchema +class OracleSchema extends SchemaDialect { protected $_constraints = []; @@ -233,6 +233,7 @@ public function convertColumnDescription(TableSchema $schema, array $row): void break; case 'NCLOB': case 'CLOB': + case 'XMLTYPE': $field = [ 'type' => TableSchema::TYPE_TEXT, 'length' => $row['char_length'], @@ -482,6 +483,10 @@ public function convertIndexDescription(TableSchema $schema, array $row): void $type = null; $columns = $length = []; + if (preg_match('~FUNCTION-BASED~i', ($tableIndex['type'] ?? ''))) { + return; + } + $keyName = $this->_transformValueCase($tableIndex['name']); $name = $this->_transformValueCase($tableIndex['column_name']); if ( !empty($tableIndex['is_primary']) && strtolower($tableIndex['is_primary']) === 'p') { diff --git a/src/ORM/Exception/MissingMethodClassException.php b/src/ORM/Exception/MissingMethodClassException.php index d761fc3..ff09f22 100644 --- a/src/ORM/Exception/MissingMethodClassException.php +++ b/src/ORM/Exception/MissingMethodClassException.php @@ -12,13 +12,13 @@ */ namespace CakeDC\OracleDriver\ORM\Exception; -use Cake\Core\Exception\Exception; +use Cake\Core\Exception\CakeException; /** * Exception raised when a Table could not be found. * */ -class MissingMethodClassException extends Exception +class MissingMethodClassException extends CakeException { protected $_messageTemplate = 'Method class %s could not be found.'; } diff --git a/src/ORM/Exception/MissingRequestException.php b/src/ORM/Exception/MissingRequestException.php index c5ee251..350b20d 100644 --- a/src/ORM/Exception/MissingRequestException.php +++ b/src/ORM/Exception/MissingRequestException.php @@ -12,13 +12,13 @@ */ namespace CakeDC\OracleDriver\ORM\Exception; -use Cake\Core\Exception\Exception; +use Cake\Core\Exception\CakeException; /** * Exception raised when an Request could not be found. * */ -class MissingRequestException extends Exception +class MissingRequestException extends CakeException { protected $_messageTemplate = 'Request class %s could not be found.'; } diff --git a/src/TestSuite/Fixture/MethodTestFixture.php b/src/TestSuite/Fixture/MethodTestFixture.php index 3a82ac6..d9f985f 100644 --- a/src/TestSuite/Fixture/MethodTestFixture.php +++ b/src/TestSuite/Fixture/MethodTestFixture.php @@ -12,7 +12,7 @@ */ namespace CakeDC\OracleDriver\TestSuite\Fixture; -use Cake\Core\Exception\Exception as CakeException; +use Cake\Core\Exception\CakeException; use Cake\Datasource\ConnectionInterface; use Cake\Log\Log; use Cake\Utility\Inflector; From 7e955d567952a05853d38328e7b762fda0e78e18 Mon Sep 17 00:00:00 2001 From: Fernando Herrero Date: Fri, 24 Nov 2023 14:54:52 +0100 Subject: [PATCH 2/5] Update for php-8.x --- composer.json | 4 ++-- src/Database/OCI8/OCI8Connection.php | 5 +++-- src/Database/OCI8/OCI8Statement.php | 15 +++++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index df1e77c..bf5ec87 100644 --- a/composer.json +++ b/composer.json @@ -29,14 +29,14 @@ "preferred-install": "src" }, "require": { - "php": ">=7.3", + "php": ">=8.0", "cakephp/chronos": "*", "ext-pdo": "*" }, "require-dev": { "cakephp/cakephp-codesniffer": "^4.0", "phpunit/phpunit": "^8.5", - "cakephp/cakephp": "4.2.*" + "cakephp/cakephp": "4.5.*" }, "repositories": [], "autoload": { diff --git a/src/Database/OCI8/OCI8Connection.php b/src/Database/OCI8/OCI8Connection.php index d464608..f7996db 100644 --- a/src/Database/OCI8/OCI8Connection.php +++ b/src/Database/OCI8/OCI8Connection.php @@ -12,8 +12,9 @@ */ namespace CakeDC\OracleDriver\Database\OCI8; -use Cake\Core\InstanceConfigTrait; use PDO; +use Cake\Core\InstanceConfigTrait; +use PDOStatement; /** * OCI8 implementation of the Connection interface. @@ -127,7 +128,7 @@ public function prepare($statement, $options = null) /** * {@inheritdoc} */ - public function query($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) + public function query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement|false { $args = func_get_args(); $sql = $args[0]; diff --git a/src/Database/OCI8/OCI8Statement.php b/src/Database/OCI8/OCI8Statement.php index aee6bb4..c4f1ca3 100644 --- a/src/Database/OCI8/OCI8Statement.php +++ b/src/Database/OCI8/OCI8Statement.php @@ -12,6 +12,7 @@ */ namespace CakeDC\OracleDriver\Database\OCI8; +use Iterator; use PDO; /** @@ -259,7 +260,7 @@ public function execute($params = null) /** * {@inheritdoc} */ - public function getIterator() + public function getIterator(): Iterator { $data = $this->fetchAll(); @@ -400,17 +401,17 @@ public function fetch($fetchMode = null, $orientation = null, $offset = null) /** * {@inheritdoc} */ - public function fetchAll($fetchMode = null, $className = null, $arguments = null) + //public function fetchAll(int $fetchMode = PDO::FETCH_DEFAULT, $className = null, $arguments = null): array + public function fetchAll(int $fetchMode = PDO::FETCH_DEFAULT, mixed ...$arguments): array { - $fetchArgument = $className; - $this->setFetchMode($fetchMode, $fetchArgument, $arguments); + $this->setFetchMode($fetchMode, ...$arguments); $this->_results = []; while ($row = $this->fetch()) { if (is_resource(reset($row))) { $stmt = new OCI8Statement($this->_dbh, reset($row), $this->_conn); $stmt->execute(); - $stmt->setFetchMode($fetchMode, $fetchArgument, $arguments); + $stmt->setFetchMode($fetchMode, ...$arguments); while ($rs = $stmt->fetch()) { $this->_results[] = $rs; } @@ -468,9 +469,11 @@ public function getAttribute($attribute) * @throws \CakeDC\OracleDriver\Database\OCI8\Oci8Exception * @return bool TRUE on success or FALSE on failure. */ - public function setFetchMode($fetchMode, $param = null, $arguments = []) + //public function setFetchMode($fetchMode, $param = null, $arguments = []) + public function setFetchMode(int $fetchMode, mixed ...$arguments) { $this->_defaultFetchMode = $fetchMode; + $param = array_shift($arguments); switch ($fetchMode) { case PDO::FETCH_ASSOC: From f8960fa900bee2ce5654d87fd031ca024201ed11 Mon Sep 17 00:00:00 2001 From: Fernando Herrero Date: Thu, 21 Mar 2024 13:14:04 +0100 Subject: [PATCH 3/5] #[\ReturnTypeWillChange] workaround --- src/Database/OCI8/OCI8Connection.php | 10 ++++++++++ src/Database/OCI8/OCI8Statement.php | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/Database/OCI8/OCI8Connection.php b/src/Database/OCI8/OCI8Connection.php index f7996db..a4c4bf8 100644 --- a/src/Database/OCI8/OCI8Connection.php +++ b/src/Database/OCI8/OCI8Connection.php @@ -120,6 +120,7 @@ public function getServerVersion() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function prepare($statement, $options = null) { return new OCI8Statement($this->dbh, $statement, $this); @@ -128,6 +129,7 @@ public function prepare($statement, $options = null) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement|false { $args = func_get_args(); @@ -141,6 +143,7 @@ public function query(string $query, ?int $fetchMode = null, mixed ...$fetchMode /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function quote($string, $type = \PDO::PARAM_STR) { if (is_int($string) || is_float($string)) { @@ -154,6 +157,7 @@ public function quote($string, $type = \PDO::PARAM_STR) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function exec($statement) { $stmt = $this->prepare($statement); @@ -186,6 +190,7 @@ public function isTransaction() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function inTransaction() { return $this->executeMode === OCI_NO_AUTO_COMMIT; @@ -194,6 +199,7 @@ public function inTransaction() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function beginTransaction() { $this->executeMode = OCI_NO_AUTO_COMMIT; @@ -204,6 +210,7 @@ public function beginTransaction() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function commit() { if (!oci_commit($this->dbh)) { @@ -217,6 +224,7 @@ public function commit() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function rollBack() { if (!oci_rollback($this->dbh)) { @@ -230,6 +238,7 @@ public function rollBack() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function errorCode() { $error = oci_error($this->dbh); @@ -245,6 +254,7 @@ public function errorCode() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function errorInfo() { return oci_error($this->dbh); diff --git a/src/Database/OCI8/OCI8Statement.php b/src/Database/OCI8/OCI8Statement.php index c4f1ca3..32b7fca 100644 --- a/src/Database/OCI8/OCI8Statement.php +++ b/src/Database/OCI8/OCI8Statement.php @@ -150,6 +150,7 @@ public static function convertPositionalToNamedPlaceholders($statement) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function bindValue($param, $value, $type = null) { $this->_values[$param] = $value; @@ -160,6 +161,7 @@ public function bindValue($param, $value, $type = null) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function bindParam($column, &$variable, $type = null, $length = null, $driverData = null) { $column = $this->_paramMap[$column] ?? $column; @@ -187,6 +189,7 @@ public function bindParam($column, &$variable, $type = null, $length = null, $dr /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function closeCursor() { return true; @@ -205,6 +208,7 @@ public function __destruct() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function columnCount() { return oci_num_fields($this->_sth); @@ -213,6 +217,7 @@ public function columnCount() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function errorCode() { $error = oci_error($this->_sth); @@ -228,6 +233,7 @@ public function errorCode() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function errorInfo() { return oci_error($this->_sth); @@ -236,6 +242,7 @@ public function errorInfo() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function execute($params = null) { if ($params) { @@ -270,6 +277,7 @@ public function getIterator(): Iterator /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function fetch($fetchMode = null, $orientation = null, $offset = null) { $toLowercase = ($this->getAttribute(PDO::ATTR_CASE) == PDO::CASE_LOWER); @@ -402,6 +410,7 @@ public function fetch($fetchMode = null, $orientation = null, $offset = null) * {@inheritdoc} */ //public function fetchAll(int $fetchMode = PDO::FETCH_DEFAULT, $className = null, $arguments = null): array + #[\ReturnTypeWillChange] public function fetchAll(int $fetchMode = PDO::FETCH_DEFAULT, mixed ...$arguments): array { $this->setFetchMode($fetchMode, ...$arguments); @@ -426,6 +435,7 @@ public function fetchAll(int $fetchMode = PDO::FETCH_DEFAULT, mixed ...$argument /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function fetchColumn($columnIndex = 0) { $row = oci_fetch_array($this->_sth, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS); @@ -440,6 +450,7 @@ public function fetchColumn($columnIndex = 0) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function rowCount() { if (is_resource($this->_sth)) { @@ -455,6 +466,7 @@ public function rowCount() * @param string $attribute Attribute id. * @return mixed The attribute value. */ + #[\ReturnTypeWillChange] public function getAttribute($attribute) { return $this->_conn->getConfig((string)$attribute); @@ -470,6 +482,7 @@ public function getAttribute($attribute) * @return bool TRUE on success or FALSE on failure. */ //public function setFetchMode($fetchMode, $param = null, $arguments = []) + #[\ReturnTypeWillChange] public function setFetchMode(int $fetchMode, mixed ...$arguments) { $this->_defaultFetchMode = $fetchMode; From 1f0bb96046c9ee98ebb755283d708cf4e21d0d63 Mon Sep 17 00:00:00 2001 From: Fernando Herrero Date: Thu, 21 Mar 2024 13:14:34 +0100 Subject: [PATCH 4/5] BaseSchema and SqlDialectTrait deprecation --- src/Database/Dialect/OracleDialectTrait.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Database/Dialect/OracleDialectTrait.php b/src/Database/Dialect/OracleDialectTrait.php index beca99a..3f3bc0e 100644 --- a/src/Database/Dialect/OracleDialectTrait.php +++ b/src/Database/Dialect/OracleDialectTrait.php @@ -16,8 +16,8 @@ use Cake\Database\ExpressionInterface; use Cake\Database\Query; use Cake\Database\QueryCompiler; -use Cake\Database\Schema\BaseSchema; -use Cake\Database\SqlDialectTrait; +use Cake\Database\Schema\SchemaDialect; +use Cake\Database\Driver\SqlDialectTrait; use CakeDC\OracleDriver\Database\Expression\SimpleExpression; use CakeDC\OracleDriver\Database\Oracle12Compiler; use CakeDC\OracleDriver\Database\OracleCompiler; @@ -244,7 +244,7 @@ protected function _transformFunctionExpression(FunctionExpression $expression): * * @return \CakeDC\OracleDriver\Database\Schema\OracleSchema */ - public function schemaDialect(): BaseSchema + public function schemaDialect(): SchemaDialect { if (!$this->_schemaDialect) { $this->_schemaDialect = new OracleSchema($this); From b3093b162fecfca8efd498f8c222773a569b3dff Mon Sep 17 00:00:00 2001 From: Fernando Herrero Date: Fri, 22 Mar 2024 10:02:22 +0100 Subject: [PATCH 5/5] Return types --- src/Database/OCI8/OCI8Connection.php | 31 ++++++++---------------- src/Database/OCI8/OCI8Statement.php | 35 ++++++++++------------------ 2 files changed, 22 insertions(+), 44 deletions(-) diff --git a/src/Database/OCI8/OCI8Connection.php b/src/Database/OCI8/OCI8Connection.php index a4c4bf8..9ac3f10 100644 --- a/src/Database/OCI8/OCI8Connection.php +++ b/src/Database/OCI8/OCI8Connection.php @@ -80,8 +80,6 @@ public function __construct($dsn, $username, $password, $options) } else { $this->dbh = @oci_connect($username, $password, $dsn); } - -// $this->dbh = @oci_connect($username, $password, $dsn, $charset, $sessionMode); } if (!$this->dbh) { @@ -120,8 +118,7 @@ public function getServerVersion() /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function prepare($statement, $options = null) + public function prepare($statement, $options = null): PDOStatement|false { return new OCI8Statement($this->dbh, $statement, $this); } @@ -129,7 +126,7 @@ public function prepare($statement, $options = null) /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] + //#[\ReturnTypeWillChange] public function query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement|false { $args = func_get_args(); @@ -143,8 +140,7 @@ public function query(string $query, ?int $fetchMode = null, mixed ...$fetchMode /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function quote($string, $type = \PDO::PARAM_STR) + public function quote($string, $type = \PDO::PARAM_STR): string|false { if (is_int($string) || is_float($string)) { return $string; @@ -157,8 +153,7 @@ public function quote($string, $type = \PDO::PARAM_STR) /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function exec($statement) + public function exec($statement): int|false { $stmt = $this->prepare($statement); $stmt->execute(); @@ -190,8 +185,7 @@ public function isTransaction() /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function inTransaction() + public function inTransaction(): bool { return $this->executeMode === OCI_NO_AUTO_COMMIT; } @@ -199,8 +193,7 @@ public function inTransaction() /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function beginTransaction() + public function beginTransaction(): bool { $this->executeMode = OCI_NO_AUTO_COMMIT; @@ -210,8 +203,7 @@ public function beginTransaction() /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function commit() + public function commit(): bool { if (!oci_commit($this->dbh)) { throw OCI8Exception::fromErrorInfo($this->errorInfo()); @@ -224,8 +216,7 @@ public function commit() /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function rollBack() + public function rollBack(): bool { if (!oci_rollback($this->dbh)) { throw OCI8Exception::fromErrorInfo($this->errorInfo()); @@ -238,8 +229,7 @@ public function rollBack() /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function errorCode() + public function errorCode(): ?string { $error = oci_error($this->dbh); if ($error !== false) { @@ -254,8 +244,7 @@ public function errorCode() /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function errorInfo() + public function errorInfo(): array { return oci_error($this->dbh); } diff --git a/src/Database/OCI8/OCI8Statement.php b/src/Database/OCI8/OCI8Statement.php index 32b7fca..6c2d52c 100644 --- a/src/Database/OCI8/OCI8Statement.php +++ b/src/Database/OCI8/OCI8Statement.php @@ -150,8 +150,7 @@ public static function convertPositionalToNamedPlaceholders($statement) /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function bindValue($param, $value, $type = null) + public function bindValue($param, $value, $type = null): bool { $this->_values[$param] = $value; @@ -161,8 +160,7 @@ public function bindValue($param, $value, $type = null) /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function bindParam($column, &$variable, $type = null, $length = null, $driverData = null) + public function bindParam($column, &$variable, $type = null, $length = null, $driverData = null): bool { $column = $this->_paramMap[$column] ?? $column; @@ -189,8 +187,7 @@ public function bindParam($column, &$variable, $type = null, $length = null, $dr /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function closeCursor() + public function closeCursor(): bool { return true; } @@ -208,8 +205,7 @@ public function __destruct() /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function columnCount() + public function columnCount(): int { return oci_num_fields($this->_sth); } @@ -217,8 +213,7 @@ public function columnCount() /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function errorCode() + public function errorCode(): ?string { $error = oci_error($this->_sth); if ($error !== false) { @@ -233,8 +228,7 @@ public function errorCode() /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function errorInfo() + public function errorInfo(): array { return oci_error($this->_sth); } @@ -242,8 +236,7 @@ public function errorInfo() /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function execute($params = null) + public function execute($params = null): bool { if ($params) { $hasZeroIndex = array_key_exists(0, $params); @@ -277,8 +270,7 @@ public function getIterator(): Iterator /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function fetch($fetchMode = null, $orientation = null, $offset = null) + public function fetch($fetchMode = null, $orientation = null, $offset = null): mixed { $toLowercase = ($this->getAttribute(PDO::ATTR_CASE) == PDO::CASE_LOWER); $nullToString = ($this->getAttribute(PDO::ATTR_ORACLE_NULLS) == PDO::NULL_TO_STRING); @@ -435,8 +427,7 @@ public function fetchAll(int $fetchMode = PDO::FETCH_DEFAULT, mixed ...$argument /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function fetchColumn($columnIndex = 0) + public function fetchColumn($columnIndex = 0): mixed { $row = oci_fetch_array($this->_sth, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS); @@ -450,8 +441,7 @@ public function fetchColumn($columnIndex = 0) /** * {@inheritdoc} */ - #[\ReturnTypeWillChange] - public function rowCount() + public function rowCount(): int { if (is_resource($this->_sth)) { return oci_num_rows($this->_sth); @@ -466,8 +456,7 @@ public function rowCount() * @param string $attribute Attribute id. * @return mixed The attribute value. */ - #[\ReturnTypeWillChange] - public function getAttribute($attribute) + public function getAttribute($attribute): mixed { return $this->_conn->getConfig((string)$attribute); } @@ -482,7 +471,7 @@ public function getAttribute($attribute) * @return bool TRUE on success or FALSE on failure. */ //public function setFetchMode($fetchMode, $param = null, $arguments = []) - #[\ReturnTypeWillChange] + //#[\ReturnTypeWillChange] public function setFetchMode(int $fetchMode, mixed ...$arguments) { $this->_defaultFetchMode = $fetchMode;