From 6313caf8fabed22377fe9d4cac2da34c311982b3 Mon Sep 17 00:00:00 2001 From: Alexander Barker Date: Thu, 11 Aug 2022 09:14:35 -0700 Subject: [PATCH] Chnage all statement return types to static --- src/AdvancedStatement.php | 4 ++-- src/AdvancedStatementInterface.php | 2 +- src/Statement/Call.php | 4 ++-- src/Statement/CallInterface.php | 2 +- src/Statement/Delete.php | 4 ++-- src/Statement/DeleteInterface.php | 2 +- src/Statement/Insert.php | 24 ++++++++++++------------ src/Statement/InsertInterface.php | 12 ++++++------ src/Statement/Select.php | 28 ++++++++++++++-------------- src/Statement/SelectInterface.php | 14 +++++++------- src/Statement/Update.php | 12 ++++++------ src/Statement/UpdateInterface.php | 6 +++--- 12 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/AdvancedStatement.php b/src/AdvancedStatement.php index d0ba23f..d09c46a 100644 --- a/src/AdvancedStatement.php +++ b/src/AdvancedStatement.php @@ -117,9 +117,9 @@ protected function renderOrderBy(): string /** * @param LimitInterface $limit * - * @return self + * @return static */ - public function limit(LimitInterface $limit): self + public function limit(LimitInterface $limit) { $this->limit = $limit; diff --git a/src/AdvancedStatementInterface.php b/src/AdvancedStatementInterface.php index 51d3ed1..4ce726e 100644 --- a/src/AdvancedStatementInterface.php +++ b/src/AdvancedStatementInterface.php @@ -38,7 +38,7 @@ public function orderBy(string $column, string $direction = ''); /** * @param LimitInterface $limit * - * @return self + * @return static */ public function limit(LimitInterface $limit); } diff --git a/src/Statement/Call.php b/src/Statement/Call.php index 24996ba..a1d4f72 100644 --- a/src/Statement/Call.php +++ b/src/Statement/Call.php @@ -33,9 +33,9 @@ public function __construct(Database $dbh, ?MethodInterface $procedure = null) /** * @param MethodInterface $procedure * - * @return self + * @return static */ - public function method(MethodInterface $procedure): self + public function method(MethodInterface $procedure) { $this->method = $procedure; diff --git a/src/Statement/CallInterface.php b/src/Statement/CallInterface.php index 0c0f642..614cffa 100644 --- a/src/Statement/CallInterface.php +++ b/src/Statement/CallInterface.php @@ -15,7 +15,7 @@ interface CallInterface extends StatementInterface /** * @param MethodInterface $procedure * - * @return self + * @return static */ public function method(MethodInterface $procedure); } diff --git a/src/Statement/Delete.php b/src/Statement/Delete.php index 4f150c5..abcdd1e 100644 --- a/src/Statement/Delete.php +++ b/src/Statement/Delete.php @@ -32,9 +32,9 @@ public function __construct(Database $dbh, $table = null) /** * @param string|array $table * - * @return self + * @return static */ - public function from($table): self + public function from($table) { $this->table = $table; diff --git a/src/Statement/DeleteInterface.php b/src/Statement/DeleteInterface.php index 9cb260a..d2a646f 100644 --- a/src/Statement/DeleteInterface.php +++ b/src/Statement/DeleteInterface.php @@ -14,7 +14,7 @@ interface DeleteInterface extends StatementInterface /** * @param string|array $table * - * @return self + * @return static */ public function from($table); } diff --git a/src/Statement/Insert.php b/src/Statement/Insert.php index ab100ae..860375d 100644 --- a/src/Statement/Insert.php +++ b/src/Statement/Insert.php @@ -47,9 +47,9 @@ public function __construct(Database $dbh, array $columns = []) /** * @param string $level * - * @return self + * @return static */ - public function priority(string $level): self + public function priority(string $level) { $this->priority = strtoupper(trim($level)); @@ -84,9 +84,9 @@ protected function renderPriority(): string } /** - * @return self + * @return static */ - public function ignore(): self + public function ignore() { $this->ignore = true; @@ -110,9 +110,9 @@ protected function renderIgnore(): string /** * @param string $table * - * @return self + * @return static */ - public function into(string $table): self + public function into(string $table) { $this->table = $table; @@ -134,9 +134,9 @@ protected function renderInto(): string /** * @param string ...$columns * - * @return self + * @return static */ - public function columns(string ...$columns): self + public function columns(string ...$columns) { $this->columns = $columns; @@ -160,9 +160,9 @@ protected function renderColumns(): string * @param float|int|string|RawInterface|SelectInterface $value * @param float|int|string|RawInterface ...$values * - * @return self + * @return static */ - public function values($value, ...$values): self + public function values($value, ...$values) { array_unshift($values, $value); $this->values[] = $values; @@ -236,9 +236,9 @@ protected function renderValues(): string /** * @param array $paris * - * @return self + * @return static */ - public function onDuplicateUpdate(array $paris = []): self + public function onDuplicateUpdate(array $paris = []) { $this->update = $paris; diff --git a/src/Statement/InsertInterface.php b/src/Statement/InsertInterface.php index 63a0090..857c35e 100644 --- a/src/Statement/InsertInterface.php +++ b/src/Statement/InsertInterface.php @@ -15,26 +15,26 @@ interface InsertInterface extends StatementInterface /** * @param string $level * - * @return self + * @return static */ public function priority(string $level); /** - * @return self + * @return static */ public function ignore(); /** * @param string $table * - * @return self + * @return static */ public function into(string $table); /** * @param string ...$columns * - * @return self + * @return static */ public function columns(string ...$columns); @@ -42,14 +42,14 @@ public function columns(string ...$columns); * @param float|int|string|RawInterface|SelectInterface $value * @param float|int|string|RawInterface ...$values * - * @return self + * @return static */ public function values($value, ...$values); /** * @param array $paris * - * @return self + * @return static */ public function onDuplicateUpdate(array $paris = []); } diff --git a/src/Statement/Select.php b/src/Statement/Select.php index 106c101..4531df8 100644 --- a/src/Statement/Select.php +++ b/src/Statement/Select.php @@ -48,9 +48,9 @@ public function __construct(Database $dbh, array $columns = ['*']) } /** - * @return self + * @return static */ - public function distinct(): self + public function distinct() { $this->distinct = true; @@ -73,9 +73,9 @@ protected function renderDistinct(): string /** * @param array $columns * - * @return self + * @return static */ - public function columns(array $columns = ['*']): self + public function columns(array $columns = ['*']) { if (empty($columns)) { $this->columns = ['*']; @@ -114,9 +114,9 @@ protected function renderColumns(): string /** * @param string|array $table * - * @return self + * @return static */ - public function from($table): self + public function from($table) { $this->table = $table; @@ -152,9 +152,9 @@ protected function renderFrom(): string /** * @param SelectInterface $query * - * @return self + * @return static */ - public function union(SelectInterface $query): self + public function union(SelectInterface $query) { $this->union[$this->getUnionCount()] = $query; @@ -164,9 +164,9 @@ public function union(SelectInterface $query): self /** * @param SelectInterface $query * - * @return self + * @return static */ - public function unionAll(SelectInterface $query): self + public function unionAll(SelectInterface $query) { $this->unionAll[$this->getUnionCount()] = $query; @@ -206,9 +206,9 @@ protected function renderUnion(): string /** * @param string ...$columns * - * @return self + * @return static */ - public function groupBy(string ...$columns): self + public function groupBy(string ...$columns) { $this->groupBy = array_merge($this->groupBy, $columns); @@ -231,9 +231,9 @@ protected function renderGroupBy(): string /** * @param ConditionalInterface $clause * - * @return self + * @return static */ - public function having(ConditionalInterface $clause): self + public function having(ConditionalInterface $clause) { $this->having = $clause; diff --git a/src/Statement/SelectInterface.php b/src/Statement/SelectInterface.php index 80d66e9..b4cfe4a 100644 --- a/src/Statement/SelectInterface.php +++ b/src/Statement/SelectInterface.php @@ -13,49 +13,49 @@ interface SelectInterface extends AdvancedStatementInterface { /** - * @return self + * @return static */ public function distinct(); /** * @param array $columns * - * @return self + * @return static */ public function columns(array $columns = ['*']); /** * @param string|array $table * - * @return self + * @return static */ public function from($table); /** * @param SelectInterface $query * - * @return self + * @return static */ public function union(SelectInterface $query); /** * @param SelectInterface $query * - * @return self + * @return static */ public function unionAll(SelectInterface $query); /** * @param string ...$columns * - * @return self + * @return static */ public function groupBy(string ...$columns); /** * @param ConditionalInterface $clause * - * @return self + * @return static */ public function having(ConditionalInterface $clause); } diff --git a/src/Statement/Update.php b/src/Statement/Update.php index be95dce..47b481b 100644 --- a/src/Statement/Update.php +++ b/src/Statement/Update.php @@ -35,9 +35,9 @@ public function __construct(Database $dbh, array $pairs = []) /** * @param string $table * - * @return self + * @return static */ - public function table(string $table): self + public function table(string $table) { $this->table = $table; @@ -60,9 +60,9 @@ protected function renderTable(): string * @param string $column * @param float|int|string|RawInterface|SelectInterface $value * - * @return self + * @return static */ - public function set(string $column, $value): self + public function set(string $column, $value) { $this->pairs[$column] = $value; @@ -72,9 +72,9 @@ public function set(string $column, $value): self /** * @param array $pairs * - * @return self + * @return static */ - public function pairs(array $pairs): self + public function pairs(array $pairs) { $this->pairs = array_merge($this->pairs, $pairs); diff --git a/src/Statement/UpdateInterface.php b/src/Statement/UpdateInterface.php index 3ffa46d..023dd8f 100644 --- a/src/Statement/UpdateInterface.php +++ b/src/Statement/UpdateInterface.php @@ -15,7 +15,7 @@ interface UpdateInterface extends AdvancedStatementInterface /** * @param string $table * - * @return self + * @return static */ public function table(string $table); @@ -23,14 +23,14 @@ public function table(string $table); * @param string $column * @param float|int|string|RawInterface|SelectInterface $value * - * @return self + * @return static */ public function set(string $column, $value); /** * @param array $pairs * - * @return self + * @return static */ public function pairs(array $pairs); }