Skip to content

Commit

Permalink
fix: \OCP\IDBConnection return declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 committed Nov 21, 2023
1 parent 7820e68 commit 58ac4fd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 22 deletions.
4 changes: 2 additions & 2 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1477,14 +1477,14 @@ public function createSchedulingObject($principalUri, $objectUri, $objectData) {
*/
protected function addChange($calendarId, $objectUri, $operation) {
$stmt = $this->db->prepare('INSERT INTO `*PREFIX*calendarchanges` (`uri`, `synctoken`, `calendarid`, `operation`) SELECT ?, `synctoken`, ?, ? FROM `*PREFIX*calendars` WHERE `id` = ?');
$stmt->execute([
$stmt->executeStatement([
$objectUri,
$calendarId,
$operation,
$calendarId
]);
$stmt = $this->db->prepare('UPDATE `*PREFIX*calendars` SET `synctoken` = `synctoken` + 1 WHERE `id` = ?');
$stmt->execute([
$stmt->executeStatement([
$calendarId
]);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/AppFramework/Db/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(IDBConnection $connection) {
/**
* @inheritdoc
*/
public function getQueryBuilder() {
public function getQueryBuilder(): IQueryBuilder {
return $this->connection->getQueryBuilder();
}

Expand Down
18 changes: 3 additions & 15 deletions lib/private/DB/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Statement;
use OC\DB\QueryBuilder\QueryBuilder;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
Expand Down Expand Up @@ -63,12 +64,7 @@ public function connect() {
}
}

/**
* Returns a QueryBuilder for the connection.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder
*/
public function getQueryBuilder() {
public function getQueryBuilder(): IQueryBuilder {
return new QueryBuilder($this);
}

Expand Down Expand Up @@ -148,14 +144,6 @@ public function __construct(
parent::setTransactionIsolation(parent::TRANSACTION_READ_COMMITTED);
}

/**
* Prepares an SQL statement.
*
* @param string $statement The SQL statement to prepare.
* @param int $limit
* @param int $offset
* @return \Doctrine\DBAL\Driver\Statement The prepared statement.
*/
public function prepare($statement, $limit=null, $offset=null) {
if ($limit === -1) {
$limit = null;
Expand All @@ -181,7 +169,7 @@ public function prepare($statement, $limit=null, $offset=null) {
* @param array $types The types the previous parameters are in.
* @param \Doctrine\DBAL\Cache\QueryCacheProfile|null $qcp The query cache profile, optional.
*
* @return \Doctrine\DBAL\Driver\Statement The executed statement.
* @return Statement The executed statement.
*
* @throws \Doctrine\DBAL\DBALException
*/
Expand Down
9 changes: 5 additions & 4 deletions lib/public/IDBConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Statement;
use OCP\DB\QueryBuilder\IQueryBuilder;

/**
Expand All @@ -47,17 +48,17 @@ interface IDBConnection {
/**
* Gets the QueryBuilder for the connection.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder
* @return IQueryBuilder
* @since 8.2.0
*/
public function getQueryBuilder();
public function getQueryBuilder(): IQueryBuilder;

/**
* Used to abstract the ownCloud database access away
* @param string $sql the sql query with ? placeholder for params
* @param int $limit the maximum number of rows
* @param int $offset from which row we want to start
* @return \Doctrine\DBAL\Driver\Statement The prepared statement.
* @return Statement The prepared statement.
* @since 6.0.0
*/
public function prepare($sql, $limit=null, $offset=null);
Expand All @@ -71,7 +72,7 @@ public function prepare($sql, $limit=null, $offset=null);
* @param string $query The SQL query to execute.
* @param string[] $params The parameters to bind to the query, if any.
* @param array $types The types the previous parameters are in.
* @return \Doctrine\DBAL\Driver\Statement The executed statement.
* @return Statement The executed statement.
* @since 8.0.0
*/
public function executeQuery($query, array $params = [], $types = []);
Expand Down

0 comments on commit 58ac4fd

Please sign in to comment.