This commit is contained in:
2021-06-25 11:26:23 +08:00
parent aa72ac2eb9
commit 0db42d3a38
+8 -8
View File
@@ -14,7 +14,6 @@ use Exception;
use PDO;
use PDOStatement;
use Snowflake\Abstracts\Component;
use Swoole\Coroutine;
/**
* Class Command
@@ -56,11 +55,11 @@ class Command extends Component
/**
* @param bool $isInsert
* @param bool $hasAutoIncrement
* @param bool|null $hasAutoIncrement
* @return int|bool|array|string|null
* @throws Exception
*/
public function save($isInsert = TRUE, $hasAutoIncrement = null): int|bool|array|string|null
public function save(bool $isInsert = TRUE, bool $hasAutoIncrement = null): int|bool|array|string|null
{
return $this->execute(static::EXECUTE, $isInsert, $hasAutoIncrement);
}
@@ -114,13 +113,14 @@ class Command extends Component
/**
* @param $type
* @param null $isInsert
* @param bool $hasAutoIncrement
* @param bool|null $hasAutoIncrement
* @return int|bool|array|string|null
* @throws Exception
*/
private function execute($type, $isInsert = null, $hasAutoIncrement = null): int|bool|array|string|null
private function execute($type, $isInsert = null, bool $hasAutoIncrement = null): int|bool|array|string|null
{
try {
$this->debug('Execute: ' . $this->sql);
if ($type === static::EXECUTE) {
$result = $this->insert_or_change($isInsert, $hasAutoIncrement);
} else {
@@ -206,7 +206,7 @@ class Command extends Component
* @param $prepare
* @return string
*/
private function errorMessage($prepare)
private function errorMessage($prepare): string
{
return $this->sql . ':' . ($prepare->errorInfo()[2] ?? static::DB_ERROR_MESSAGE);
}
@@ -235,7 +235,7 @@ class Command extends Component
* @return bool|int
* @throws \Exception
*/
private function checkResponse($prepare, $connect)
private function checkResponse($prepare, $connect): bool|int
{
$result = $prepare->execute($this->params);
if ($result === false) {
@@ -278,7 +278,7 @@ class Command extends Component
* @return int|bool|array|string|null
* @throws Exception
*/
public function exec($scope = null, $insert = false): int|bool|array|string|null
public function exec($scope = null, bool $insert = false): int|bool|array|string|null
{
return $this->execute(static::EXECUTE, $insert, $scope);
}