diff --git a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php index 0279888de1..78df9766dc 100644 --- a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php +++ b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php @@ -19,21 +19,34 @@ use PHP_CodeSniffer\Sniffs\Sniff; */ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff { + const FIND = [ + T_NS_SEPARATOR, + T_STRING, + T_WHITESPACE, + ]; + /** * {@inheritdoc} */ public function register() { - return array(T_USE); + return [T_USE]; } - protected function check(File $phpcsFile, $found_name, $full_name, $short_name, $line) + protected function check(File $phpcsFile, $found_name, $full_name, $short_name, $stack_pointer) { + $found_name_normalized = ltrim($found_name, '\\'); + $full_name = ltrim($full_name, '\\'); - if ($found_name === $full_name) + $is_global = ($full_name === $short_name); + $unnecessarily_fully_qualified = ($is_global) + ? ($found_name_normalized !== $found_name && $found_name_normalized === $short_name) + : ($found_name_normalized === $full_name); + + if ($unnecessarily_fully_qualified) { $error = 'Either use statement or full name must be used.'; - $phpcsFile->addError($error, $line, 'FullName'); + $phpcsFile->addError($error, $stack_pointer, 'FullName'); } if ($found_name === $short_name) @@ -58,27 +71,50 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff $class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), ($stackPtr + 1)); - $find = array( - T_NS_SEPARATOR, - T_STRING, - T_WHITESPACE, - ); - - $class_name_end = $phpcsFile->findNext($find, ($stackPtr + 1), null, true); + $class_name_end = $phpcsFile->findNext(self::FIND, ($stackPtr + 1), null, true); $aliasing_as_position = $phpcsFile->findNext(T_AS, $class_name_end, null, false, null, true); if ($aliasing_as_position !== false) { $alias_position = $phpcsFile->findNext(T_STRING, $aliasing_as_position, null, false, null, true); - $class_name_short = $tokens[$alias_position]['content']; - $class_name_full = $phpcsFile->getTokensAsString($class_name_start, ($class_name_end - $class_name_start - 1)); + $name_short = $tokens[$alias_position]['content']; + $name_full = $phpcsFile->getTokensAsString($class_name_start, ($class_name_end - $class_name_start - 1)); } else { - $class_name_full = $phpcsFile->getTokensAsString($class_name_start, ($class_name_end - $class_name_start)); - $class_name_short = $tokens[$class_name_end - 1]['content']; + $name_full = $phpcsFile->getTokensAsString($class_name_start, ($class_name_end - $class_name_start)); + $name_short = $tokens[$class_name_end - 1]['content']; } + if ($tokens[$class_name_start]['content'] === 'function' + && $tokens[$class_name_start + 1]['code'] === T_WHITESPACE) + { + $class_name_start += 2; + $name_full = $phpcsFile->getTokensAsString( + $class_name_start, + ($class_name_end - $class_name_start - (int) ($aliasing_as_position !== false)) + ); + $ok = $this->findFunctionUsage($phpcsFile, $stackPtr, $tokens, $name_full, $name_short); + } + else + { + $ok = $this->findClassUsage($phpcsFile, $stackPtr, $tokens, $name_full, $name_short); + } + + if ($name_full[0] === '\\') + { + $phpcsFile->addError("There must not be a leading '\\' in use statements.", $stackPtr, 'Malformed'); + } + + if (!$ok) + { + $error = 'There must not be unused USE statements.'; + $phpcsFile->addError($error, $stackPtr, 'Unused'); + } + } + + private function findClassUsage(File $phpcsFile, $stackPtr, $tokens, $class_name_full, $class_name_short) + { $ok = false; // Checks in simple statements (new, instanceof and extends) @@ -95,11 +131,11 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff continue; } - $simple_class_name_end = $phpcsFile->findNext($find, ($simple_statement + 1), null, true); + $simple_class_name_end = $phpcsFile->findNext(self::FIND, ($simple_statement + 1), null, true); $simple_class_name = trim($phpcsFile->getTokensAsString($simple_class_name_start, ($simple_class_name_end - $simple_class_name_start))); - $ok = $this->check($phpcsFile, $simple_class_name, $class_name_full, $class_name_short, $simple_statement) ? true : $ok; + $ok = $this->check($phpcsFile, $simple_class_name, $class_name_full, $class_name_short, $simple_statement) || $ok; } } @@ -109,12 +145,12 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff { $old_paamayim_nekudotayim = $paamayim_nekudotayim; - $paamayim_nekudotayim_class_name_start = $phpcsFile->findPrevious($find, $paamayim_nekudotayim - 1, null, true); + $paamayim_nekudotayim_class_name_start = $phpcsFile->findPrevious(self::FIND, $paamayim_nekudotayim - 1, null, true); $paamayim_nekudotayim_class_name_end = $paamayim_nekudotayim - 1; $paamayim_nekudotayim_class_name = trim($phpcsFile->getTokensAsString($paamayim_nekudotayim_class_name_start + 1, ($paamayim_nekudotayim_class_name_end - $paamayim_nekudotayim_class_name_start))); - $ok = $this->check($phpcsFile, $paamayim_nekudotayim_class_name, $class_name_full, $class_name_short, $paamayim_nekudotayim) ? true : $ok; + $ok = $this->check($phpcsFile, $paamayim_nekudotayim_class_name, $class_name_full, $class_name_short, $paamayim_nekudotayim) || $ok; } // Checks in implements @@ -129,11 +165,11 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff $old_implemented_class = $implemented_class; $implements_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), ($implemented_class - 1)); - $implements_class_name_end = $phpcsFile->findNext($find, ($implemented_class - 1), null, true); + $implements_class_name_end = $phpcsFile->findNext(self::FIND, ($implemented_class - 1), null, true); $implements_class_name = trim($phpcsFile->getTokensAsString($implements_class_name_start, ($implements_class_name_end - $implements_class_name_start))); - $ok = $this->check($phpcsFile, $implements_class_name, $class_name_full, $class_name_short, $implements) ? true : $ok; + $ok = $this->check($phpcsFile, $implements_class_name, $class_name_full, $class_name_short, $implements) || $ok; } } @@ -141,7 +177,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff while (($docblock = $phpcsFile->findNext(T_DOC_COMMENT_CLOSE_TAG, ($old_docblock + 1))) !== false) { $old_docblock = $docblock; - $ok = $this->checkDocblock($phpcsFile, $docblock, $tokens, $class_name_full, $class_name_short) ? true : $ok; + $ok = $this->checkDocblock($phpcsFile, $docblock, $tokens, $class_name_full, $class_name_short) || $ok; } // Checks in type hinting @@ -154,7 +190,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff $params = $phpcsFile->getMethodParameters($function_declaration); foreach ($params as $param) { - $ok = $this->check($phpcsFile, $param['type_hint'], $class_name_full, $class_name_short, $function_declaration) ? true : $ok; + $ok = $this->check($phpcsFile, $param['type_hint'], $class_name_full, $class_name_short, $function_declaration) || $ok; } } @@ -165,18 +201,81 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff $old_catch = $catch; $caught_class_name_start = $phpcsFile->findNext(array(T_NS_SEPARATOR, T_STRING), $catch + 1); - $caught_class_name_end = $phpcsFile->findNext($find, $caught_class_name_start + 1, null, true); + $caught_class_name_end = $phpcsFile->findNext(self::FIND, $caught_class_name_start + 1, null, true); $caught_class_name = trim($phpcsFile->getTokensAsString($caught_class_name_start, ($caught_class_name_end - $caught_class_name_start))); - $ok = $this->check($phpcsFile, $caught_class_name, $class_name_full, $class_name_short, $catch) ? true : $ok; + $ok = $this->check($phpcsFile, $caught_class_name, $class_name_full, $class_name_short, $catch) || $ok; } - if (!$ok) + return $ok; + } + + private function findFunctionUsage(File $phpcsFile, $stackPtr, $tokens, $name_full, $name_short) + { + $ok = false; + $position = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $stackPtr + 1); + while ($position !== false) { - $error = 'There must not be unused USE statements.'; - $phpcsFile->addError($error, $stackPtr, 'Unused'); + $function_name_end = $position; + $found_start = 1 + $phpcsFile->findPrevious( + [T_NS_SEPARATOR, T_STRING, T_WHITESPACE], + $function_name_end - 1, + null, + true + ); + + $position = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $position + 1); + if ($found_start === null) + { + continue; + } + + $function_name_start = $found_start; + + // Trim the output. + while ($tokens[$function_name_start]['code'] === T_WHITESPACE && $function_name_start < $function_name_end) + { + ++$function_name_start; + } + + while ($tokens[$function_name_end]['code'] === T_WHITESPACE && $function_name_end > $function_name_start) + { + --$function_name_end; + } + + $function_name_length = $function_name_end - $function_name_start; + + // Filter out control structures, built in type constructors, etc. + if ($function_name_length <= 0) + { + continue; + } + + // This doesn't seem to be valid PHP, where is the opening tag? + if ($found_start === 0) + { + continue; + } + + $previous_token = $found_start - 1; + $filter = [ + T_FUNCTION, // Function declaration + T_OBJECT_OPERATOR, // Method call + T_DOUBLE_COLON, // Static method call + ]; + + // Filter out calls to methods and function declarations. + if (in_array($tokens[$previous_token]['code'], $filter)) + { + continue; + } + + $function_name = $phpcsFile->getTokensAsString($function_name_start, $function_name_length); + $ok = $this->check($phpcsFile, $function_name, $name_full, $name_short, $function_name_start) || $ok; } + + return $ok; } /** @@ -247,7 +346,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff $classes = explode('|', str_replace('[]', '', $classes)); foreach ($classes as $class) { - $ok = $this->check($phpcsFile, $class, $class_name_full, $class_name_short, $tokens[$tag + 2]['line']) ? true : $ok; + $ok = $this->check($phpcsFile, $class, $class_name_full, $class_name_short, $tag + 2) || $ok; } } diff --git a/phpBB/phpbb/attachment/resync.php b/phpBB/phpbb/attachment/resync.php index aeacf82511..4e30e94e2d 100644 --- a/phpBB/phpbb/attachment/resync.php +++ b/phpBB/phpbb/attachment/resync.php @@ -13,7 +13,7 @@ namespace phpbb\attachment; -use \phpbb\db\driver\driver_interface; +use phpbb\db\driver\driver_interface; /** * Attachment resync class diff --git a/phpBB/phpbb/console/command/update/check.php b/phpBB/phpbb/console/command/update/check.php index 853f2dc33d..d3f407c952 100644 --- a/phpBB/phpbb/console/command/update/check.php +++ b/phpBB/phpbb/console/command/update/check.php @@ -26,11 +26,12 @@ use Symfony\Component\DependencyInjection\ContainerInterface; class check extends \phpbb\console\command\command { - /** @var \phpbb\config\config */ + /** @var config */ protected $config; /** @var ContainerInterface */ protected $phpbb_container; + /** * @var language */ diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 93a243d66a..3262e6bbc4 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -14,7 +14,7 @@ namespace phpbb\controller; use phpbb\auth\auth; -use \phpbb\cache\driver\driver_interface as cache_interface; +use phpbb\cache\driver\driver_interface as cache_interface; use phpbb\config\config; use phpbb\cron\manager; use phpbb\db\driver\driver_interface; diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php index 70bcee36f2..943bd570d1 100644 --- a/phpBB/phpbb/controller/resolver.php +++ b/phpBB/phpbb/controller/resolver.php @@ -64,7 +64,7 @@ class resolver implements ControllerResolverInterface /** * Load a controller callable * - * @param \Symfony\Component\HttpFoundation\Request $request Symfony Request object + * @param Request $request Symfony Request object * @return bool|Callable Callable or false * @throws \phpbb\controller\exception */ @@ -119,7 +119,7 @@ class resolver implements ControllerResolverInterface * and should match the parameters of the method you are using as your * controller. * - * @param \Symfony\Component\HttpFoundation\Request $request Symfony Request object + * @param Request $request Symfony Request object * @param mixed $controller A callable (controller class, method) * @return array An array of arguments to pass to the controller * @throws \phpbb\controller\exception diff --git a/phpBB/phpbb/cron/event/cron_runner_listener.php b/phpBB/phpbb/cron/event/cron_runner_listener.php index 9e9ecf0d47..c9c13ddc06 100644 --- a/phpBB/phpbb/cron/event/cron_runner_listener.php +++ b/phpBB/phpbb/cron/event/cron_runner_listener.php @@ -26,17 +26,17 @@ use Symfony\Component\HttpKernel\Event\PostResponseEvent; class cron_runner_listener implements EventSubscriberInterface { /** - * @var \phpbb\lock\db + * @var db */ private $cron_lock; /** - * @var \phpbb\cron\manager + * @var manager */ private $cron_manager; /** - * @var \phpbb\request\request_interface + * @var request_interface */ private $request; diff --git a/phpBB/phpbb/cron/manager.php b/phpBB/phpbb/cron/manager.php index 11334fdec9..d1a3ea03da 100644 --- a/phpBB/phpbb/cron/manager.php +++ b/phpBB/phpbb/cron/manager.php @@ -80,8 +80,6 @@ class manager * and puts them into $this->tasks. * * @param array|\Traversable $tasks Array of instances of \phpbb\cron\task\task - * - * @return null */ public function load_tasks($tasks) { @@ -94,8 +92,6 @@ class manager /** * Loads registered tasks from the container, wraps them * and puts them into $this->tasks. - * - * @return null */ public function load_tasks_from_container() { @@ -116,7 +112,7 @@ class manager * * If no tasks are ready, null is returned. * - * @return \phpbb\cron\task\wrapper|null + * @return wrapper|null */ public function find_one_ready_task() { @@ -161,7 +157,7 @@ class manager * Web runner uses this method to resolve names to tasks. * * @param string $name Name of the task to look up. - * @return \phpbb\cron\task\wrapper A wrapped task corresponding to the given name, or null. + * @return wrapper A wrapped task corresponding to the given name, or null. */ public function find_task($name) { @@ -193,7 +189,7 @@ class manager * Wraps a task inside an instance of \phpbb\cron\task\wrapper. * * @param \phpbb\cron\task\task $task The task. - * @return \phpbb\cron\task\wrapper The wrapped task. + * @return wrapper The wrapped task. */ public function wrap_task(\phpbb\cron\task\task $task) { diff --git a/phpBB/phpbb/db/driver/factory.php b/phpBB/phpbb/db/driver/factory.php index db58897b88..b2a5707120 100644 --- a/phpBB/phpbb/db/driver/factory.php +++ b/phpBB/phpbb/db/driver/factory.php @@ -13,7 +13,7 @@ namespace phpbb\db\driver; -use \Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Database Abstraction Layer diff --git a/phpBB/phpbb/db/extractor/mssql_extractor.php b/phpBB/phpbb/db/extractor/mssql_extractor.php index 4eeab4780e..64922c1124 100644 --- a/phpBB/phpbb/db/extractor/mssql_extractor.php +++ b/phpBB/phpbb/db/extractor/mssql_extractor.php @@ -21,7 +21,7 @@ class mssql_extractor extends base_extractor * Writes closing line(s) to database backup * * @return null - * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + * @throws extractor_not_initialized_exception when calling this function before init_extractor() */ public function write_end() { @@ -195,7 +195,7 @@ class mssql_extractor extends base_extractor * * @param string $table_name name of the database table * @return null - * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + * @throws extractor_not_initialized_exception when calling this function before init_extractor() */ protected function write_data_mssqlnative($table_name) { @@ -311,7 +311,7 @@ class mssql_extractor extends base_extractor * * @param string $table_name name of the database table * @return null - * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + * @throws extractor_not_initialized_exception when calling this function before init_extractor() */ protected function write_data_odbc($table_name) { diff --git a/phpBB/phpbb/db/extractor/mysql_extractor.php b/phpBB/phpbb/db/extractor/mysql_extractor.php index f3cb0db457..6d230a6e35 100644 --- a/phpBB/phpbb/db/extractor/mysql_extractor.php +++ b/phpBB/phpbb/db/extractor/mysql_extractor.php @@ -87,7 +87,7 @@ class mysql_extractor extends base_extractor * * @param string $table_name name of the database table * @return null - * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + * @throws extractor_not_initialized_exception when calling this function before init_extractor() */ protected function write_data_mysqli($table_name) { @@ -177,7 +177,7 @@ class mysql_extractor extends base_extractor * * @param string $table_name name of the database table * @return null - * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + * @throws extractor_not_initialized_exception when calling this function before init_extractor() */ protected function new_write_table($table_name) { @@ -202,7 +202,7 @@ class mysql_extractor extends base_extractor * * @param string $table_name name of the database table * @return null - * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + * @throws extractor_not_initialized_exception when calling this function before init_extractor() */ protected function old_write_table($table_name) { diff --git a/phpBB/phpbb/db/extractor/postgres_extractor.php b/phpBB/phpbb/db/extractor/postgres_extractor.php index 5c569abfdf..07c4d38043 100644 --- a/phpBB/phpbb/db/extractor/postgres_extractor.php +++ b/phpBB/phpbb/db/extractor/postgres_extractor.php @@ -324,7 +324,7 @@ class postgres_extractor extends base_extractor * Writes closing line(s) to database backup * * @return null - * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + * @throws extractor_not_initialized_exception when calling this function before init_extractor() */ public function write_end() { diff --git a/phpBB/phpbb/db/extractor/sqlite3_extractor.php b/phpBB/phpbb/db/extractor/sqlite3_extractor.php index ce8da6a652..92ce9bdcc6 100644 --- a/phpBB/phpbb/db/extractor/sqlite3_extractor.php +++ b/phpBB/phpbb/db/extractor/sqlite3_extractor.php @@ -136,7 +136,7 @@ class sqlite3_extractor extends base_extractor * Writes closing line(s) to database backup * * @return null - * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + * @throws extractor_not_initialized_exception when calling this function before init_extractor() */ public function write_end() { diff --git a/phpBB/phpbb/di/extension/container_configuration.php b/phpBB/phpbb/di/extension/container_configuration.php index f98c9d817c..dafdd548eb 100644 --- a/phpBB/phpbb/di/extension/container_configuration.php +++ b/phpBB/phpbb/di/extension/container_configuration.php @@ -22,7 +22,7 @@ class container_configuration implements ConfigurationInterface /** * Generates the configuration tree builder. * - * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + * @return TreeBuilder The tree builder */ public function getConfigTreeBuilder() { diff --git a/phpBB/phpbb/di/service_collection.php b/phpBB/phpbb/di/service_collection.php index 87062dab6c..80fc011606 100644 --- a/phpBB/phpbb/di/service_collection.php +++ b/phpBB/phpbb/di/service_collection.php @@ -21,7 +21,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; class service_collection extends \ArrayObject { /** - * @var \Symfony\Component\DependencyInjection\ContainerInterface + * @var ContainerInterface */ protected $container; diff --git a/phpBB/phpbb/files/upload.php b/phpBB/phpbb/files/upload.php index 534758f159..ef78286cd8 100644 --- a/phpBB/phpbb/files/upload.php +++ b/phpBB/phpbb/files/upload.php @@ -55,7 +55,7 @@ class upload /** @var \bantu\IniGetWrapper\IniGetWrapper ini_get() wrapper */ protected $php_ini; - /** @var \phpbb\language\language Language class */ + /** @var language Language class */ protected $language; /** @var request_interface Request class */ diff --git a/phpBB/phpbb/install/console/command/install/install.php b/phpBB/phpbb/install/console/command/install/install.php index 52a348fe44..980586cb0e 100644 --- a/phpBB/phpbb/install/console/command/install/install.php +++ b/phpBB/phpbb/install/console/command/install/install.php @@ -98,7 +98,7 @@ class install extends \phpbb\console\command\command { $this->iohandler_factory->set_environment('cli'); - /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */ + /** @var cli_iohandler $iohandler */ $iohandler = $this->iohandler_factory->get(); $style = new SymfonyStyle($input, $output); $iohandler->set_style($style, $output); diff --git a/phpBB/phpbb/install/console/command/update/update.php b/phpBB/phpbb/install/console/command/update/update.php index e827761d1c..d6e89b2477 100644 --- a/phpBB/phpbb/install/console/command/update/update.php +++ b/phpBB/phpbb/install/console/command/update/update.php @@ -98,7 +98,7 @@ class update extends \phpbb\console\command\command { $this->iohandler_factory->set_environment('cli'); - /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */ + /** @var cli_iohandler $iohandler */ $iohandler = $this->iohandler_factory->get(); $style = new SymfonyStyle($input, $output); $iohandler->set_style($style, $output); diff --git a/phpBB/phpbb/install/controller/helper.php b/phpBB/phpbb/install/controller/helper.php index ba350bea44..68c0222c18 100644 --- a/phpBB/phpbb/install/controller/helper.php +++ b/phpBB/phpbb/install/controller/helper.php @@ -40,7 +40,7 @@ class helper protected $installer_config; /** - * @var \phpbb\language\language + * @var language */ protected $language; @@ -50,37 +50,37 @@ class helper protected $language_cookie; /** - * @var \phpbb\language\language_file_helper + * @var language_file_helper */ protected $lang_helper; /** - * @var \phpbb\install\helper\navigation\navigation_provider + * @var navigation_provider */ protected $navigation_provider; /** - * @var \phpbb\template\template + * @var template */ protected $template; /** - * @var \phpbb\path_helper + * @var path_helper */ protected $path_helper; /** - * @var \phpbb\request\request + * @var request */ protected $phpbb_request; /** - * @var \phpbb\symfony_request + * @var symfony_request */ protected $request; /** - * @var \phpbb\routing\router + * @var router */ protected $router; diff --git a/phpBB/phpbb/install/helper/container_factory.php b/phpBB/phpbb/install/helper/container_factory.php index 4e843fd7fc..667856af9b 100644 --- a/phpBB/phpbb/install/helper/container_factory.php +++ b/phpBB/phpbb/install/helper/container_factory.php @@ -35,7 +35,7 @@ class container_factory protected $php_ext; /** - * @var \phpbb\request\request + * @var request */ protected $request; @@ -78,7 +78,7 @@ class container_factory * @return \Symfony\Component\DependencyInjection\ContainerInterface|Object phpBB's dependency injection container * or the service specified in $service_name * - * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + * @throws cannot_build_container_exception When container cannot be built * @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException If the service is not defined * @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException When a circular reference is detected * @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException When the service is not defined @@ -101,7 +101,7 @@ class container_factory * * @return mixed * - * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + * @throws cannot_build_container_exception When container cannot be built */ public function get_parameter($param_name) { @@ -117,7 +117,7 @@ class container_factory /** * Build dependency injection container * - * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + * @throws cannot_build_container_exception When container cannot be built */ protected function build_container() { diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php index 9895dd733c..f7d1ac39d2 100644 --- a/phpBB/phpbb/install/helper/database.php +++ b/phpBB/phpbb/install/helper/database.php @@ -231,7 +231,7 @@ class database * * @return bool|array true if table prefix is valid, array of errors otherwise * - * @throws \phpbb\install\exception\invalid_dbms_exception When $dbms is not a valid + * @throws invalid_dbms_exception When $dbms is not a valid */ public function validate_table_prefix($dbms, $table_prefix) { diff --git a/phpBB/phpbb/install/helper/iohandler/factory.php b/phpBB/phpbb/install/helper/iohandler/factory.php index 403a5fed75..5ea1b93398 100644 --- a/phpBB/phpbb/install/helper/iohandler/factory.php +++ b/phpBB/phpbb/install/helper/iohandler/factory.php @@ -54,7 +54,7 @@ class factory * * @return \phpbb\install\helper\iohandler\iohandler_interface * - * @throws \phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception + * @throws iohandler_not_implemented_exception * When the specified iohandler_interface does not exists */ public function get() diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 4baf888506..08906d7830 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -137,7 +137,7 @@ class installer if (!$this->install_config->get('cache_purged_before', false) && $this->purge_cache_before) { - /** @var \phpbb\cache\driver\driver_interface $cache */ + /** @var driver_interface $cache */ $cache = $this->container_factory->get('cache.driver'); $cache->purge(); $this->install_config->set('cache_purged_before', true); @@ -311,7 +311,7 @@ class installer try { - /** @var \phpbb\cache\driver\driver_interface $cache */ + /** @var driver_interface $cache */ $cache = $this->container_factory->get('cache.driver'); $cache->purge(); } diff --git a/phpBB/phpbb/install/installer_configuration.php b/phpBB/phpbb/install/installer_configuration.php index dfafc40b4b..efd0229571 100644 --- a/phpBB/phpbb/install/installer_configuration.php +++ b/phpBB/phpbb/install/installer_configuration.php @@ -22,7 +22,7 @@ class installer_configuration implements ConfigurationInterface /** * Generates the configuration tree builder. * - * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + * @return TreeBuilder The tree builder */ public function getConfigTreeBuilder() { diff --git a/phpBB/phpbb/install/module/install_finish/task/notify_user.php b/phpBB/phpbb/install/module/install_finish/task/notify_user.php index 8b9ac41910..57bff1e311 100644 --- a/phpBB/phpbb/install/module/install_finish/task/notify_user.php +++ b/phpBB/phpbb/install/module/install_finish/task/notify_user.php @@ -36,7 +36,7 @@ class notify_user extends \phpbb\install\task_base protected $auth; /** - * @var \phpbb\config\db + * @var db */ protected $config; diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php index d1f1af6b83..c759f169ed 100644 --- a/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php @@ -91,7 +91,7 @@ class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\insta * * @param bool $use_request_data Whether to use submited data * - * @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data + * @throws user_interaction_required_exception When the user is required to provide data */ protected function request_form_data($use_request_data = false) { diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php index ff2a0a2f86..ead853bebf 100644 --- a/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php @@ -110,7 +110,7 @@ class obtain_board_data extends \phpbb\install\task_base implements \phpbb\insta * * @param bool $use_request_data Whether to use submited data * - * @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data + * @throws user_interaction_required_exception When the user is required to provide data */ protected function request_form_data($use_request_data = false) { diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php index 85c5e06522..3d28dde94f 100644 --- a/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_database_data.php @@ -108,7 +108,7 @@ class obtain_database_data extends \phpbb\install\task_base implements \phpbb\in * * @param bool $use_request_data Whether to use submited data * - * @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data + * @throws user_interaction_required_exception When the user is required to provide data */ protected function request_form_data($use_request_data = false) { diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_file_updater_method.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_file_updater_method.php index 3e890b2954..b7548d663c 100644 --- a/phpBB/phpbb/install/module/obtain_data/task/obtain_file_updater_method.php +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_file_updater_method.php @@ -28,12 +28,12 @@ class obtain_file_updater_method extends task_base protected $available_methods; /** - * @var \phpbb\install\helper\config + * @var config */ protected $installer_config; /** - * @var \phpbb\install\helper\iohandler\iohandler_interface + * @var iohandler_interface */ protected $iohandler; diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_ftp_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_ftp_data.php index 3c17576c13..d94cc4b5fd 100644 --- a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_ftp_data.php +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_ftp_data.php @@ -22,12 +22,12 @@ use phpbb\install\task_base; class obtain_update_ftp_data extends task_base { /** - * @var \phpbb\install\helper\config + * @var config */ protected $installer_config; /** - * @var \phpbb\install\helper\iohandler\iohandler_interface + * @var iohandler_interface */ protected $iohandler; diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php index 9a2e14a937..10383503af 100644 --- a/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php +++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_update_settings.php @@ -21,12 +21,12 @@ use phpbb\install\task_base; class obtain_update_settings extends task_base { /** - * @var \phpbb\install\helper\config + * @var config */ protected $installer_config; /** - * @var \phpbb\install\helper\iohandler\iohandler_interface + * @var iohandler_interface */ protected $iohandler; diff --git a/phpBB/phpbb/install/updater_configuration.php b/phpBB/phpbb/install/updater_configuration.php index 5c1c29f1da..9795ed2cd9 100644 --- a/phpBB/phpbb/install/updater_configuration.php +++ b/phpBB/phpbb/install/updater_configuration.php @@ -22,7 +22,7 @@ class updater_configuration implements ConfigurationInterface /** * Generates the configuration tree builder. * - * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + * @return TreeBuilder The tree builder */ public function getConfigTreeBuilder() { diff --git a/phpBB/phpbb/language/language.php b/phpBB/phpbb/language/language.php index 6af024f176..bf82b26b03 100644 --- a/phpBB/phpbb/language/language.php +++ b/phpBB/phpbb/language/language.php @@ -399,7 +399,7 @@ class language * * @return int The plural-case we need to use for the number plural-rule combination * - * @throws \phpbb\language\exception\invalid_plural_rule_exception When $force_rule has an invalid value + * @throws invalid_plural_rule_exception When $force_rule has an invalid value */ public function get_plural_form($number, $force_rule = false) { diff --git a/phpBB/phpbb/language/language_file_loader.php b/phpBB/phpbb/language/language_file_loader.php index b064dd84a4..16dc2ab528 100644 --- a/phpBB/phpbb/language/language_file_loader.php +++ b/phpBB/phpbb/language/language_file_loader.php @@ -13,7 +13,7 @@ namespace phpbb\language; -use \phpbb\language\exception\language_file_not_found; +use phpbb\language\exception\language_file_not_found; /** * Language file loader diff --git a/phpBB/phpbb/module/module_manager.php b/phpBB/phpbb/module/module_manager.php index 00df33f62f..e17af7b220 100644 --- a/phpBB/phpbb/module/module_manager.php +++ b/phpBB/phpbb/module/module_manager.php @@ -76,7 +76,7 @@ class module_manager * * @return array Array of data fetched from the database * - * @throws \phpbb\module\exception\module_not_found_exception When there is no module with $module_id + * @throws module_not_found_exception When there is no module with $module_id */ public function get_module_row($module_id, $module_class) { @@ -243,7 +243,7 @@ class module_manager * * @param array &$module_data The module data * - * @throws \phpbb\module\exception\module_not_found_exception When parent module or the category is not exist + * @throws module_not_found_exception When parent module or the category is not exist */ public function update_module_data(&$module_data) { @@ -340,8 +340,8 @@ class module_manager * @param int $to_parent_id ID of the target parent module * @param string $module_class Class of the module (acp, ucp, mcp etc...) * - * @throws \phpbb\module\exception\module_not_found_exception If the module specified to move modules from does not - * have any children. + * @throws module_not_found_exception If the module specified to move modules from does not + * have any children. */ public function move_module($from_module_id, $to_parent_id, $module_class) { @@ -433,7 +433,7 @@ class module_manager * @param int $module_id ID of the module to delete * @param string $module_class Class of the module (acp, ucp, mcp etc...) * - * @throws \phpbb\module\exception\module_exception When the specified module cannot be removed + * @throws module_exception When the specified module cannot be removed */ public function delete_module($module_id, $module_class) { @@ -482,7 +482,7 @@ class module_manager * * @return string Returns the language name of the module * - * @throws \phpbb\module\exception\module_not_found_exception When the specified module does not exists + * @throws module_not_found_exception When the specified module does not exists */ public function move_module_by($module_row, $module_class, $action = 'move_up', $steps = 1) { diff --git a/phpBB/phpbb/notification/method/email.php b/phpBB/phpbb/notification/method/email.php index c93a7625f1..8af144062a 100644 --- a/phpBB/phpbb/notification/method/email.php +++ b/phpBB/phpbb/notification/method/email.php @@ -108,7 +108,7 @@ class email extends \phpbb\notification\method\messenger_base { $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->notification_emails_table); - /** @var \phpbb\notification\type\type_interface $notification */ + /** @var type_interface $notification */ foreach ($this->queue as $notification) { $data = self::clean_data($notification->get_insert_array()); diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index 43030e2a5b..c0b1b5d596 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -97,7 +97,7 @@ abstract class messenger_base extends \phpbb\notification\method\base $messenger = new \messenger(); // Time to go through the queue and send emails - /** @var \phpbb\notification\type\type_interface $notification */ + /** @var type_interface $notification */ foreach ($this->queue as $notification) { if ($notification->get_email_template() === false) diff --git a/phpBB/phpbb/report/controller/report.php b/phpBB/phpbb/report/controller/report.php index 84be09e27b..e151d0d291 100644 --- a/phpBB/phpbb/report/controller/report.php +++ b/phpBB/phpbb/report/controller/report.php @@ -92,7 +92,7 @@ class report * @param int $id ID of the entity to report * @param string $mode * @return \Symfony\Component\HttpFoundation\Response a Symfony response object - * @throws \phpbb\exception\http_exception when $mode or $id is invalid for some reason + * @throws http_exception when $mode or $id is invalid for some reason */ public function handle($id, $mode) { diff --git a/phpBB/phpbb/report/exception/factory_invalid_argument_exception.php b/phpBB/phpbb/report/exception/factory_invalid_argument_exception.php index 19de91eea3..346dd36316 100644 --- a/phpBB/phpbb/report/exception/factory_invalid_argument_exception.php +++ b/phpBB/phpbb/report/exception/factory_invalid_argument_exception.php @@ -13,7 +13,7 @@ namespace phpbb\report\exception; -use \phpbb\exception\runtime_exception; +use phpbb\exception\runtime_exception; class factory_invalid_argument_exception extends runtime_exception { diff --git a/phpBB/phpbb/report/exception/invalid_report_exception.php b/phpBB/phpbb/report/exception/invalid_report_exception.php index 03ff0a872d..27996de5e1 100644 --- a/phpBB/phpbb/report/exception/invalid_report_exception.php +++ b/phpBB/phpbb/report/exception/invalid_report_exception.php @@ -13,7 +13,7 @@ namespace phpbb\report\exception; -use \phpbb\exception\runtime_exception; +use phpbb\exception\runtime_exception; class invalid_report_exception extends runtime_exception { diff --git a/phpBB/phpbb/report/handler_factory.php b/phpBB/phpbb/report/handler_factory.php index ec229aac54..b25386c4b2 100644 --- a/phpBB/phpbb/report/handler_factory.php +++ b/phpBB/phpbb/report/handler_factory.php @@ -37,7 +37,7 @@ class handler_factory * * @param string $type * @return \phpbb\report\report_handler_interface - * @throws \phpbb\report\exception\factory_invalid_argument_exception if $type is not valid + * @throws factory_invalid_argument_exception if $type is not valid */ public function get_instance($type) { diff --git a/phpBB/phpbb/report/report_handler.php b/phpBB/phpbb/report/report_handler.php index 97acc1763e..ec2f1e035f 100644 --- a/phpBB/phpbb/report/report_handler.php +++ b/phpBB/phpbb/report/report_handler.php @@ -55,7 +55,7 @@ abstract class report_handler implements report_handler_interface * * @param \phpbb\db\driver\driver_interface $db * @param \phpbb\event\dispatcher_interface $dispatcher - * @param \phpbb\config\db $config + * @param \phpbb\config\config $config * @param \phpbb\auth\auth $auth * @param \phpbb\user $user * @param \phpbb\notification\manager $notification diff --git a/phpBB/phpbb/report/report_handler_pm.php b/phpBB/phpbb/report/report_handler_pm.php index 774ca329ad..1350ccccb0 100644 --- a/phpBB/phpbb/report/report_handler_pm.php +++ b/phpBB/phpbb/report/report_handler_pm.php @@ -22,7 +22,7 @@ class report_handler_pm extends report_handler { /** * {@inheritdoc} - * @throws \phpbb\report\exception\pm_reporting_disabled_exception when PM reporting is disabled on the board + * @throws pm_reporting_disabled_exception when PM reporting is disabled on the board */ public function add_report($id, $reason_id, $report_text, $user_notify) { @@ -92,7 +92,7 @@ class report_handler_pm extends report_handler /** * {@inheritdoc} - * @throws \phpbb\report\exception\pm_reporting_disabled_exception when PM reporting is disabled on the board + * @throws pm_reporting_disabled_exception when PM reporting is disabled on the board */ public function validate_report_request($id) { diff --git a/phpBB/phpbb/report/report_handler_post.php b/phpBB/phpbb/report/report_handler_post.php index 52f09683ce..814fd3d8bc 100644 --- a/phpBB/phpbb/report/report_handler_post.php +++ b/phpBB/phpbb/report/report_handler_post.php @@ -28,7 +28,7 @@ class report_handler_post extends report_handler /** * {@inheritdoc} - * @throws \phpbb\report\exception\report_permission_denied_exception when the user does not have permission to report the post + * @throws report_permission_denied_exception when the user does not have permission to report the post */ public function add_report($id, $reason_id, $report_text, $user_notify) { @@ -89,7 +89,7 @@ class report_handler_post extends report_handler /** * {@inheritdoc} - * @throws \phpbb\report\exception\report_permission_denied_exception when the user does not have permission to report the post + * @throws report_permission_denied_exception when the user does not have permission to report the post */ public function validate_report_request($id) { diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 7a16b86244..98c0838b4c 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -129,7 +129,7 @@ class twig extends \phpbb\template\base * * @return array Style tree, most specific first * - * @throws \phpbb\template\exception\user_object_not_available When user service was not set + * @throws user_object_not_available When user service was not set */ public function get_user_style() { diff --git a/phpBB/phpbb/textformatter/s9e/bbcode_merger.php b/phpBB/phpbb/textformatter/s9e/bbcode_merger.php index d1bedb0b72..8173037455 100644 --- a/phpBB/phpbb/textformatter/s9e/bbcode_merger.php +++ b/phpBB/phpbb/textformatter/s9e/bbcode_merger.php @@ -25,7 +25,7 @@ class bbcode_merger protected $configurator; /** - * @param \phpbb\textformatter\s9e\factory $factory + * @param factory $factory */ public function __construct(factory $factory) { diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index 2285d99eb8..721549cf72 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -207,7 +207,7 @@ class factory implements \phpbb\textformatter\cache_interface * Modify the s9e\TextFormatter configurator before the default settings are set * * @event core.text_formatter_s9e_configure_before - * @var \s9e\TextFormatter\Configurator configurator Configurator instance + * @var Configurator configurator Configurator instance * @since 3.2.0-a1 */ $vars = array('configurator'); @@ -368,7 +368,7 @@ class factory implements \phpbb\textformatter\cache_interface * Modify the s9e\TextFormatter configurator after the default settings are set * * @event core.text_formatter_s9e_configure_after - * @var \s9e\TextFormatter\Configurator configurator Configurator instance + * @var Configurator configurator Configurator instance * @since 3.2.0-a1 */ $vars = array('configurator'); @@ -446,7 +446,7 @@ class factory implements \phpbb\textformatter\cache_interface /** * Configure the Autolink / Autoemail plugins used to linkify text * - * @param \s9e\TextFormatter\Configurator $configurator + * @param Configurator $configurator * @return void */ protected function configure_autolink(Configurator $configurator)