diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php index 789725b00f53337a7099d00495605b82e16a5cf0..c65ff3b9d88f529ad004aa7b33d890fe102ca27e 100644 --- a/core/lib/Drupal/Core/Database/Connection.php +++ b/core/lib/Drupal/Core/Database/Connection.php @@ -783,7 +783,7 @@ public function exceptionHandler() { * for query_alter hook implementations. * @param string $alias * (optional) The alias of the base table of this query. - * @param $options + * @param array $options * An array of options on the query. * * @return \Drupal\Core\Database\Query\SelectInterface diff --git a/core/lib/Drupal/Core/Database/Log.php b/core/lib/Drupal/Core/Database/Log.php index 193a5e78e57045f8575a7b5e7941c17f1b02fe3d..79f2605020526078341cdf4a8203a433e64a0c67 100644 --- a/core/lib/Drupal/Core/Database/Log.php +++ b/core/lib/Drupal/Core/Database/Log.php @@ -43,7 +43,7 @@ class Log { /** * Constructor. * - * @param $key + * @param string $key * The database connection key for which to enable logging. */ public function __construct($key = 'default') { @@ -55,7 +55,7 @@ public function __construct($key = 'default') { * * If the specified logging key is already running this method does nothing. * - * @param $logging_key + * @param string $logging_key * The identification key for this log request. By specifying different * logging keys we are able to start and stop multiple logging runs * simultaneously without them colliding. @@ -69,7 +69,7 @@ public function start($logging_key) { /** * Retrieve the query log for the specified logging key so far. * - * @param $logging_key + * @param string $logging_key * The logging key to fetch. * * @return array @@ -85,7 +85,7 @@ public function get($logging_key) { * This method does not stop logging, it simply clears the log. To stop * logging, use the end() method. * - * @param $logging_key + * @param string $logging_key * The logging key to empty. */ public function clear($logging_key) { @@ -95,7 +95,7 @@ public function clear($logging_key) { /** * Stop logging for the specified logging key. * - * @param $logging_key + * @param string $logging_key * The logging key to stop. */ public function end($logging_key) { diff --git a/core/lib/Drupal/Core/Database/Query/AlterableInterface.php b/core/lib/Drupal/Core/Database/Query/AlterableInterface.php index 347019569c7236a210c9d285feea4a79761bf35b..b5ab3ac2afe20a0f0e43dcdee9ac6925faf5bc32 100644 --- a/core/lib/Drupal/Core/Database/Query/AlterableInterface.php +++ b/core/lib/Drupal/Core/Database/Query/AlterableInterface.php @@ -16,7 +16,7 @@ interface AlterableInterface { * letters, numbers, and underscore, and start with a letter. That is, they * should follow the same rules as PHP identifiers in general. * - * @param $tag + * @param string $tag * The tag to add. * * @return $this @@ -27,7 +27,7 @@ public function addTag($tag); /** * Determines if a given query has a given tag. * - * @param $tag + * @param string $tag * The tag to check. * * @return bool @@ -70,10 +70,10 @@ public function hasAnyTag(); * hooks. Alter hooks may then use that information to decide if and how * to take action. * - * @param $key + * @param string $key * The unique identifier for this piece of metadata. Must be a string that * follows the same rules as any other PHP identifier. - * @param $object + * @param mixed $object * The additional data to add to the query. May be any valid PHP variable. * * @return $this @@ -84,7 +84,7 @@ public function addMetaData($key, $object); /** * Retrieves a given piece of metadata. * - * @param $key + * @param string $key * The unique identifier for the piece of metadata to retrieve. * * @return mixed diff --git a/core/lib/Drupal/Core/Database/Query/ConditionInterface.php b/core/lib/Drupal/Core/Database/Query/ConditionInterface.php index 673ac1d9be15488359cfd06c7274582826453ec8..2601b45914a658fcf237ef8375dcb0faefcabbd3 100644 --- a/core/lib/Drupal/Core/Database/Query/ConditionInterface.php +++ b/core/lib/Drupal/Core/Database/Query/ConditionInterface.php @@ -181,9 +181,9 @@ public function arguments(); * This method does not return anything, but simply prepares data to be * retrieved via __toString() and arguments(). * - * @param $connection + * @param \Drupal\Core\Database\Connection $connection * The database connection for which to compile the conditionals. - * @param $queryPlaceholder + * @param \Drupal\Core\Database\Query\PlaceholderInterface $queryPlaceholder * The query this condition belongs to. If not given, the current query is * used. */ @@ -202,7 +202,7 @@ public function compiled(); * * See andConditionGroup() and orConditionGroup() for more. * - * @param $conjunction + * @param string $conjunction * - AND (default): this is the equivalent of andConditionGroup(). * - OR: this is the equivalent of orConditionGroup(). * diff --git a/core/lib/Drupal/Core/Database/Query/ExtendableInterface.php b/core/lib/Drupal/Core/Database/Query/ExtendableInterface.php index d512bd61178c7f5984248e88307d69de1ef2bf48..03bb4597b553dfb705ac3d99c24cb73b6345183c 100644 --- a/core/lib/Drupal/Core/Database/Query/ExtendableInterface.php +++ b/core/lib/Drupal/Core/Database/Query/ExtendableInterface.php @@ -17,7 +17,7 @@ interface ExtendableInterface { /** * Enhance this object by wrapping it in an extender object. * - * @param $extender_name + * @param class-string $extender_name * The fully-qualified name of the extender class, without the leading '\' * (for example, Drupal\my_module\myExtenderClass). The extender name will * be checked against the current database connection to allow diff --git a/core/lib/Drupal/Core/Database/Query/Merge.php b/core/lib/Drupal/Core/Database/Query/Merge.php index 6f040bd0181433979f190f7c981cdc90e9a500cd..4577a12c21a56e2d870cd4ec5bf318056a29b7cf 100644 --- a/core/lib/Drupal/Core/Database/Query/Merge.php +++ b/core/lib/Drupal/Core/Database/Query/Merge.php @@ -142,7 +142,7 @@ public function __construct(Connection $connection, $table, array $options = []) /** * Sets the table or subquery to be used for the condition. * - * @param $table + * @param \Drupal\Core\Database\Query\Select|string $table * The table name or the subquery to be used. Use a Select query object to * pass in a subquery. * @@ -157,7 +157,7 @@ protected function conditionTable($table) { /** * Adds a set of field->value pairs to be updated. * - * @param $fields + * @param array $fields * An associative array of fields to write into the database. The array keys * are the field names and the values are the values to which to set them. * @@ -177,12 +177,12 @@ public function updateFields(array $fields) { * takes precedence over MergeQuery::updateFields() and its wrappers, * MergeQuery::key() and MergeQuery::fields(). * - * @param $field + * @param string $field * The field to set. - * @param $expression + * @param string $expression * The field will be set to the value of this expression. This parameter * may include named placeholders. - * @param $arguments + * @param array|null $arguments * If specified, this is an array of key/value pairs for named placeholders * corresponding to the expression. * @@ -201,13 +201,13 @@ public function expression($field, $expression, ?array $arguments = NULL) { /** * Adds a set of field->value pairs to be inserted. * - * @param $fields + * @param array $fields * An array of fields on which to insert. This array may be indexed or * associative. If indexed, the array is taken to be the list of fields. * If associative, the keys of the array are taken to be the fields and * the values are taken to be corresponding values to insert. If a * $values argument is provided, $fields must be indexed. - * @param $values + * @param array $values * An array of fields to insert into the database. The values must be * specified in the same order as the $fields array. * @@ -234,7 +234,7 @@ public function insertFields(array $fields, array $values = []) { * Specifying a field both in fields() and in useDefaults() is an error * and will not execute. * - * @param $fields + * @param array $fields * An array of values for which to use the default values * specified in the table definition. * @@ -256,11 +256,11 @@ public function useDefaults(array $fields) { * If called with two arrays, the first array is taken as the fields * and the second array is taken as the corresponding values. * - * @param $fields + * @param array $fields * An array of fields to insert, or an associative array of fields and * values. The keys of the array are taken to be the fields and the values * are taken to be corresponding values to insert. - * @param $values + * @param array $values * An array of values to set into the database. The values must be * specified in the same order as the $fields array. * @@ -292,9 +292,9 @@ public function fields(array $fields, array $values = []) { * The fields are copied to the condition of the query and the INSERT part. * If no other method is called, the UPDATE will become a no-op. * - * @param $fields + * @param array $fields * An array of fields to set, or an associative array of fields and values. - * @param $values + * @param array $values * An array of values to set into the database. The values must be * specified in the same order as the $fields array. * diff --git a/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php b/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php index 3620d9b5d17c9d42b1e368db07be7fc52f9ac1fb..604f50d610d3bc88901ddb0a7f1d81bb0a7487fc 100644 --- a/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php +++ b/core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php @@ -152,7 +152,7 @@ public function limit($limit = 10) { * explicitly, so it is possible for two pagers to end up using the same ID * if both are set explicitly. * - * @param $element + * @param array $element * Element ID that is used to differentiate different pager queries. */ public function element($element) { diff --git a/core/lib/Drupal/Core/Database/Query/Query.php b/core/lib/Drupal/Core/Database/Query/Query.php index f67da360ca29bf0e84b1a1a17c151ff2b71287cf..093634a2c022713715253a1c7682dd15825c1e91 100644 --- a/core/lib/Drupal/Core/Database/Query/Query.php +++ b/core/lib/Drupal/Core/Database/Query/Query.php @@ -154,7 +154,7 @@ public function nextPlaceholder() { * The comment string will be sanitized to remove * / and other characters * that may terminate the string early so as to avoid SQL injection attacks. * - * @param $comment + * @param string $comment * The comment string to be inserted into the query. * * @return $this diff --git a/core/lib/Drupal/Core/Database/Query/SelectInterface.php b/core/lib/Drupal/Core/Database/Query/SelectInterface.php index f3a161af2da6261c8c5a090376495d5ed6746bd6..abc65454744d167783740ac670611b465242d8fd 100644 --- a/core/lib/Drupal/Core/Database/Query/SelectInterface.php +++ b/core/lib/Drupal/Core/Database/Query/SelectInterface.php @@ -126,7 +126,7 @@ public function &getUnion(); /** * Escapes characters that work as wildcard characters in a LIKE pattern. * - * @param $string + * @param string $string * The string to escape. * * @return string @@ -154,7 +154,7 @@ public function escapeField($string); /** * Compiles and returns an associative array of the arguments for this prepared statement. * - * @param $queryPlaceholder + * @param \Drupal\Core\Database\Query\PlaceholderInterface|null $queryPlaceholder * When collecting the arguments of a subquery, the main placeholder * object should be passed as this parameter. * @@ -168,7 +168,7 @@ public function getArguments(?PlaceholderInterface $queryPlaceholder = NULL); /** * Sets this query to be DISTINCT. * - * @param $distinct + * @param bool $distinct * TRUE to flag this query DISTINCT, FALSE to disable it. * * @return $this @@ -179,13 +179,13 @@ public function distinct($distinct = TRUE); /** * Adds a field to the list to be SELECTed. * - * @param $table_alias + * @param string $table_alias * The name of the table from which the field comes, as an alias. Generally * you will want to use the return value of join() here to ensure that it is * valid. - * @param $field + * @param string $field * The name of the field. - * @param $alias + * @param string $alias * The alias for this field. If not specified, one will be generated * automatically based on the $table_alias and $field. The alias will be * checked for uniqueness, so the requested alias may not be the alias @@ -206,11 +206,11 @@ public function addField($table_alias, $field, $alias = NULL); * simply use addField() for the few fields you care about and this method for * the rest. * - * @param $table_alias + * @param string $table_alias * The name of the table from which the field comes, as an alias. Generally * you will want to use the return value of join() here to ensure that it is * valid. - * @param $fields + * @param array $fields * An indexed array of fields present in the specified table that should be * included in this query. If not specified, $table_alias.* will be generated * without any aliases. @@ -227,14 +227,14 @@ public function fields($table_alias, array $fields = []); * various functions, which may in some cases be database-dependent. This * method makes no effort to correct for database-specific functions. * - * @param $expression + * @param string $expression * The expression string. May contain placeholders. - * @param $alias + * @param string $alias * The alias for this expression. If not specified, one will be generated * automatically in the form "expression_#". The alias will be checked for * uniqueness, so the requested alias may not be the alias that is assigned * in all cases. - * @param $arguments + * @param array $arguments * Any placeholder arguments needed for this expression. * * @return string @@ -247,15 +247,15 @@ public function addExpression($expression, $alias = NULL, $arguments = []); * * This method is a convenience method for innerJoin(). * - * @param $table + * @param \Drupal\Core\Database\Query\SelectInterface|string $table * The table against which to join. May be a string or another SelectQuery * object. If a query object is passed, it will be used as a subselect. * Unless the table name starts with the database / schema name and a dot * it will be prefixed. - * @param $alias + * @param string|null $alias * The alias for the table. In most cases this should be the first letter * of the table, or the first letter of each "word" in the table. - * @param $condition + * @param string|null $condition * The condition on which to join this table. If the join requires values, * this clause should use a named placeholder and the value or values to * insert should be passed in the 4th parameter. For the first table joined @@ -263,7 +263,7 @@ public function addExpression($expression, $alias = NULL, $arguments = []); * table. The token %alias can be used in this string to be replaced with * the actual alias. This is useful when $alias is modified by the database * system, for example, when joining the same table more than once. - * @param $arguments + * @param array $arguments * An array of arguments to replace into the $condition of this join. * * @return string @@ -274,15 +274,15 @@ public function join($table, $alias = NULL, $condition = NULL, $arguments = []); /** * Inner Join against another table in the database. * - * @param $table + * @param \Drupal\Core\Database\Query\SelectInterface|string $table * The table against which to join. May be a string or another SelectQuery * object. If a query object is passed, it will be used as a subselect. * Unless the table name starts with the database / schema name and a dot * it will be prefixed. - * @param $alias + * @param string|null $alias * The alias for the table. In most cases this should be the first letter * of the table, or the first letter of each "word" in the table. - * @param $condition + * @param string|null $condition * The condition on which to join this table. If the join requires values, * this clause should use a named placeholder and the value or values to * insert should be passed in the 4th parameter. For the first table joined @@ -290,7 +290,7 @@ public function join($table, $alias = NULL, $condition = NULL, $arguments = []); * table. The token %alias can be used in this string to be replaced with * the actual alias. This is useful when $alias is modified by the database * system, for example, when joining the same table more than once. - * @param $arguments + * @param array $arguments * An array of arguments to replace into the $condition of this join. * * @return string @@ -301,15 +301,15 @@ public function innerJoin($table, $alias = NULL, $condition = NULL, $arguments = /** * Left Outer Join against another table in the database. * - * @param $table + * @param \Drupal\Core\Database\Query\SelectInterface|string $table * The table against which to join. May be a string or another SelectQuery * object. If a query object is passed, it will be used as a subselect. * Unless the table name starts with the database / schema name and a dot * it will be prefixed. - * @param $alias + * @param string|null $alias * The alias for the table. In most cases this should be the first letter * of the table, or the first letter of each "word" in the table. - * @param $condition + * @param string|null $condition * The condition on which to join this table. If the join requires values, * this clause should use a named placeholder and the value or values to * insert should be passed in the 4th parameter. For the first table joined @@ -317,7 +317,7 @@ public function innerJoin($table, $alias = NULL, $condition = NULL, $arguments = * table. The token %alias can be used in this string to be replaced with * the actual alias. This is useful when $alias is modified by the database * system, for example, when joining the same table more than once. - * @param $arguments + * @param array $arguments * An array of arguments to replace into the $condition of this join. * * @return string @@ -332,18 +332,18 @@ public function leftJoin($table, $alias = NULL, $condition = NULL, $arguments = * In some cases, that may include dipping into the Schema API to find the necessary * fields on which to join. * - * @param $type + * @param string $type * The type of join. Typically one of INNER, LEFT OUTER, and RIGHT OUTER. - * @param $table + * @param \Drupal\Core\Database\Query\SelectInterface|string $table * The table against which to join. May be a string or another SelectQuery * object. If a query object is passed, it will be used as a subselect. * Unless the table name starts with the database / schema name and a dot * it will be prefixed. - * @param $alias + * @param string $alias * The alias for the table. In most cases this should be the first letter * of the table, or the first letter of each "word" in the table. If omitted, * one will be dynamically generated. - * @param $condition + * @param string|null $condition * The condition on which to join this table. If the join requires values, * this clause should use a named placeholder and the value or values to * insert should be passed in the 4th parameter. For the first table joined @@ -351,7 +351,7 @@ public function leftJoin($table, $alias = NULL, $condition = NULL, $arguments = * table. The token %alias can be used in this string to be replaced with * the actual alias. This is useful when $alias is modified by the database * system, for example, when joining the same table more than once. - * @param $arguments + * @param array $arguments * An array of arguments to replace into the $condition of this join. * * @return string @@ -372,7 +372,7 @@ public function addJoin($type, $table, $alias = NULL, $condition = NULL, $argume * when ordering on an alias, the alias must be added before orderBy() is * called. * - * @param $field + * @param string $field * The field on which to order. The field is escaped for security so only * valid field and alias names are possible. To order by an expression, add * the expression with addExpression() first and then use the alias to order @@ -383,7 +383,7 @@ public function addJoin($type, $table, $alias = NULL, $condition = NULL, $argume * $query->addExpression('SUBSTRING([thread], 1, (LENGTH([thread]) - 1))', 'order_field'); * $query->orderBy('order_field', 'ASC'); * @endcode - * @param $direction + * @param string $direction * The direction to sort. Legal values are "ASC" and "DESC". Any other value * will be converted to "ASC". * @@ -420,10 +420,10 @@ public function orderRandom(); * If this method is called with no parameters, will remove any range * directives that have been set. * - * @param $start + * @param int|null $start * The first record from the result set to return. If NULL, removes any * range directives that are set. - * @param $length + * @param int|null $length * The number of records to return from the result set. * * @return $this @@ -446,9 +446,9 @@ public function range($start = NULL, $length = NULL); * caller to ensure that they match properly. If they do * not, an SQL syntax error will result. * - * @param $query + * @param \Drupal\Core\Database\Query\SelectInterface $query * The query to UNION to this query. - * @param $type + * @param string $type * The type of UNION to add to the query. Defaults to plain * UNION. * @@ -460,7 +460,7 @@ public function union(SelectInterface $query, $type = ''); /** * Groups the result set by the specified field. * - * @param $field + * @param string $field * The field on which to group. This should be the field as aliased. * * @return $this @@ -507,14 +507,14 @@ public function execute(); * parameters, they are taken as $field and $value with $operator having a value * of IN if $value is an array and = otherwise. * - * @param $field + * @param string $field * The name of the field to check. If you would like to add a more complex * condition involving operators or functions, use having(). - * @param $value + * @param mixed|null $value * The value to test the field against. In most cases, this is a scalar. For more * complex options, it is an array. The meaning of each element in the array is * dependent on the $operator. - * @param $operator + * @param string|null $operator * The comparison operator, such as =, <, or >=. It also accepts more complex * options such as IN, LIKE, or BETWEEN. Defaults to IN if $value is an array * = otherwise. @@ -548,10 +548,10 @@ public function havingArguments(); /** * Adds an arbitrary HAVING clause to the query. * - * @param $snippet + * @param string $snippet * A portion of a HAVING clause as a prepared statement. It must use named * placeholders, not ? placeholders. - * @param $args + * @param array $args * (optional) An associative array of arguments. * * @return $this @@ -561,7 +561,7 @@ public function having($snippet, $args = []); /** * Compiles the HAVING clause for later retrieval. * - * @param $connection + * @param \Drupal\Core\Database\Connection $connection * The database connection for which to compile the clause. */ public function havingCompile(Connection $connection); @@ -569,7 +569,7 @@ public function havingCompile(Connection $connection); /** * Sets a condition in the HAVING clause that the specified field be NULL. * - * @param $field + * @param string $field * The name of the field to check. * * @return $this @@ -579,7 +579,7 @@ public function havingIsNull($field); /** * Sets a condition in the HAVING clause that the specified field be NOT NULL. * - * @param $field + * @param string $field * The name of the field to check. * * @return $this @@ -623,7 +623,7 @@ public function __clone(); * ends. Other transactions that attempt UPDATE, DELETE, or SELECT FOR UPDATE * of these rows will be blocked until the current transaction ends. * - * @param $set + * @param bool|null $set * IF TRUE, FOR UPDATE will be added to the query, if FALSE then it won't. * * @return \Drupal\Core\Database\Query\ConditionInterface diff --git a/core/lib/Drupal/Core/Database/Query/Update.php b/core/lib/Drupal/Core/Database/Query/Update.php index b27fd83972f11be9183d91779b8fc2a4481788e6..651bb674e755a23773a5799e251a17d813f427eb 100644 --- a/core/lib/Drupal/Core/Database/Query/Update.php +++ b/core/lib/Drupal/Core/Database/Query/Update.php @@ -69,7 +69,7 @@ public function __construct(Connection $connection, $table, array $options = []) /** * Adds a set of field->value pairs to be updated. * - * @param $fields + * @param array $fields * An associative array of fields to write into the database. The array keys * are the field names and the values are the values to which to set them. * @@ -87,12 +87,12 @@ public function fields(array $fields) { * Expression fields are cases such as counter=counter+1. This method takes * precedence over fields(). * - * @param $field + * @param string $field * The field to set. - * @param $expression + * @param string $expression * The field will be set to the value of this expression. This parameter * may include named placeholders. - * @param $arguments + * @param array|null $arguments * If specified, this is an array of key/value pairs for named placeholders * corresponding to the expression. * diff --git a/core/lib/Drupal/Core/Database/Schema.php b/core/lib/Drupal/Core/Database/Schema.php index a22a449a10a0c185aefe88cb0634f5182ad8f81d..434120ef1839d1640de17422bbf0739c55f33bba 100644 --- a/core/lib/Drupal/Core/Database/Schema.php +++ b/core/lib/Drupal/Core/Database/Schema.php @@ -158,11 +158,11 @@ protected function executeDdlStatement(string $sql, array $arguments = [], array * to make all the others work. For example see * core/includes/databases/mysql/schema.inc. * - * @param $table_name + * @param string $table_name * The name of the table in question. - * @param $operator + * @param string $operator * The operator to apply on the 'table' part of the condition. - * @param $add_prefix + * @param bool $add_prefix * Boolean to indicate whether the table name needs to be prefixed. * * @return \Drupal\Core\Database\Query\Condition @@ -184,7 +184,7 @@ protected function buildTableNameCondition($table_name, $operator = '=', $add_pr /** * Check if a table exists. * - * @param $table + * @param string $table * The name of the table in drupal (no prefixing). * @param bool $add_prefix * Boolean to indicate whether the table name needs to be prefixed. @@ -297,9 +297,9 @@ abstract public function getFieldTypeMap(); /** * Rename a table. * - * @param $table + * @param string $table * The table to be renamed. - * @param $new_name + * @param string $new_name * The new name for the table. * * @throws \Drupal\Core\Database\SchemaObjectDoesNotExistException @@ -312,7 +312,7 @@ abstract public function renameTable($table, $new_name); /** * Drop a table. * - * @param $table + * @param string $table * The table to be dropped. * * @return bool @@ -324,11 +324,11 @@ abstract public function dropTable($table); /** * Add a new field to a table. * - * @param $table + * @param string $table * Name of the table to be altered. - * @param $field + * @param string $field * Name of the field to be added. - * @param $spec + * @param array $spec * The field specification array, as taken from a schema definition. * The specification may also contain the key 'initial', the newly * created field will be set to the value of the key in all rows. @@ -336,7 +336,7 @@ abstract public function dropTable($table); * value in existing tables. * Alternatively, the 'initial_from_field' key may be used, which will * auto-populate the new field with values from the specified field. - * @param $keys_new + * @param array|null $keys_new * (optional) Keys and indexes specification to be created on the * table along with adding the field. The format is the same as a * table specification but without the 'fields' element. If you are @@ -354,9 +354,9 @@ abstract public function addField($table, $field, $spec, $keys_new = []); /** * Drop a field. * - * @param $table + * @param string $table * The table to be altered. - * @param $field + * @param string $field * The field to be dropped. * * @return bool @@ -368,9 +368,9 @@ abstract public function dropField($table, $field); /** * Checks if an index exists in the given table. * - * @param $table + * @param string $table * The name of the table in drupal (no prefixing). - * @param $name + * @param string $name * The name of the index in drupal (no prefixing). * * @return bool @@ -381,9 +381,9 @@ abstract public function indexExists($table, $name); /** * Add a primary key. * - * @param $table + * @param string $table * The table to be altered. - * @param $fields + * @param array $fields * Fields for the primary key. * * @throws \Drupal\Core\Database\SchemaObjectDoesNotExistException @@ -396,7 +396,7 @@ abstract public function addPrimaryKey($table, $fields); /** * Drop the primary key. * - * @param $table + * @param string $table * The table to be altered. * * @return bool @@ -428,11 +428,11 @@ protected function findPrimaryKeyColumns($table) { /** * Add a unique key. * - * @param $table + * @param string $table * The table to be altered. - * @param $name + * @param string $name * The name of the key. - * @param $fields + * @param array $fields * An array of field names. * * @throws \Drupal\Core\Database\SchemaObjectDoesNotExistException @@ -445,9 +445,9 @@ abstract public function addUniqueKey($table, $name, $fields); /** * Drop a unique key. * - * @param $table + * @param string $table * The table to be altered. - * @param $name + * @param string $name * The name of the key. * * @return bool @@ -459,11 +459,11 @@ abstract public function dropUniqueKey($table, $name); /** * Add an index. * - * @param $table + * @param string $table * The table to be altered. - * @param $name + * @param string $name * The name of the index. - * @param $fields + * @param array $fields * An array of field names or field information; if field information is * passed, it's an array whose first element is the field name and whose * second is the maximum length in the index. For example, the following @@ -521,9 +521,9 @@ abstract public function addIndex($table, $name, $fields, array $spec); /** * Drop an index. * - * @param $table + * @param string $table * The table to be altered. - * @param $name + * @param string $name * The name of the index. * * @return bool @@ -603,15 +603,15 @@ protected function introspectIndexSchema($table) { * Schema::addIndex() in all cases unless you are converting a field to * be type serial. You can use the $keys_new argument in all cases. * - * @param $table + * @param string $table * Name of the table. - * @param $field + * @param string $field * Name of the field to change. - * @param $field_new + * @param string $field_new * New name for the field (set to the same as $field if you don't want to change the name). - * @param $spec + * @param array $spec * The field specification for the new field. - * @param $keys_new + * @param array|null $keys_new * (optional) Keys and indexes specification to be created on the * table along with changing the field. The format is the same as a * table specification but without the 'fields' element. @@ -626,9 +626,9 @@ abstract public function changeField($table, $field, $field_new, $spec, $keys_ne /** * Create a new table from a Drupal table definition. * - * @param $name + * @param string $name * The name of the table to create. - * @param $table + * @param array $table * A Schema API table definition array. * * @throws \Drupal\Core\Database\SchemaObjectExistsException @@ -679,7 +679,7 @@ protected function createTableSql($name, $table) { * This is usually an identity function but if a key/index uses a column prefix * specification, this function extracts just the name. * - * @param $fields + * @param array $fields * An array of key/index column specifiers. * * @return array @@ -701,9 +701,9 @@ public function fieldNames($fields) { /** * Prepare a table or column comment for database query. * - * @param $comment + * @param string $comment * The comment string to prepare. - * @param $length + * @param int $length * Optional upper limit on the returned string length. * * @return string diff --git a/core/lib/Drupal/Core/Database/StatementInterface.php b/core/lib/Drupal/Core/Database/StatementInterface.php index 9b8150734d5bdf29942447f34eb032766ecec813..b3cccd1c0c0344023faf57266e64f889fd49aca1 100644 --- a/core/lib/Drupal/Core/Database/StatementInterface.php +++ b/core/lib/Drupal/Core/Database/StatementInterface.php @@ -23,10 +23,10 @@ interface StatementInterface extends \Traversable { /** * Executes a prepared statement. * - * @param $args + * @param array|null $args * An array of values with as many elements as there are bound parameters in * the SQL statement being executed. This can be NULL. - * @param $options + * @param array $options * An array of options for this query. * * @return bool @@ -68,14 +68,14 @@ public function rowCount(); * See http://php.net/manual/pdo.constants.php for the definition of the * constants used. * - * @param $mode + * @param int $mode * One of the \PDO::FETCH_* constants. - * @param $a1 + * @param int|null $a1 * An option depending of the fetch mode specified by $mode: * - for \PDO::FETCH_COLUMN, the index of the column to fetch * - for \PDO::FETCH_CLASS, the name of the class to create * - for \PDO::FETCH_INTO, the object to add the data to - * @param $a2 + * @param array $a2 * If $mode is \PDO::FETCH_CLASS, the optional arguments to pass to the * constructor. */ @@ -87,12 +87,12 @@ public function setFetchMode($mode, $a1 = NULL, $a2 = []); * See http://php.net/manual/pdo.constants.php for the definition of the * constants used. * - * @param $mode + * @param int $mode * One of the \PDO::FETCH_* constants. * Default to what was specified by setFetchMode(). - * @param $cursor_orientation + * @param int|null $cursor_orientation * Not implemented in all database drivers, don't use. - * @param $cursor_offset + * @param int|null $cursor_offset * Not implemented in all database drivers, don't use. * * @return array|object|false @@ -103,7 +103,7 @@ public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = /** * Returns a single field from the next record of a result set. * - * @param $index + * @param int $index * The numeric index of the field to return. Defaults to the first field. * * @return mixed @@ -146,11 +146,11 @@ public function fetchAssoc(); /** * Returns an array containing all of the result set rows. * - * @param $mode + * @param int|null $mode * One of the \PDO::FETCH_* constants. - * @param $column_index + * @param int|null $column_index * If $mode is \PDO::FETCH_COLUMN, the index of the column to fetch. - * @param $constructor_arguments + * @param array $constructor_arguments * If $mode is \PDO::FETCH_CLASS, the arguments to pass to the constructor. * * @return array @@ -163,7 +163,7 @@ public function fetchAll($mode = NULL, $column_index = NULL, $constructor_argume * * Note that this method will run the result set to the end. * - * @param $index + * @param int $index * The index of the column number to fetch. * * @return array @@ -181,9 +181,9 @@ public function fetchCol($index = 0); * * Note that this method will run the result set to the end. * - * @param $key_index + * @param int $key_index * The numeric index of the field to use as the array key. - * @param $value_index + * @param int $value_index * The numeric index of the field to use as the array value. * * @return array @@ -197,9 +197,9 @@ public function fetchAllKeyed($key_index = 0, $value_index = 1); * If the given key appears multiple times, later records will overwrite * earlier ones. * - * @param $key + * @param string $key * The name of the field on which to index the array. - * @param $fetch + * @param int|null $fetch * The fetch mode to use. If set to \PDO::FETCH_ASSOC, \PDO::FETCH_NUM, or * \PDO::FETCH_BOTH the returned value with be an array of arrays. For any * other value it will be an array of objects. By default, the fetch mode diff --git a/core/lib/Drupal/Core/Database/StatementPrefetchIterator.php b/core/lib/Drupal/Core/Database/StatementPrefetchIterator.php index ccf1f06ed5b2407e8a4d1538b961e71b214bda08..ba968be11a5a6eec2f02bbe4c1acf657707a90eb 100644 --- a/core/lib/Drupal/Core/Database/StatementPrefetchIterator.php +++ b/core/lib/Drupal/Core/Database/StatementPrefetchIterator.php @@ -167,7 +167,7 @@ public function execute($args = [], $options = []) { * Some drivers (including SQLite) will need to perform some preparation * themselves to get the statement right. * - * @param $query + * @param string $query * The query. * @param array|null $args * An array of arguments. This can be NULL. diff --git a/core/lib/Drupal/Core/Database/database.api.php b/core/lib/Drupal/Core/Database/database.api.php index 00fc79f5b169f45c26445034d9ff4770cf6d63ec..82c8ab76579c567ca7fa8ba352d8fd5cfff33b21 100644 --- a/core/lib/Drupal/Core/Database/database.api.php +++ b/core/lib/Drupal/Core/Database/database.api.php @@ -472,7 +472,7 @@ * Structured (aka dynamic) queries that have tags associated may be altered by any module * before the query is executed. * - * @param $query + * @param Drupal\Core\Database\Query\AlterableInterface $query * A Query object describing the composite parts of a SQL query. * * @see hook_query_TAG_alter() @@ -497,7 +497,7 @@ function hook_query_alter(Drupal\Core\Database\Query\AlterableInterface $query) * - ENTITY_TYPE . '_access': For queries of entities that will be displayed in * a listing (e.g., from Views) and therefore require access control. * - * @param $query + * @param Drupal\Core\Database\Query\AlterableInterface $query * A Query object describing the composite parts of a SQL query. * * @see hook_query_alter() diff --git a/core/modules/mysql/src/Driver/Database/mysql/Schema.php b/core/modules/mysql/src/Driver/Database/mysql/Schema.php index 56c8b90925779c2cb5ea12c5604c647891b019ae..e7b454b3ba31cc411bc220b5bccb6b83efc998a1 100644 --- a/core/modules/mysql/src/Driver/Database/mysql/Schema.php +++ b/core/modules/mysql/src/Driver/Database/mysql/Schema.php @@ -199,7 +199,7 @@ protected function createFieldSql($name, $spec) { /** * Set database-engine specific properties for a field. * - * @param $field + * @param array $field * A field description array, as specified in the schema documentation. */ protected function processField($field) { diff --git a/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php b/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php index bf38643e6da87e74c81331e72adc08c48b473abd..88714b01bc574131ec59a92ed0398b019009d71f 100644 --- a/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php +++ b/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php @@ -362,7 +362,7 @@ public function getFullQualifiedTableName($table) { * The main use for this method is to mimic InnoDB functionality, which * provides an inherent savepoint before any query in a transaction. * - * @param $savepoint_name + * @param string $savepoint_name * A string representing the savepoint name. By default, * "mimic_implicit_commit" is used. */ @@ -375,7 +375,7 @@ public function addSavepoint($savepoint_name = 'mimic_implicit_commit') { /** * Release a savepoint by name. * - * @param $savepoint_name + * @param string $savepoint_name * A string representing the savepoint name. By default, * "mimic_implicit_commit" is used. */ @@ -388,7 +388,7 @@ public function releaseSavepoint($savepoint_name = 'mimic_implicit_commit') { /** * Rollback a savepoint by name if it exists. * - * @param $savepoint_name + * @param string $savepoint_name * A string representing the savepoint name. By default, * "mimic_implicit_commit" is used. */ diff --git a/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php b/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php index 29cb7c67856489859cf973e41fb7a948856d28c6..2a8e10da65d73767ab303cf929ca6835e4f1e0c5 100644 --- a/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php +++ b/core/modules/pgsql/src/Driver/Database/pgsql/Schema.php @@ -216,7 +216,7 @@ protected function getTempNamespaceName() { /** * Resets information about table blobs, sequences and serial fields. * - * @param $table + * @param string $table * The non-prefixed name of the table. */ protected function resetTableInformation($table) { @@ -338,9 +338,9 @@ protected function createTableSql($name, $table) { /** * Creates a safe SQL string for a field for table creation or alteration. * - * @param $name + * @param string $name * Name of the field. - * @param $spec + * @param array $spec * The field specification, as per the schema data structure format. */ protected function createFieldSql($name, $spec) { @@ -381,7 +381,7 @@ protected function createFieldSql($name, $spec) { /** * Set database-engine specific properties for a field. * - * @param $field + * @param array $field * A field description array, as specified in the schema documentation. */ protected function processField($field) { @@ -1064,7 +1064,7 @@ public function getComment($table, $column = NULL) { * * The hash is modified to according to @link https://www.postgresql.org/docs/current/sql-syntax-lexical.html PostgreSQL Lexical Structure@endlink. * - * @param $data + * @param string $data * String to be hashed. * * @return string diff --git a/core/modules/sqlite/src/Driver/Database/sqlite/Schema.php b/core/modules/sqlite/src/Driver/Database/sqlite/Schema.php index 770358aae1d25c39498af3756126076bd591f9ae..6053a71b18181fd6fa182134730f38d2d8fa343f 100644 --- a/core/modules/sqlite/src/Driver/Database/sqlite/Schema.php +++ b/core/modules/sqlite/src/Driver/Database/sqlite/Schema.php @@ -118,7 +118,7 @@ protected function createKeySql($fields) { /** * Set database-engine specific properties for a field. * - * @param $field + * @param array $field * A field description array, as specified in the schema documentation. */ protected function processField($field) { @@ -154,9 +154,9 @@ protected function processField($field) { * Before passing a field out of a schema definition into this function it has * to be processed by self::processField(). * - * @param $name + * @param string $name * Name of the field. - * @param $spec + * @param array $spec * The field specification, as per the schema data structure format. */ protected function createFieldSql($name, $spec) { @@ -399,13 +399,13 @@ public function addField($table, $field, $specification, $keys_new = []) { * As SQLite does not support ALTER TABLE (with a few exceptions) it is * necessary to create a new table and copy over the old content. * - * @param $table + * @param string $table * Name of the table to be altered. - * @param $old_schema + * @param array $old_schema * The old schema array for the table. - * @param $new_schema + * @param array $new_schema * The new schema array for the table. - * @param $mapping + * @param array $mapping * An optional mapping between the fields of the old specification and the * fields of the new specification. An associative array, whose keys are * the fields of the new table, and values can take two possible forms: @@ -464,7 +464,7 @@ protected function alterTable($table, $old_schema, $new_schema, array $mapping = * create a schema array. This is useful, for example, during update when * the old schema is not available. * - * @param $table + * @param string $table * Name of the table. * * @return array @@ -649,9 +649,9 @@ public function changeField($table, $field, $field_new, $spec, $keys_new = []) { /** * Utility method: rename columns in an index definition according to a new mapping. * - * @param $key_definition + * @param array $key_definition * The key definition. - * @param $mapping + * @param array $mapping * The new mapping. */ protected function mapKeyDefinition(array $key_definition, array $mapping) { diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 4812975b327e100160b21bca4bf4fb55d83ec35c..076581a52edc533d49dd57e313a840ef7da35390 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -79,6 +79,7 @@ </rule> <rule ref="Drupal.Commenting.FunctionComment.MissingParamType"> <include-pattern>core/lib/Component/*</include-pattern> + <include-pattern>core/*/*Database*/*</include-pattern> </rule> <rule ref="Drupal.Commenting.FunctionComment.MissingReturnComment"> <include-pattern>core/lib/Drupal/Core/*</include-pattern> diff --git a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php index da331170fadaa335df95b54cd0a295354622e206..c361c7af95961b99d3bb46a2057550b0cd1213dc 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificTransactionTestBase.php @@ -104,11 +104,11 @@ protected function createFirstSavepointTransaction(string $name = '', bool $inse * transaction (which was already committed when the inner transaction * started). * - * @param $suffix + * @param string $suffix * Suffix to add to field values to differentiate tests. - * @param $rollback + * @param bool $rollback * Whether or not to try rolling back the transaction when we're done. - * @param $ddl_statement + * @param bool $ddl_statement * Whether to execute a DDL statement during the inner transaction. */ protected function transactionOuterLayer($suffix, $rollback = FALSE, $ddl_statement = FALSE) { @@ -145,11 +145,11 @@ protected function transactionOuterLayer($suffix, $rollback = FALSE, $ddl_statem * This "inner layer" transaction is either used alone or nested inside of the * "outer layer" transaction. * - * @param $suffix + * @param string $suffix * Suffix to add to field values to differentiate tests. - * @param $rollback + * @param bool $rollback * Whether or not to try rolling back the transaction when we're done. - * @param $ddl_statement + * @param bool $ddl_statement * Whether to execute a DDL statement during the transaction. */ protected function transactionInnerLayer($suffix, $rollback = FALSE, $ddl_statement = FALSE) {