Skip to content

Commit

Permalink
remove tests and improve some codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
810 committed Sep 20, 2023
1 parent 77d668a commit 7df9688
Show file tree
Hide file tree
Showing 51 changed files with 198 additions and 2,220 deletions.
2 changes: 1 addition & 1 deletion Kunena/IDE/eclipse_pdt3_formatter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
<setting id="org.eclipse.php.formatter.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_elseif_statement_on_same_line" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_simple_if_on_one_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.lineSplit" value="150"/>
<setting id="org.eclipse.php.formatter.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
Expand Down
6 changes: 3 additions & 3 deletions Kunena/IDE/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ Go to Preferences->PHP->Code style->Formatter and Import ```eclipse_pdt3_formatt

### PHPStorm
1. Copy the file ```joomla_phpstorm.xml``` to:
- Mac ```~/Library/Preferences/<PRODUCT><VERSION>/codestyles/Joomla.xml```
- Mac ```~/Library/Preferences/<PRODUCT><VERSION>/codestyles/Joomla.xml```
- Windows ```<User home>\.<PRODUCT><VERSION>\config\codestyles\Joomla.xml```
- Linux ```~/.<PRODUCT><VERSION>/config/codestyles/Joomla.xml```
2. Restart PHPStorm
3. Open settings
- Editor > Code Style
- Manage the scheme and select *Joomla* > *Copy to Project*
- Editor > Code Style
- Manage the scheme and select *Joomla* > *Copy to Project*
4. Change the *Scheme* to *Joomla*

### References
Expand Down
2 changes: 1 addition & 1 deletion Kunena/IDE/zend_studio_formatter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_elseif_statement_on_same_line" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_simple_if_on_one_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.lineSplit" value="150"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
Expand Down
18 changes: 9 additions & 9 deletions Kunena/Sniffs/Classes/InstantiateNewClassesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public function register()
return array(T_NEW);
}

/**
* Process the tokens that this sniff is listening for.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file where the token was found.
* @param integer $stackPtr The position in the stack where the token was found.
*
* @return void
*/
/**
* Process the tokens that this sniff is listening for.
*
* @param File $phpcsFile The file where the token was found.
* @param integer $stackPtr The position in the stack where the token was found.
*
* @return void
*/
public function process(File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
Expand Down Expand Up @@ -103,7 +103,7 @@ public function process(File $phpcsFile, $stackPtr)

if ($valid === false)
{
$error = 'Instanciating new class without parameters does not require brackets.';
$error = 'Instantiating new class without parameters does not require brackets.';
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'NewClass');

if ($fix === true)
Expand Down
18 changes: 9 additions & 9 deletions Kunena/Sniffs/Commenting/ClassCommentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ public function register()
);
}

/**
* Processes this test, when one of its tokens is encountered.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token
* in the stack passed in $tokens.
*
* @return void
*/
/**
* Processes this test, when one of its tokens is encountered.
*
* @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(File $phpcsFile, $stackPtr)
{
$this->currentFile = $phpcsFile;
Expand Down
149 changes: 74 additions & 75 deletions Kunena/Sniffs/Commenting/FileCommentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ public function register()
return array(T_OPEN_TAG);
}//end register()

/**
* Processes this test, when one of its tokens is encountered.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in the stack passed in $tokens.
*
* @return integer
*/
/**
* Processes this test, when one of its tokens is encountered.
*
* @param File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in the stack passed in $tokens.
*
* @return integer
*/
public function process(File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
Expand Down Expand Up @@ -201,16 +201,16 @@ public function process(File $phpcsFile, $stackPtr)
return ($phpcsFile->numTokens + 1);
}//end process()

/**
* Processes each required or optional tag.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token
* in the stack passed in $tokens.
* @param int $commentStart Position in the stack where the comment started.
*
* @return void
*/
/**
* Processes each required or optional tag.
*
* @param File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token
* in the stack passed in $tokens.
* @param int $commentStart Position in the stack where the comment started.
*
* @return void
*/
protected function processTags(File $phpcsFile, $stackPtr, $commentStart)
{
$tokens = $phpcsFile->getTokens();
Expand Down Expand Up @@ -259,7 +259,6 @@ protected function processTags(File $phpcsFile, $stackPtr, $commentStart)
$docBlock,
);
$phpcsFile->addError($error, $tag, 'Empty' . ucfirst(substr($name, 1)) . 'Tag', $data);
continue;
}
}//end foreach

Expand Down Expand Up @@ -331,14 +330,14 @@ protected function processTags(File $phpcsFile, $stackPtr, $commentStart)
}//end foreach
}//end processTags()

/**
* Process the category tag.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
/**
* Process the category tag.
*
* @param File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
protected function processCategory(File $phpcsFile, array $tags)
{
$tokens = $phpcsFile->getTokens();
Expand Down Expand Up @@ -379,14 +378,14 @@ protected function processCategory(File $phpcsFile, array $tags)
}//end foreach
}//end processCategory()

/**
* Process the package tag.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
/**
* Process the package tag.
*
* @param File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
protected function processPackage(File $phpcsFile, array $tags)
{
$tokens = $phpcsFile->getTokens();
Expand Down Expand Up @@ -441,14 +440,14 @@ protected function processPackage(File $phpcsFile, array $tags)
}//end foreach
}//end processPackage()

/**
* Process the subpackage tag.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
/**
* Process the subpackage tag.
*
* @param File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
protected function processSubpackage(File $phpcsFile, array $tags)
{
$tokens = $phpcsFile->getTokens();
Expand All @@ -472,14 +471,14 @@ protected function processSubpackage(File $phpcsFile, array $tags)
}//end foreach
}//end processSubpackage()

/**
* Process the author tag(s) that this header comment has.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
/**
* Process the author tag(s) that this header comment has.
*
* @param File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
protected function processAuthor(File $phpcsFile, array $tags)
{
$tokens = $phpcsFile->getTokens();
Expand Down Expand Up @@ -509,14 +508,14 @@ protected function processAuthor(File $phpcsFile, array $tags)
}
}//end processAuthor()

/**
* Process the copyright tags.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
/**
* Process the copyright tags.
*
* @param File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
protected function processCopyright(File $phpcsFile, array $tags)
{
$tokens = $phpcsFile->getTokens();
Expand Down Expand Up @@ -558,14 +557,14 @@ protected function processCopyright(File $phpcsFile, array $tags)
}//end foreach
}//end processCopyright()

/**
* Process the license tag.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
/**
* Process the license tag.
*
* @param File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
protected function processLicense(File $phpcsFile, array $tags)
{
$tokens = $phpcsFile->getTokens();
Expand All @@ -590,14 +589,14 @@ protected function processLicense(File $phpcsFile, array $tags)
}
}//end processLicense()

/**
* Process the version tag.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
/**
* Process the version tag.
*
* @param File $phpcsFile The file being scanned.
* @param array $tags The tokens for these tags.
*
* @return void
*/
protected function processVersion(File $phpcsFile, array $tags)
{
$tokens = $phpcsFile->getTokens();
Expand Down
54 changes: 26 additions & 28 deletions Kunena/Sniffs/Commenting/FunctionCommentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,18 @@
*/
class FunctionCommentSniff extends PEARFunctionCommentSniff
{
/**
* Process the return comment of this function comment.
*
* Extends PEAR.Commenting.FunctionComment.processReturn to exclude @return tag requirements for constructors and destructors and
* to enforce alignment of the doc blocks.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param integer $stackPtr The position of the current token in the stack passed in $tokens.
* @param integer $commentStart The position in the stack where the comment started.
*
* @return void
*
* @todo Reinstate the check on the alignment of the tag
*/
/**
* Process the return comment of this function comment.
*
* Extends PEAR.Commenting.FunctionComment.processReturn to exclude
* @param File $phpcsFile The file being scanned.
* @param integer $stackPtr The position of the current token in the stack passed in $tokens.
* @param integer $commentStart The position in the stack where the comment started.
*
* to enforce alignment of the doc blocks.
* @todo Reinstate the check on the alignment of the tag
* @noinspection DuplicatedCode
*/
protected function processReturn(File $phpcsFile, $stackPtr, $commentStart)
{
$tokens = $phpcsFile->getTokens();
Expand Down Expand Up @@ -228,20 +226,20 @@ protected function processReturn(File $phpcsFile, $stackPtr, $commentStart)
}
}

/**
* Process the function parameter comments.
*
* Extends PEAR.Commenting.FunctionComment.processReturn to enforce correct alignment of the doc block.
*
* @param PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param integer $stackPtr The position of the current token in the stack passed in $tokens.
* @param integer $commentStart The position in the stack where the comment started.
*
* @return void
*
* @todo Reinstate the check that params come after the function's comment and has a blank line before them
* @todo Reinstate the check that there is a blank line after all params are declared
*/
/**
* Process the function parameter comments.
*
* Extends PEAR.Commenting.FunctionComment.processReturn to enforce correct alignment of the doc block.
*
* @param File $phpcsFile The file being scanned.
* @param integer $stackPtr The position of the current token in the stack passed in $tokens.
* @param integer $commentStart The position in the stack where the comment started.
*
* @return void
*
* @todo Reinstate the check that params come after the function's comment and has a blank line before them
* @todo Reinstate the check that there is a blank line after all params are declared
*/
protected function processParams(File $phpcsFile, $stackPtr, $commentStart)
{
$tokens = $phpcsFile->getTokens();
Expand Down
Loading

0 comments on commit 7df9688

Please sign in to comment.