Upgrade to 3.6.0

This commit is contained in:
Bastian Allgeier
2021-11-16 14:53:37 +01:00
parent 7388fa4d24
commit 92b7a330fa
318 changed files with 20017 additions and 6878 deletions

View File

@@ -123,7 +123,7 @@ class Db
public static function __callStatic(string $method, $arguments)
{
if (isset(static::$queries[$method])) {
return static::$queries[$method](...$arguments);
return (static::$queries[$method])(...$arguments);
}
if (static::$connection !== null && method_exists(static::$connection, $method) === true) {
@@ -134,9 +134,10 @@ class Db
}
}
// @codeCoverageIgnoreStart
/**
* Shortcut for SELECT clauses
* @codeCoverageIgnore
*
* @param string $table The name of the table which should be queried
* @param mixed $columns Either a string with columns or an array of column names
@@ -152,7 +153,6 @@ Db::$queries['select'] = function (string $table, $columns = '*', $where = null,
/**
* Shortcut for selecting a single row in a table
* @codeCoverageIgnore
*
* @param string $table The name of the table which should be queried
* @param mixed $columns Either a string with columns or an array of column names
@@ -168,7 +168,6 @@ Db::$queries['first'] = Db::$queries['row'] = Db::$queries['one'] = function (st
/**
* Returns only values from a single column
* @codeCoverageIgnore
*
* @param string $table The name of the table which should be queried
* @param string $column The name of the column to select from
@@ -184,19 +183,17 @@ Db::$queries['column'] = function (string $table, string $column, $where = null,
/**
* Shortcut for inserting a new row into a table
* @codeCoverageIgnore
*
* @param string $table The name of the table which should be queried
* @param array $values An array of values which should be inserted
* @return int ID of the inserted row
* @return mixed Returns the last inserted id on success or false
*/
Db::$queries['insert'] = function (string $table, array $values): int {
Db::$queries['insert'] = function (string $table, array $values) {
return Db::table($table)->insert($values);
};
/**
* Shortcut for updating a row in a table
* @codeCoverageIgnore
*
* @param string $table The name of the table which should be queried
* @param array $values An array of values which should be inserted
@@ -209,7 +206,6 @@ Db::$queries['update'] = function (string $table, array $values, $where = null):
/**
* Shortcut for deleting rows in a table
* @codeCoverageIgnore
*
* @param string $table The name of the table which should be queried
* @param mixed $where An optional WHERE clause
@@ -221,7 +217,6 @@ Db::$queries['delete'] = function (string $table, $where = null): bool {
/**
* Shortcut for counting rows in a table
* @codeCoverageIgnore
*
* @param string $table The name of the table which should be queried
* @param mixed $where An optional WHERE clause
@@ -233,7 +228,6 @@ Db::$queries['count'] = function (string $table, $where = null): int {
/**
* Shortcut for calculating the minimum value in a column
* @codeCoverageIgnore
*
* @param string $table The name of the table which should be queried
* @param string $column The name of the column of which the minimum should be calculated
@@ -246,7 +240,6 @@ Db::$queries['min'] = function (string $table, string $column, $where = null): f
/**
* Shortcut for calculating the maximum value in a column
* @codeCoverageIgnore
*
* @param string $table The name of the table which should be queried
* @param string $column The name of the column of which the maximum should be calculated
@@ -259,7 +252,6 @@ Db::$queries['max'] = function (string $table, string $column, $where = null): f
/**
* Shortcut for calculating the average value in a column
* @codeCoverageIgnore
*
* @param string $table The name of the table which should be queried
* @param string $column The name of the column of which the average should be calculated
@@ -272,7 +264,6 @@ Db::$queries['avg'] = function (string $table, string $column, $where = null): f
/**
* Shortcut for calculating the sum of all values in a column
* @codeCoverageIgnore
*
* @param string $table The name of the table which should be queried
* @param string $column The name of the column of which the sum should be calculated
@@ -282,3 +273,5 @@ Db::$queries['avg'] = function (string $table, string $column, $where = null): f
Db::$queries['sum'] = function (string $table, string $column, $where = null): float {
return Db::table($table)->where($where)->sum($column);
};
// @codeCoverageIgnoreEnd