Skip to content

Commit

Permalink
Fix covariance
Browse files Browse the repository at this point in the history
  • Loading branch information
phansys committed Feb 7, 2023
1 parent 6b36cb3 commit 2a3ee22
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Cache/ArrayResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function fetchFirstColumn(): array
return FetchUtils::fetchFirstColumn($this);
}

/** @return non-negative-int */
public function rowCount(): int
{
return count($this->data);
Expand Down
2 changes: 1 addition & 1 deletion src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ public function getTransactionNestingLevel(): int
*
* If the underlying driver does not support identity columns, an exception is thrown.
*
* @return non-negative-int|numeric-string The last insert ID, as an integer or a numeric string.
* @return int|numeric-string The last insert ID, as an integer or a numeric string.
*
* @throws Exception
*/
Expand Down
1 change: 1 addition & 0 deletions src/Driver/IBMDB2/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function quote(string $value): string
return "'" . db2_escape_string($value) . "'";
}

/** @return non-negative-int */
public function exec(string $sql): int
{
$stmt = @db2_exec($this->connection, $sql);
Expand Down
1 change: 1 addition & 0 deletions src/Driver/IBMDB2/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public function fetchFirstColumn(): array
return FetchUtils::fetchFirstColumn($this);
}

/** @return non-negative-int */
public function rowCount(): int
{
return @db2_num_rows($this->statement);
Expand Down
2 changes: 2 additions & 0 deletions src/Driver/OCI8/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public function quote(string $value): string
}

/**
* @return non-negative-int
*
* @throws Exception
* @throws Parser\Exception
*/
Expand Down
1 change: 1 addition & 0 deletions src/Driver/OCI8/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function fetchFirstColumn(): array
return $this->fetchAll(OCI_NUM, OCI_FETCHSTATEMENT_BY_COLUMN)[0];
}

/** @return non-negative-int */
public function rowCount(): int
{
$count = oci_num_rows($this->statement);
Expand Down
1 change: 1 addition & 0 deletions src/Driver/PDO/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function __construct(private readonly PDO $connection)
$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}

/** @return non-negative-int */
public function exec(string $sql): int
{
try {
Expand Down
1 change: 1 addition & 0 deletions src/Driver/PDO/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function fetchFirstColumn(): array
return $this->fetchAll(PDO::FETCH_COLUMN);
}

/** @return non-negative-int */
public function rowCount(): int
{
try {
Expand Down
1 change: 1 addition & 0 deletions src/Driver/PgSQL/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public function quote(string $value): string
return $quotedValue;
}

/** @return non-negative-int */
public function exec(string $sql): int
{
return $this->query($sql)->rowCount();
Expand Down
1 change: 1 addition & 0 deletions src/Driver/PgSQL/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public function fetchFirstColumn(): array
);
}

/** @return non-negative-int */
public function rowCount(): int
{
if ($this->result === null) {
Expand Down
1 change: 1 addition & 0 deletions src/Driver/SQLSrv/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function quote(string $value): string
return "'" . str_replace("'", "''", $value) . "'";
}

/** @return non-negative-int */
public function exec(string $sql): int
{
$stmt = sqlsrv_query($this->connection, $sql);
Expand Down
1 change: 1 addition & 0 deletions src/Driver/SQLSrv/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function fetchFirstColumn(): array
return FetchUtils::fetchFirstColumn($this);
}

/** @return non-negative-int */
public function rowCount(): int
{
$count = sqlsrv_rows_affected($this->statement);
Expand Down
1 change: 1 addition & 0 deletions src/Driver/SQLite3/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function quote(string $value): string
return sprintf('\'%s\'', SQLite3::escapeString($value));
}

/** @return non-negative-int */
public function exec(string $sql): int
{
try {
Expand Down
1 change: 1 addition & 0 deletions src/Driver/SQLite3/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function fetchFirstColumn(): array
return FetchUtils::fetchFirstColumn($this);
}

/** @return non-negative-int */
public function rowCount(): int
{
return $this->changes;
Expand Down

0 comments on commit 2a3ee22

Please sign in to comment.