diff options
-rw-r--r-- | build/build.xml | 6 | ||||
-rw-r--r-- | build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php | 93 | ||||
-rw-r--r-- | phpBB/includes/constants.php | 2 | ||||
-rw-r--r-- | phpBB/install/schemas/schema_data.sql | 2 |
4 files changed, 57 insertions, 46 deletions
diff --git a/build/build.xml b/build/build.xml index 3d09a93a62..c412a747ac 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,9 +2,9 @@ <project name="phpBB" description="The phpBB forum software" default="all" basedir="../"> <!-- a few settings for the build --> - <property name="newversion" value="3.1.9" /> - <property name="prevversion" value="3.1.8" /> - <property name="olderversions" value="3.0.14, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.7-pl1, 3.1.9-RC1" /> + <property name="newversion" value="3.1.10-dev" /> + <property name="prevversion" value="3.1.9" /> + <property name="olderversions" value="3.0.14, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.7-pl1, 3.1.8" /> <!-- no configuration should be needed beyond this point --> <property name="oldversions" value="${olderversions}, ${prevversion}" /> diff --git a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php index 7ffd1aadd6..3125e4f05f 100644 --- a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php +++ b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php @@ -129,53 +129,19 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff } } + $old_docblock = $stackPtr; + 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; + } + // Checks in type hinting $old_function_declaration = $stackPtr; while (($function_declaration = $phpcsFile->findNext(T_FUNCTION, ($old_function_declaration + 1))) !== false) { $old_function_declaration = $function_declaration; - // Check docblocks - $find = array( - T_COMMENT, - T_DOC_COMMENT_CLOSE_TAG, - T_DOC_COMMENT, - T_CLASS, - T_FUNCTION, - T_OPEN_TAG, - ); - - $comment_end = $phpcsFile->findPrevious($find, ($function_declaration - 1)); - if ($comment_end !== false) - { - if ($tokens[$comment_end]['code'] === T_DOC_COMMENT_CLOSE_TAG) - { - $comment_start = $tokens[$comment_end]['comment_opener']; - foreach ($tokens[$comment_start]['comment_tags'] as $tag) { - if ($tokens[$tag]['content'] !== '@param' && $tokens[$tag]['content'] !== '@return' && $tokens[$tag]['content'] !== '@throws') { - continue; - } - - $classes = $tokens[($tag + 2)]['content']; - $space = strpos($classes, ' '); - if ($space !== false) { - $classes = substr($classes, 0, $space); - } - - $tab = strpos($classes, "\t"); - if ($tab !== false) { - $classes = substr($classes, 0, $tab); - } - - $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; - } - } - } - } - // Check type hint $params = $phpcsFile->getMethodParameters($function_declaration); foreach ($params as $param) @@ -234,4 +200,49 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff return false; } + + /** + * @param PHP_CodeSniffer_File $phpcsFile + * @param int $field + * @param array $tokens + * @param string $class_name_full + * @param string $class_name_short + * @param bool $ok + * + * @return bool + */ + private function checkDocblock(PHP_CodeSniffer_File $phpcsFile, $comment_end, $tokens, $class_name_full, $class_name_short) + { + $ok = false; + + $comment_start = $tokens[$comment_end]['comment_opener']; + foreach ($tokens[$comment_start]['comment_tags'] as $tag) + { + if (!in_array($tokens[$tag]['content'], array('@param', '@var', '@return', '@throws'), true)) + { + continue; + } + + $classes = $tokens[($tag + 2)]['content']; + $space = strpos($classes, ' '); + if ($space !== false) + { + $classes = substr($classes, 0, $space); + } + + $tab = strpos($classes, "\t"); + if ($tab !== false) + { + $classes = substr($classes, 0, $tab); + } + + $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; + } + } + + return $ok; + } } diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index c266f0a246..7260c5719b 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.1.9'); +define('PHPBB_VERSION', '3.1.10-dev'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index d6b7d5d3f6..9262f70b5d 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -273,7 +273,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0 INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('use_system_cron', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.9'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.10-dev'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); |