diff --git a/ActiveQuery.php b/ActiveQuery.php index 976b1c8..55dff1e 100644 --- a/ActiveQuery.php +++ b/ActiveQuery.php @@ -85,7 +85,7 @@ class ActiveQuery extends Component implements ISqlBuilder * @param int $size * @param int $page * @return array - * @throws Exception + * @throws */ #[ArrayShape([])] public function pagination(int $size = 20, int $page = 1): array @@ -145,7 +145,7 @@ class ActiveQuery extends Component implements ISqlBuilder * @param $sql * @param array $params * @return mixed - * @throws Exception + * @throws */ public function execute($sql, array $params = []): Command { @@ -155,7 +155,7 @@ class ActiveQuery extends Component implements ISqlBuilder /** * @return ModelInterface|null - * @throws Exception + * @throws */ public function first(): ModelInterface|null { @@ -169,7 +169,7 @@ class ActiveQuery extends Component implements ISqlBuilder /** * @return string - * @throws Exception + * @throws */ public function toSql(): string { @@ -187,7 +187,7 @@ class ActiveQuery extends Component implements ISqlBuilder /** - * @throws Exception + * @throws */ public function flush(): array|bool|int|string|null { @@ -200,7 +200,7 @@ class ActiveQuery extends Component implements ISqlBuilder * @param callable $callback * @param int $offset * @return Pagination - * @throws Exception + * @throws */ public function page(int $size, callable $callback, int $offset = 0): Pagination { @@ -216,7 +216,7 @@ class ActiveQuery extends Component implements ISqlBuilder * @param string $setKey * * @return array|null - * @throws Exception + * @throws */ public function column(string $field, string $setKey = ''): ?array { @@ -247,7 +247,7 @@ class ActiveQuery extends Component implements ISqlBuilder /** * @param $data * @return ModelInterface - * @throws Exception + * @throws */ public function populate($data): ModelInterface { @@ -269,7 +269,7 @@ class ActiveQuery extends Component implements ISqlBuilder /** * @return int - * @throws Exception + * @throws */ public function count(): int { @@ -284,7 +284,7 @@ class ActiveQuery extends Component implements ISqlBuilder /** * @param array $data * @return bool - * @throws Exception + * @throws */ public function batchUpdate(array $data): bool { @@ -298,7 +298,7 @@ class ActiveQuery extends Component implements ISqlBuilder /** * @param array $data * @return bool - * @throws Exception + * @throws */ public function batchInsert(array $data): bool { @@ -312,7 +312,7 @@ class ActiveQuery extends Component implements ISqlBuilder * @param $filed * * @return null - * @throws Exception + * @throws */ public function value($filed) { @@ -321,7 +321,7 @@ class ActiveQuery extends Component implements ISqlBuilder /** * @return bool - * @throws Exception + * @throws */ public function exists(): bool { @@ -332,7 +332,7 @@ class ActiveQuery extends Component implements ISqlBuilder /** * @param bool $getSql * @return int|bool|string|null - * @throws Exception + * @throws */ public function delete(bool $getSql = FALSE): int|bool|string|null { diff --git a/Traits/QueryTrait.php b/Traits/QueryTrait.php index 3321ef4..390969e 100644 --- a/Traits/QueryTrait.php +++ b/Traits/QueryTrait.php @@ -116,8 +116,7 @@ trait QueryTrait * @param string|array|Closure $condition1 * @param string|array|Closure $condition2 * @return $this - * @throws NotFindClassException - * @throws ReflectionException + * @throws */ public function whereIf(string|array|Closure $condition, string|array|Closure $condition1, string|array|Closure $condition2): static { @@ -150,7 +149,7 @@ trait QueryTrait /** * @return string - * @throws Exception + * @throws */ public function getTable(): string { @@ -195,7 +194,7 @@ trait QueryTrait * @param string $column * @return $this */ - public function whereAnnotationmpty(string $column): static + public function whereNotEmpty(string $column): static { $this->where[] = $column . ' <> \'\''; return $this; @@ -315,7 +314,7 @@ trait QueryTrait * @param $onCondition * @param null $param * @return $this - * @throws Exception + * @throws */ public function leftJoin(string $tableName, string $alias, $onCondition, $param = NULL): static { @@ -335,7 +334,7 @@ trait QueryTrait * @param $onCondition * @param null $param * @return $this - * @throws Exception + * @throws */ public function rightJoin($tableName, $alias, $onCondition, $param = NULL): static { @@ -355,7 +354,7 @@ trait QueryTrait * @param $onCondition * @param null $param * @return $this - * @throws Exception + * @throws */ public function innerJoin($tableName, $alias, $onCondition, $param = NULL): static { @@ -507,8 +506,7 @@ trait QueryTrait * @param string $opera * @param null $value * @return QueryTrait - * @throws NotFindClassException - * @throws ReflectionException + * @throws */ public function whereOr(array|Closure|string $conditionArray = [], string $opera = '=', $value = null): static { @@ -546,7 +544,6 @@ trait QueryTrait * @param string $columns * @param string $value * @return $this - * @throws Exception */ public function whereLike(string $columns, string $value): static { @@ -554,10 +551,6 @@ trait QueryTrait return $this; } - if (is_array($columns)) { - $columns = 'CONCAT(' . implode(',^,', $columns) . ')'; - } - $this->where[] = $columns . ' LIKE \'%' . addslashes($value) . '%\''; return $this; @@ -567,7 +560,6 @@ trait QueryTrait * @param string $columns * @param string $value * @return $this - * @throws Exception */ public function whereLeftLike(string $columns, string $value): static { @@ -575,10 +567,6 @@ trait QueryTrait return $this; } - if (is_array($columns)) { - $columns = 'CONCAT(' . implode(',^,', $columns) . ')'; - } - $this->where[] = $columns . ' LLike \'%' . addslashes($value) . '\''; return $this; @@ -588,7 +576,6 @@ trait QueryTrait * @param string $columns * @param string $value * @return $this - * @throws Exception */ public function whereRightLike(string $columns, string $value): static { @@ -596,10 +583,6 @@ trait QueryTrait return $this; } - if (is_array($columns)) { - $columns = 'CONCAT(' . implode(',^,', $columns) . ')'; - } - $this->where[] = $columns . ' RLike \'' . addslashes($value) . '%\''; return $this; @@ -610,7 +593,6 @@ trait QueryTrait * @param string $columns * @param string $value * @return $this - * @throws Exception */ public function whereNotLike(string $columns, string $value): static { @@ -618,10 +600,6 @@ trait QueryTrait return $this; } - if (is_array($columns)) { - $columns = 'CONCAT(' . implode(',^,', $columns) . ')'; - } - $this->where[] = $columns . ' NOT LIKE \'%' . addslashes($value) . '%\''; return $this; @@ -631,7 +609,6 @@ trait QueryTrait * @param string $column * @param int $value * @return $this - * @throws Exception * @see MathematicsCondition */ public function whereEq(string $column, int $value): static @@ -646,7 +623,6 @@ trait QueryTrait * @param string $column * @param int $value * @return $this - * @throws Exception * @see MathematicsCondition */ public function whereNeq(string $column, int $value): static @@ -661,7 +637,6 @@ trait QueryTrait * @param string $column * @param int $value * @return $this - * @throws Exception * @see MathematicsCondition */ public function whereGt(string $column, int $value): static @@ -675,7 +650,6 @@ trait QueryTrait * @param string $column * @param int $value * @return $this - * @throws Exception * @see MathematicsCondition */ public function whereEgt(string $column, int $value): static @@ -690,7 +664,6 @@ trait QueryTrait * @param string $column * @param int $value * @return $this - * @throws Exception * @see MathematicsCondition */ public function whereLt(string $column, int $value): static @@ -704,7 +677,6 @@ trait QueryTrait * @param string $column * @param int $value * @return $this - * @throws Exception * @see MathematicsCondition */ public function whereElt(string $column, int $value): static @@ -718,8 +690,7 @@ trait QueryTrait * @param string $columns * @param array|Closure $value * @return $this - * @throws NotFindClassException - * @throws ReflectionException + * @throws */ public function whereIn(string $columns, array|Closure $value): static { @@ -737,7 +708,7 @@ trait QueryTrait /** * @param $value * @return ActiveQuery - * @throws Exception + * @throws */ public function makeNewQuery($value): ActiveQuery { @@ -752,8 +723,7 @@ trait QueryTrait /** * @return Query - * @throws ReflectionException - * @throws NotFindClassException + * @throws */ public function makeNewSqlGenerate(): Query { @@ -768,7 +738,7 @@ trait QueryTrait */ public function whereNotIn(string $columns, array $value): static { - if (empty($value) || !is_array($value)) { + if (empty($value)) { $value = [-1]; } $this->where[] = ['NOT IN', $columns, $value]; @@ -828,8 +798,7 @@ trait QueryTrait * @param string $opera * @param null $value * @return $this - * @throws NotFindClassException - * @throws ReflectionException + * @throws */ public function where(Closure|array|string $column, string $opera = '=', $value = null): static { @@ -853,9 +822,7 @@ trait QueryTrait /** * @param Closure|array $closure * @return string - * @throws NotFindClassException - * @throws ReflectionException - * @throws Exception + * @throws */ public function makeClosureFunction(Closure|array $closure): string {