From d42fc588b461e10c7c96bc5a69644212350072c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Wed, 19 Jan 2022 14:57:14 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E6=94=B9=E5=90=8D"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit fdf58326 --- ActiveQuery.php | 2 +- Condition/Condition.php | 2 +- HasCount.php | 4 ++-- HasMany.php | 4 ++-- HasOne.php | 6 +++--- Mysql/PDO.php | 7 ++----- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/ActiveQuery.php b/ActiveQuery.php index 019fe72..5ac2645 100644 --- a/ActiveQuery.php +++ b/ActiveQuery.php @@ -135,7 +135,7 @@ class ActiveQuery extends Component implements ISqlBuilder $name = explode(',', $name); } foreach ($name as $val) { - array_push($this->with, $val); + $this->with[] = $val; } return $this; } diff --git a/Condition/Condition.php b/Condition/Condition.php index f8267b7..21daf09 100644 --- a/Condition/Condition.php +++ b/Condition/Condition.php @@ -18,7 +18,7 @@ abstract class Condition extends Component protected string $opera = '='; /** @var array|mixed */ - protected $value; + protected mixed $value; const INT_TYPE = ['bit', 'bool', 'tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'float', 'double', 'decimal', 'timestamp']; diff --git a/HasCount.php b/HasCount.php index b4ae522..067e1be 100644 --- a/HasCount.php +++ b/HasCount.php @@ -17,9 +17,9 @@ class HasCount extends HasBase * @param $name * @param $arguments * @return ActiveQuery - * @throws Exception + * @throws ActiveQuery|static */ - public function __call($name, $arguments): mixed + public function __call($name, $arguments) { if (method_exists($this, $name)) { return call_user_func([$this, $name], ...$arguments); diff --git a/HasMany.php b/HasMany.php index 24bc46f..49df7fa 100644 --- a/HasMany.php +++ b/HasMany.php @@ -23,9 +23,9 @@ class HasMany extends HasBase /** * @param $name * @param $arguments - * @return ActiveQuery + * @return ActiveQuery|static */ - public function __call($name, $arguments): mixed + public function __call($name, $arguments) { if (method_exists($this, $name)) { return call_user_func([$this, $name], ...$arguments); diff --git a/HasOne.php b/HasOne.php index ef4c1a1..4d7e726 100644 --- a/HasOne.php +++ b/HasOne.php @@ -9,8 +9,8 @@ declare(strict_types=1); namespace Database; -use Exception; use Database\Traits\HasBase; +use Exception; /** * Class HasOne @@ -23,9 +23,9 @@ class HasOne extends HasBase /** * @param $name * @param $arguments - * @return ActiveQuery + * @return ActiveQuery|static */ - public function __call($name, $arguments): mixed + public function __call($name, $arguments) { if (method_exists($this, $name)) { return call_user_func([$this, $name], ...$arguments); diff --git a/Mysql/PDO.php b/Mysql/PDO.php index bead5d0..b6ec86d 100644 --- a/Mysql/PDO.php +++ b/Mysql/PDO.php @@ -39,9 +39,6 @@ class PDO implements StopHeartbeatCheck public int $read_timeout; - private EventProvider $eventProvider; - - public array $attributes = []; @@ -67,8 +64,8 @@ class PDO implements StopHeartbeatCheck public function init(): void { $this->heartbeat_check(); - $this->eventProvider = Kiri::getDi()->get(EventProvider::class); - $this->eventProvider->on(OnWorkerExit::class, [$this, 'onWorkerExit']); + $eventProvider = Kiri::getDi()->get(EventProvider::class); + $eventProvider->on(OnWorkerExit::class, [$this, 'onWorkerExit']); }