mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-31 21:12:41 +00:00
Add missing return type hints where possible
This commit is contained in:
parent
1b8e1e499b
commit
31cdf313a4
7 changed files with 12 additions and 12 deletions
|
@ -7,7 +7,7 @@ declare(strict_types=1);
|
|||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
trait PDOError {
|
||||
public function exceptionBuild() {
|
||||
public function exceptionBuild(): array {
|
||||
if ($this instanceof Statement) {
|
||||
$err = $this->st->errorInfo();
|
||||
} else {
|
||||
|
|
|
@ -16,11 +16,11 @@ class PDOResult extends AbstractResult {
|
|||
|
||||
// actual public methods
|
||||
|
||||
public function changes() {
|
||||
public function changes(): int {
|
||||
return $this->rows;
|
||||
}
|
||||
|
||||
public function lastId() {
|
||||
public function lastId(): int {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,6 @@ interface Result extends \Iterator {
|
|||
public function getAll(): array;
|
||||
public function getValue();
|
||||
|
||||
public function changes();
|
||||
public function lastId();
|
||||
public function changes(): int;
|
||||
public function lastId(): int;
|
||||
}
|
||||
|
|
|
@ -15,13 +15,13 @@ class ResultAggregate extends AbstractResult {
|
|||
|
||||
// actual public methods
|
||||
|
||||
public function changes() {
|
||||
public function changes(): int {
|
||||
return array_reduce($this->data, function ($sum, $value) {
|
||||
return $sum + $value->changes();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
public function lastId() {
|
||||
public function lastId(): int {
|
||||
return $this->data[sizeof($this->data) - 1]->lastId();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ namespace JKingWeb\Arsse\Db;
|
|||
use JKingWeb\Arsse\Db\Exception;
|
||||
|
||||
class ResultEmpty extends AbstractResult {
|
||||
public function changes() {
|
||||
public function changes(): int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function lastId() {
|
||||
public function lastId(): int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use JKingWeb\Arsse\Db\ExceptionInput;
|
|||
use JKingWeb\Arsse\Db\ExceptionTimeout;
|
||||
|
||||
trait ExceptionBuilder {
|
||||
public function exceptionBuild() {
|
||||
public function exceptionBuild(): array {
|
||||
switch ($this->db->lastErrorCode()) {
|
||||
case self::SQLITE_BUSY:
|
||||
return [ExceptionTimeout::class, 'general', $this->db->lastErrorMsg()];
|
||||
|
|
|
@ -17,11 +17,11 @@ class Result extends \JKingWeb\Arsse\Db\AbstractResult {
|
|||
|
||||
// actual public methods
|
||||
|
||||
public function changes() {
|
||||
public function changes(): int {
|
||||
return $this->rows;
|
||||
}
|
||||
|
||||
public function lastId() {
|
||||
public function lastId(): int {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue