Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: \OCP\IDBConnection return declarations #41115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
*/
Comment on lines -151 to -158
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why delete all the PHPdoc?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will replace them with real type declarations.

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