Merge pull request #25929 from nextcloud/techdept/psalm/25839/redundantcasts

Remove Redundantcasts
This commit is contained in:
Roeland Jago Douma 2021-03-05 08:42:54 +01:00 committed by GitHub
commit 85e48d796c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -1271,11 +1271,11 @@ class QueryBuilder implements IQueryBuilder {
* @return int
* @throws \BadMethodCallException When being called before an insert query has been run.
*/
public function getLastInsertId() {
public function getLastInsertId(): int {
if ($this->getType() === \Doctrine\DBAL\Query\QueryBuilder::INSERT && $this->lastInsertedTable) {
// lastInsertId() needs the prefix but no quotes
$table = $this->prefixTableName($this->lastInsertedTable);
return (int) $this->connection->lastInsertId($table);
return $this->connection->lastInsertId($table);
}
throw new \BadMethodCallException('Invalid call to getLastInsertId without using insert() before.');

View File

@ -77,7 +77,7 @@ class Storage {
$connection = \OC::$server->getDatabaseConnection();
$available = $isAvailable ? 1 : 0;
if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId, 'available' => $available])) {
$this->numericId = (int)$connection->lastInsertId('*PREFIX*storages');
$this->numericId = $connection->lastInsertId('*PREFIX*storages');
} else {
if ($row = self::getStorageById($this->storageId)) {
$this->numericId = (int)$row['numeric_id'];

View File

@ -990,7 +990,7 @@ interface IQueryBuilder {
* @throws \BadMethodCallException When being called before an insert query has been run.
* @since 9.0.0
*/
public function getLastInsertId();
public function getLastInsertId(): int;
/**
* Returns the table name quoted and with database prefix as needed by the implementation