Issue #3136388 by dww, jyotimishra-developer, nitesh624: Fix phpdocs in core/lib/Drupal/Core/Database/Install/Tasks.php

merge-requests/1222/head
Alex Pott 2021-12-29 10:50:38 +00:00
parent d06a99dde2
commit b5156d7b04
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
1 changed files with 39 additions and 17 deletions

View File

@ -82,41 +82,50 @@ abstract class Tasks {
/** /**
* Ensure the PDO driver is supported by the version of PHP in use. * Ensure the PDO driver is supported by the version of PHP in use.
*
* @return bool
* TRUE if the PDO driver is supported, otherwise FALSE.
*/ */
protected function hasPdoDriver() { protected function hasPdoDriver() {
return in_array($this->pdoDriver, \PDO::getAvailableDrivers()); return in_array($this->pdoDriver, \PDO::getAvailableDrivers());
} }
/** /**
* Assert test as failed. * Asserts test as failed.
*/ */
protected function fail($message) { protected function fail($message) {
$this->results['fail'][] = $message; $this->results['fail'][] = $message;
} }
/** /**
* Assert test as a pass. * Asserts test as a pass.
*/ */
protected function pass($message) { protected function pass($message) {
$this->results['pass'][] = $message; $this->results['pass'][] = $message;
} }
/** /**
* Check whether Drupal is installable on the database. * Checks whether Drupal is installable on the database.
*
* @return bool
* TRUE if Drupal can be installed on the database, otherwise FALSE.
*/ */
public function installable() { public function installable() {
return $this->hasPdoDriver() && empty($this->error); return $this->hasPdoDriver() && empty($this->error);
} }
/** /**
* Return the human-readable name of the driver. * Returns the human-readable name of the driver.
*
* @return string
* The human-readable name of the driver.
*/ */
abstract public function name(); abstract public function name();
/** /**
* Return the minimum required version of the engine. * Returns the minimum required version of the engine.
* *
* @return * @return string|null
* A version string. If not NULL, it will be checked against the version * A version string. If not NULL, it will be checked against the version
* reported by the Database engine using version_compare(). * reported by the Database engine using version_compare().
*/ */
@ -125,9 +134,9 @@ abstract class Tasks {
} }
/** /**
* Run database tasks and tests to see if Drupal can run on the database. * Runs database tasks and tests to see if Drupal can run on the database.
* *
* @return array * @return string[]
* A list of error messages. * A list of error messages.
*/ */
public function runTasks() { public function runTasks() {
@ -165,7 +174,10 @@ abstract class Tasks {
} }
/** /**
* Check if we can connect to the database. * Checks if we can connect to the database.
*
* @return bool
* TRUE if we can connect to the database, otherwise FALSE.
*/ */
protected function connect() { protected function connect() {
try { try {
@ -183,7 +195,7 @@ abstract class Tasks {
} }
/** /**
* Run SQL tests to ensure the database can execute commands with the current user. * Ensures the database can execute commands with the current user.
*/ */
protected function runTestQuery($query, $pass, $fail, $fatal = FALSE) { protected function runTestQuery($query, $pass, $fail, $fatal = FALSE) {
try { try {
@ -197,7 +209,7 @@ abstract class Tasks {
} }
/** /**
* Check the engine version. * Checks the engine version.
*/ */
protected function checkEngineVersion() { protected function checkEngineVersion() {
// Ensure that the database server has the right version. // Ensure that the database server has the right version.
@ -222,12 +234,12 @@ abstract class Tasks {
} }
/** /**
* Return driver specific configuration options. * Returns driver specific configuration options.
* *
* @param $database * @param string[] $database
* An array of driver specific configuration options. * An array of driver specific configuration options.
* *
* @return * @return array
* The options form array. * The options form array.
*/ */
public function getFormOptions(array $database) { public function getFormOptions(array $database) {
@ -317,13 +329,13 @@ abstract class Tasks {
* Checks to ensure correct basic database settings and that a proper * Checks to ensure correct basic database settings and that a proper
* connection to the database can be established. * connection to the database can be established.
* *
* @param $database * @param string[] $database
* An array of driver specific configuration options. * An array of driver specific configuration options.
* *
* @return * @return \Drupal\Core\StringTranslation\TranslatableMarkup[]
* An array of driver configuration errors, keyed by form element name. * An array of driver configuration errors, keyed by form element name.
*/ */
public function validateDatabaseSettings($database) { public function validateDatabaseSettings(array $database) {
$errors = []; $errors = [];
// Verify the table prefix. // Verify the table prefix.
@ -337,6 +349,16 @@ abstract class Tasks {
/** /**
* Translates a string to the current language or to a given language. * Translates a string to the current language or to a given language.
* *
* @param string $string
* The string literal to translate.
* @param array $args
* Placeholder arguments to use inside the translated string (if any).
* @param array $options
* Options for the translation.
*
* @return \Drupal\Core\StringTranslation\TranslatableMarkup
* An object representing the translatable markup for the given string.
*
* @see \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() * @see \Drupal\Core\StringTranslation\TranslatableMarkup::__construct()
*/ */
protected function t($string, array $args = [], array $options = []) { protected function t($string, array $args = [], array $options = []) {