aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/build.xml34
-rw-r--r--build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php61
-rw-r--r--build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php9
-rw-r--r--build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php9
-rw-r--r--build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php17
5 files changed, 75 insertions, 55 deletions
diff --git a/build/build.xml b/build/build.xml
index 49ff9d9b71..1dc8136802 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -2,7 +2,7 @@
<project name="phpBB" description="The phpBB forum software" default="all" basedir="../">
<!-- a few settings for the build -->
- <property name="newversion" value="3.2.7-dev" />
+ <property name="newversion" value="3.3.0-a1-dev" />
<property name="prevversion" value="3.2.6" />
<property name="olderversions" value="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, 3.1.9, 3.1.10, 3.1.11, 3.1.12, 3.2.0-a1, 3.2.0-a2, 3.2.0-b1, 3.2.0-b2, 3.2.0-RC1, 3.2.0-RC2, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5" />
<!-- no configuration should be needed beyond this point -->
@@ -81,28 +81,36 @@
--ignore=${project.basedir}/phpBB/phpbb/db/migration/data/v30x/*
phpBB/phpbb"
dir="." returnProperty="retval-php-strict" passthru="true" />
+ <php function="preg_replace" returnProperty="sniffIgnoreList">
+ <param value="/\s+/"/>
+ <param value=""/>
+ <param value="${project.basedir}/phpBB/cache/*,
+ ${project.basedir}/phpBB/develop/*,
+ ${project.basedir}/phpBB/ext/*,
+ ${project.basedir}/phpBB/includes/diff/*.php,
+ ${project.basedir}/phpBB/includes/sphinxapi.php,
+ ${project.basedir}/phpBB/includes/utf/data/*,
+ ${project.basedir}/phpBB/install/data/*,
+ ${project.basedir}/phpBB/install/database_update.php,
+ ${project.basedir}/phpBB/phpbb/*,
+ ${project.basedir}/phpBB/vendor/*,
+ ${project.basedir}/phpBB/vendor-ext/*,
+ ${project.basedir}/phpBB/config.php,
+ ${project.basedir}/phpBB/config_dev.php,
+ ${project.basedir}/phpBB/config_test.php"/>
+ </php>
<exec command="phpBB/vendor/bin/phpcs
-s -p
--extensions=php
--standard=build/code_sniffer/ruleset-php-legacy-core.xml
- --ignore=${project.basedir}/phpBB/cache/*
- --ignore=${project.basedir}/phpBB/develop/*
- --ignore=${project.basedir}/phpBB/ext/*
- --ignore=${project.basedir}/phpBB/includes/diff/*.php
- --ignore=${project.basedir}/phpBB/includes/sphinxapi.php
- --ignore=${project.basedir}/phpBB/includes/utf/data/*
- --ignore=${project.basedir}/phpBB/install/data/*
- --ignore=${project.basedir}/phpBB/install/database_update.php
- --ignore=${project.basedir}/phpBB/phpbb/*
- --ignore=${project.basedir}/phpBB/vendor/*
+ --ignore=${sniffIgnoreList}
phpBB"
dir="." returnProperty="retval-php-legacy" passthru="true" />
<exec command="phpBB/vendor/bin/phpcs
-s -p
--extensions=php
--standard=build/code_sniffer/ruleset-php-extensions.xml
- --ignore=${project.basedir}/phpBB/ext/*/tests/*
- --ignore=${project.basedir}/phpBB/ext/*/vendor/*
+ --ignore=${project.basedir}/phpBB/ext/*/tests/*,${project.basedir}/phpBB/ext/*/vendor/*
phpBB/ext"
dir="." returnProperty="retval-php-ext" passthru="true" />
<if>
diff --git a/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php
index 8c0ec853ff..ed8b231be5 100644
--- a/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php
+++ b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php
@@ -11,6 +11,9 @@
*
*/
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
/**
* Checks that each PHP source file contains a valid header as defined by the
* phpBB Coding Guidelines.
@@ -18,7 +21,7 @@
* @package code_sniffer
* @author Manuel Pichler <mapi@phpundercontrol.org>
*/
-class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
+class phpbb_Sniffs_Commenting_FileCommentSniff implements Sniff
{
/**
* Returns an array of tokens this test wants to listen for.
@@ -33,13 +36,13 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
/**
* Processes this test, when one of its tokens is encountered.
*
- * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
+ * @param File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token
* in the stack passed in $tokens.
*
- * @return null
+ * @return void
*/
- public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
+ public function process(File $phpcsFile, $stackPtr): void
{
// We are only interested in the first file comment.
if ($stackPtr !== 0)
@@ -62,7 +65,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
// Mark as error if this is not a doc comment
else if ($start === false || $tokens[$start]['code'] !== T_DOC_COMMENT_OPEN_TAG)
{
- $phpcsFile->addError('Missing required file doc comment.', $stackPtr);
+ $phpcsFile->addError('Missing required file doc comment.', $stackPtr, 'MissingComment');
return;
}
@@ -82,7 +85,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
if ($tokens[$token]['column'] === 1 && (($tokens[$token]['content'] !== '*' && $tokens[$token]['content'] !== ' ') || ($tokens[$token]['content'] === ' ' && $tokens[$token + 1]['content'] !== '*')))
{
$message = 'The file doc comment should not be indented.';
- $phpcsFile->addWarning($message, $token);
+ $phpcsFile->addWarning($message, $token, 'CommentIndented');
}
}
@@ -95,13 +98,13 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
if (!(($tokens[$start + 2]['content'] !== '*' && $tokens[$start + 4]['content'] !== '*') || ($tokens[$start + 3]['content'] !== '*' && $tokens[$start + 6]['content'] !== '*')))
{
$message = 'The first file comment line should be empty.';
- $phpcsFile->addWarning($message, ($start + 1));
+ $phpcsFile->addWarning($message, ($start + 1), 'CommentFirstNotEmpty');
}
if ($tokens[$end - 3]['content'] !== '*' && $tokens[$end - 6]['content'] !== '*')
{
$message = 'The last file comment line should be empty.';
- $phpcsFile->addWarning($message, $end - 1);
+ $phpcsFile->addWarning($message, $end - 1, 'CommentLastNotEmpty');
}
//$this->processPackage($phpcsFile, $start, $tags);
@@ -113,59 +116,59 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
/**
* Checks that the tags array contains a valid package tag
*
- * @param PHP_CodeSniffer_File $phpcsFile The context source file instance.
+ * @param File $phpcsFile The context source file instance.
* @param integer The stack pointer for the first comment token.
* @param array(string=>array) $tags The found file doc comment tags.
*
- * @return null
+ * @return void
*/
- protected function processPackage(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
+ protected function processPackage(File $phpcsFile, $ptr, $tags): void
{
if (!isset($tags['package']))
{
$message = 'Missing require @package tag in file doc comment.';
- $phpcsFile->addError($message, $ptr);
+ $phpcsFile->addError($message, $ptr, 'MissingTagPackage');
}
else if (preg_match('/^([\w]+)$/', $tags['package'][0]) === 0)
{
$message = 'Invalid content found for @package tag.';
- $phpcsFile->addWarning($message, $tags['package'][1]);
+ $phpcsFile->addWarning($message, $tags['package'][1], 'InvalidTagPackage');
}
}
/**
* Checks that the tags array contains a valid version tag
*
- * @param PHP_CodeSniffer_File $phpcsFile The context source file instance.
+ * @param File $phpcsFile The context source file instance.
* @param integer The stack pointer for the first comment token.
* @param array(string=>array) $tags The found file doc comment tags.
*
- * @return null
+ * @return void
*/
- protected function processVersion(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
+ protected function processVersion(File $phpcsFile, $ptr, $tags): void
{
if (!isset($tags['version']))
{
$message = 'Missing require @version tag in file doc comment.';
- $phpcsFile->addError($message, $ptr);
+ $phpcsFile->addError($message, $ptr, 'MissingTagVersion');
}
else if (preg_match('/^\$Id:[^\$]+\$$/', $tags['version'][0]) === 0)
{
$message = 'Invalid content found for @version tag, use "$Id: $".';
- $phpcsFile->addError($message, $tags['version'][1]);
+ $phpcsFile->addError($message, $tags['version'][1], 'InvalidTagVersion');
}
}
/**
* Checks that the tags array contains a valid copyright tag
*
- * @param PHP_CodeSniffer_File $phpcsFile The context source file instance.
+ * @param File $phpcsFile The context source file instance.
* @param integer The stack pointer for the first comment token.
* @param array(string=>array) $tags The found file doc comment tags.
*
- * @return null
+ * @return void
*/
- protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
+ protected function processCopyright(File $phpcsFile, $ptr, $tags): void
{
$copyright = '(c) phpBB Limited <https://www.phpbb.com>';
$tokens = $phpcsFile->getTokens();
@@ -177,7 +180,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
if ($tokens[$tag + 2]['content'] !== $copyright)
{
$message = 'Invalid content found for the first @copyright tag, use "' . $copyright . '".';
- $phpcsFile->addError($message, $tags['copyright'][0][1]);
+ $phpcsFile->addError($message, $tags['copyright'][0][1], 'InvalidTagCopyright');
}
return;
@@ -185,19 +188,19 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
}
$message = 'Missing require @copyright tag in file doc comment.';
- $phpcsFile->addError($message, $ptr);
+ $phpcsFile->addError($message, $ptr, 'MissingTagCopyright');
}
/**
* Checks that the tags array contains a valid license tag
*
- * @param PHP_CodeSniffer_File $phpcsFile The context source file instance.
+ * @param File $phpcsFile The context source file instance.
* @param integer The stack pointer for the first comment token.
* @param array(string=>array) $tags The found file doc comment tags.
*
- * @return null
+ * @return void
*/
- protected function processLicense(PHP_CodeSniffer_File $phpcsFile, $ptr, $tags)
+ protected function processLicense(File $phpcsFile, $ptr, $tags): void
{
$license = 'GNU General Public License, version 2 (GPL-2.0)';
$tokens = $phpcsFile->getTokens();
@@ -210,7 +213,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
if ($found)
{
$message = 'It must be only one @license tag in file doc comment.';
- $phpcsFile->addError($message, $ptr);
+ $phpcsFile->addError($message, $ptr, 'MultiTagVersion');
}
$found = true;
@@ -218,7 +221,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
if ($tokens[$tag + 2]['content'] !== $license)
{
$message = 'Invalid content found for @license tag, use "' . $license . '".';
- $phpcsFile->addError($message, $tags['license'][0][1]);
+ $phpcsFile->addError($message, $tags['license'][0][1], 'InvalidTagLicense');
}
}
}
@@ -226,7 +229,7 @@ class phpbb_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff
if (!$found)
{
$message = 'Missing require @license tag in file doc comment.';
- $phpcsFile->addError($message, $ptr);
+ $phpcsFile->addError($message, $ptr, 'MissingTagLicense');
}
}
}
diff --git a/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php b/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php
index 885c38c5b4..a529fc25cb 100644
--- a/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php
+++ b/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningBraceBsdAllmanSniff.php
@@ -11,11 +11,14 @@
*
*/
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
/**
* Checks that the opening brace of a control structures is on the line after.
* From Generic_Sniffs_Functions_OpeningFunctionBraceBsdAllmanSniff
*/
-class phpbb_Sniffs_ControlStructures_OpeningBraceBsdAllmanSniff implements PHP_CodeSniffer_Sniff
+class phpbb_Sniffs_ControlStructures_OpeningBraceBsdAllmanSniff implements Sniff
{
/**
* Registers the tokens that this sniff wants to listen for.
@@ -36,13 +39,13 @@ class phpbb_Sniffs_ControlStructures_OpeningBraceBsdAllmanSniff implements PHP_C
/**
* Processes this test, when one of its tokens is encountered.
*
- * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
+ * @param File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in the
* stack passed in $tokens.
*
* @return void
*/
- public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
+ public function process(File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
diff --git a/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php b/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php
index 349bccbb02..d4ecd6cb95 100644
--- a/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php
+++ b/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php
@@ -11,11 +11,14 @@
*
*/
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
/**
* Checks that there is exactly one space between the keyword and the opening
* parenthesis of a control structures.
*/
-class phpbb_Sniffs_ControlStructures_OpeningParenthesisSniff implements PHP_CodeSniffer_Sniff
+class phpbb_Sniffs_ControlStructures_OpeningParenthesisSniff implements Sniff
{
/**
* Registers the tokens that this sniff wants to listen for.
@@ -36,13 +39,13 @@ class phpbb_Sniffs_ControlStructures_OpeningParenthesisSniff implements PHP_Code
/**
* Processes this test, when one of its tokens is encountered.
*
- * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
+ * @param File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in the
* stack passed in $tokens.
*
* @return void
*/
- public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
+ public function process(File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
diff --git a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
index b3cdbf7496..0279888de1 100644
--- a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
+++ b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
@@ -11,10 +11,13 @@
*
*/
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
/**
* Checks that each use statement is used.
*/
-class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
+class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff
{
/**
* {@inheritdoc}
@@ -24,7 +27,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
return array(T_USE);
}
- protected function check($phpcsFile, $found_name, $full_name, $short_name, $line)
+ protected function check(File $phpcsFile, $found_name, $full_name, $short_name, $line)
{
if ($found_name === $full_name)
@@ -44,7 +47,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
/**
* {@inheritdoc}
*/
- public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
+ public function process(File $phpcsFile, $stackPtr)
{
if ($this->should_ignore_use($phpcsFile, $stackPtr) === true)
{
@@ -179,13 +182,13 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
/**
* Check if this use statement is part of the namespace block.
*
- * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
+ * @param File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in
* the stack passed in $tokens.
*
* @return bool
*/
- private function should_ignore_use(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
+ private function should_ignore_use(File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
@@ -207,7 +210,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
}
/**
- * @param PHP_CodeSniffer_File $phpcsFile
+ * @param File $phpcsFile
* @param int $field
* @param array $tokens
* @param string $class_name_full
@@ -216,7 +219,7 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
*
* @return bool
*/
- private function checkDocblock(PHP_CodeSniffer_File $phpcsFile, $comment_end, $tokens, $class_name_full, $class_name_short)
+ private function checkDocblock(File $phpcsFile, $comment_end, $tokens, $class_name_full, $class_name_short)
{
$ok = false;