mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/16955] Fix phpdoc annotations and return types
PHPBB3-16955
This commit is contained in:
@@ -1246,7 +1246,7 @@ abstract class driver implements driver_interface
|
||||
$this->html_hold .= '<tr>';
|
||||
|
||||
$class = 'row1';
|
||||
foreach (array_values($row) as $val)
|
||||
foreach ($row as $val)
|
||||
{
|
||||
$class = ($class == 'row1') ? 'row2' : 'row1';
|
||||
$this->html_hold .= '<td class="' . $class . '">' . (($val) ? $val : ' ') . '</td>';
|
||||
|
@@ -365,7 +365,7 @@ interface driver_interface
|
||||
*
|
||||
* @param mixed $query_id Already executed query result,
|
||||
* if false, the last query will be used.
|
||||
* @return null
|
||||
* @return void
|
||||
*/
|
||||
public function sql_freeresult($query_id = false);
|
||||
|
||||
|
@@ -780,8 +780,6 @@ class oracle extends \phpbb\db\driver\driver
|
||||
$success = @oci_execute($result, OCI_DEFAULT);
|
||||
if ($success)
|
||||
{
|
||||
array();
|
||||
|
||||
while ($row = oci_fetch_array($result, OCI_ASSOC + OCI_RETURN_NULLS))
|
||||
{
|
||||
// Take the time spent on parsing rows into account
|
||||
|
@@ -20,7 +20,7 @@ class mssql_extractor extends base_extractor
|
||||
/**
|
||||
* Writes closing line(s) to database backup
|
||||
*
|
||||
* @return null
|
||||
* @return void
|
||||
* @throws extractor_not_initialized_exception when calling this function before init_extractor()
|
||||
*/
|
||||
public function write_end()
|
||||
@@ -310,7 +310,7 @@ class mssql_extractor extends base_extractor
|
||||
* Extracts data from database table (for ODBC driver)
|
||||
*
|
||||
* @param string $table_name name of the database table
|
||||
* @return null
|
||||
* @return void
|
||||
* @throws extractor_not_initialized_exception when calling this function before init_extractor()
|
||||
*/
|
||||
protected function write_data_odbc($table_name)
|
||||
|
@@ -323,7 +323,7 @@ class postgres_extractor extends base_extractor
|
||||
/**
|
||||
* Writes closing line(s) to database backup
|
||||
*
|
||||
* @return null
|
||||
* @return void
|
||||
* @throws extractor_not_initialized_exception when calling this function before init_extractor()
|
||||
*/
|
||||
public function write_end()
|
||||
|
@@ -135,7 +135,7 @@ class sqlite3_extractor extends base_extractor
|
||||
/**
|
||||
* Writes closing line(s) to database backup
|
||||
*
|
||||
* @return null
|
||||
* @return void
|
||||
* @throws extractor_not_initialized_exception when calling this function before init_extractor()
|
||||
*/
|
||||
public function write_end()
|
||||
|
@@ -161,5 +161,7 @@ class config implements \phpbb\db\migration\tool\tool_interface
|
||||
{
|
||||
return call_user_func_array(array(&$this, $call), $arguments);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -126,5 +126,7 @@ class config_text implements \phpbb\db\migration\tool\tool_interface
|
||||
{
|
||||
return call_user_func_array(array(&$this, $call), $arguments);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -339,7 +339,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
|
||||
* Use false to ignore the parent check and check class wide.
|
||||
* @param int|string $module The module id|module_langname
|
||||
* specify that here
|
||||
* @return null
|
||||
* @return void
|
||||
* @throws \phpbb\db\migration\exception
|
||||
*/
|
||||
public function remove($class, $parent = 0, $module = '')
|
||||
@@ -350,7 +350,8 @@ class module implements \phpbb\db\migration\tool\tool_interface
|
||||
if (isset($module['module_langname']))
|
||||
{
|
||||
// Manual Method
|
||||
return $this->remove($class, $parent, $module['module_langname']);
|
||||
$this->remove($class, $parent, $module['module_langname']);
|
||||
return;
|
||||
}
|
||||
|
||||
// Failed.
|
||||
@@ -443,6 +444,8 @@ class module implements \phpbb\db\migration\tool\tool_interface
|
||||
{
|
||||
return call_user_func_array(array(&$this, $call), $arguments);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -470,7 +473,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
|
||||
* key - module_id
|
||||
* value - module_langname
|
||||
*
|
||||
* @return null
|
||||
* @return void
|
||||
*/
|
||||
protected function get_categories_list()
|
||||
{
|
||||
|
@@ -411,7 +411,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface
|
||||
* @param string $type The type (role|group)
|
||||
* @param bool $has_permission True if you want to give them permission,
|
||||
* false if you want to deny them permission
|
||||
* @return null
|
||||
* @return void
|
||||
* @throws \phpbb\db\migration\exception
|
||||
*/
|
||||
public function permission_set($name, $auth_option, $type = 'role', $has_permission = true)
|
||||
@@ -506,7 +506,8 @@ class permission implements \phpbb\db\migration\tool\tool_interface
|
||||
|
||||
if (count($auth_option))
|
||||
{
|
||||
return $this->permission_set($role_name, $auth_option, 'role', $has_permission);
|
||||
$this->permission_set($role_name, $auth_option, 'role', $has_permission);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,7 +571,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface
|
||||
* @param string|array $auth_option The auth_option or array of
|
||||
* auth_options you would like to set
|
||||
* @param string $type The type (role|group)
|
||||
* @return null
|
||||
* @return void
|
||||
* @throws \phpbb\db\migration\exception
|
||||
*/
|
||||
public function permission_unset($name, $auth_option, $type = 'role')
|
||||
@@ -643,7 +644,8 @@ class permission implements \phpbb\db\migration\tool\tool_interface
|
||||
throw new \phpbb\db\migration\exception('ROLE_ASSIGNED_NOT_EXIST', $name, $role_id);
|
||||
}
|
||||
|
||||
return $this->permission_unset($role_name, $auth_option, 'role');
|
||||
$this->permission_unset($role_name, $auth_option, 'role');
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . '
|
||||
|
@@ -15,6 +15,7 @@ namespace phpbb\db;
|
||||
|
||||
use phpbb\config\config;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\db\migration\exception;
|
||||
use phpbb\db\migration\helper;
|
||||
use phpbb\db\output_handler\migrator_output_handler_interface;
|
||||
use phpbb\db\output_handler\null_migrator_output_handler;
|
||||
@@ -157,7 +158,7 @@ class migrator
|
||||
/**
|
||||
* Loads all migrations and their application state from the database.
|
||||
*
|
||||
* @return null
|
||||
* @return void
|
||||
*/
|
||||
public function load_migration_state()
|
||||
{
|
||||
@@ -203,7 +204,7 @@ class migrator
|
||||
* Sets the list of available migration class names to the given array.
|
||||
*
|
||||
* @param array $class_names An array of migration class names
|
||||
* @return null
|
||||
* @return void
|
||||
*/
|
||||
public function set_migrations($class_names)
|
||||
{
|
||||
@@ -256,7 +257,7 @@ class migrator
|
||||
* The update step can either be a schema or a (partial) data update. To
|
||||
* check if update() needs to be called again use the finished() method.
|
||||
*
|
||||
* @return null
|
||||
* @return void
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
@@ -329,7 +330,7 @@ class migrator
|
||||
*
|
||||
* @param string $name The class name of the migration
|
||||
* @return bool Whether any update step was successfully run
|
||||
* @throws \phpbb\db\migration\exception
|
||||
* @throws exception
|
||||
*/
|
||||
protected function try_apply($name)
|
||||
{
|
||||
@@ -365,7 +366,7 @@ class migrator
|
||||
$missing = $this->unfulfillable($depend);
|
||||
if ($missing !== false)
|
||||
{
|
||||
throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $missing);
|
||||
throw new exception('MIGRATION_NOT_FULFILLABLE', $name, $missing);
|
||||
}
|
||||
|
||||
if (!isset($this->migration_state[$depend]) ||
|
||||
@@ -480,7 +481,7 @@ class migrator
|
||||
$this->output_handler->write(array('MIGRATION_DATA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE);
|
||||
}
|
||||
}
|
||||
catch (\phpbb\db\migration\exception $e)
|
||||
catch (exception $e)
|
||||
{
|
||||
// Reset data state and revert the schema changes
|
||||
$state['migration_data_state'] = '';
|
||||
@@ -653,7 +654,7 @@ class migrator
|
||||
* @param bool $revert true to revert a data step
|
||||
* @return bool|array migration state. True if completed, serialized array if not finished
|
||||
* @psalm-return bool|array{result: mixed, step: int}
|
||||
* @throws \phpbb\db\migration\exception
|
||||
* @throws exception
|
||||
*/
|
||||
protected function process_data_step($steps, $state, $revert = false)
|
||||
{
|
||||
@@ -693,7 +694,7 @@ class migrator
|
||||
);
|
||||
}
|
||||
}
|
||||
catch (\phpbb\db\migration\exception $e)
|
||||
catch (exception $e)
|
||||
{
|
||||
// We should try rolling back here
|
||||
foreach ($steps as $reverse_step_identifier => $reverse_step)
|
||||
@@ -715,15 +716,16 @@ class migrator
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a single step
|
||||
*
|
||||
* An exception should be thrown if an error occurs
|
||||
*
|
||||
* @param mixed $step Data step from migration
|
||||
* @param mixed $last_result Result to pass to the callable (only for 'custom' method)
|
||||
* @param bool $reverse False to install, True to attempt uninstallation by reversing the call
|
||||
* @return null
|
||||
*/
|
||||
* Run a single step
|
||||
*
|
||||
* An exception should be thrown if an error occurs
|
||||
*
|
||||
* @param mixed $step Data step from migration
|
||||
* @param mixed $last_result Result to pass to the callable (only for 'custom' method)
|
||||
* @param bool $reverse False to install, True to attempt uninstallation by reversing the call
|
||||
* @return mixed
|
||||
* @throws exception
|
||||
*/
|
||||
protected function run_step($step, $last_result = 0, $reverse = false)
|
||||
{
|
||||
$callable_and_parameters = $this->get_callable_from_step($step, $last_result, $reverse);
|
||||
@@ -747,7 +749,7 @@ class migrator
|
||||
* @param bool $reverse False to install, True to attempt uninstallation by reversing the call
|
||||
* @return array|false Array with parameters for call_user_func_array(), 0 is the callable, 1 is parameters;
|
||||
* false if no callable can be created from data setp
|
||||
* @throws \phpbb\db\migration\exception
|
||||
* @throws exception
|
||||
*/
|
||||
protected function get_callable_from_step(array $step, $last_result = 0, $reverse = false)
|
||||
{
|
||||
@@ -769,12 +771,12 @@ class migrator
|
||||
case 'if':
|
||||
if (!isset($parameters[0]))
|
||||
{
|
||||
throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step);
|
||||
throw new exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step);
|
||||
}
|
||||
|
||||
if (!isset($parameters[1]))
|
||||
{
|
||||
throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step);
|
||||
throw new exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step);
|
||||
}
|
||||
|
||||
if ($reverse)
|
||||
@@ -799,7 +801,7 @@ class migrator
|
||||
case 'custom':
|
||||
if (!is_callable($parameters[0]))
|
||||
{
|
||||
throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step);
|
||||
throw new exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step);
|
||||
}
|
||||
|
||||
if ($reverse)
|
||||
@@ -818,17 +820,17 @@ class migrator
|
||||
default:
|
||||
if (!$method)
|
||||
{
|
||||
throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step);
|
||||
throw new exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step);
|
||||
}
|
||||
|
||||
if (!isset($this->tools[$class]))
|
||||
{
|
||||
throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step);
|
||||
throw new exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step);
|
||||
}
|
||||
|
||||
if (!method_exists(get_class($this->tools[$class]), $method))
|
||||
{
|
||||
throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step);
|
||||
throw new exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step);
|
||||
}
|
||||
|
||||
// Attempt to reverse operations
|
||||
@@ -855,7 +857,7 @@ class migrator
|
||||
*
|
||||
* @param string $name Name of the migration
|
||||
* @param array $state
|
||||
* @return null
|
||||
* @return void
|
||||
*/
|
||||
protected function set_migration_state($name, $state)
|
||||
{
|
||||
@@ -993,7 +995,7 @@ class migrator
|
||||
* THIS WILL THROW ERRORS IF MIGRATIONS ALREADY EXIST IN THE TABLE, DO NOT CALL MORE THAN ONCE!
|
||||
*
|
||||
* @param array $migrations Array of migrations (names) to add to the migrations table
|
||||
* @return null
|
||||
* @return void
|
||||
*/
|
||||
public function populate_migrations($migrations)
|
||||
{
|
||||
@@ -1016,7 +1018,7 @@ class migrator
|
||||
|
||||
/**
|
||||
* Creates the migrations table if it does not exist.
|
||||
* @return null
|
||||
* @return void
|
||||
*/
|
||||
public function create_migrations_table()
|
||||
{
|
||||
|
Reference in New Issue
Block a user