- Removed phpci.yml file

- Removed tests/codeception/ directory
- Changed tests/codesniffer/FHComplete/ruleset.xml
- Removed tests/codesniffer/FHComplete/Sniffs
- Removed tests/codesniffer/FHComplete/tests
- Added tests/phpmd/rulesets.xml
This commit is contained in:
Paolo
2022-02-10 11:42:39 +01:00
parent 6d806a52d9
commit d9aa24cced
309 changed files with 19 additions and 11313 deletions
@@ -1,58 +0,0 @@
<?php
/**
* Verifies that control statements conform to their coding standards.
*
* PHP version 5
*/
if (class_exists('PHP_CodeSniffer_Standards_AbstractPatternSniff', true) === false) {
throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_Standards_AbstractPatternSniff not found');
}
/**
* Verifies that control statements conform to their coding standards.
*
* @category PHP
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
* @version Release: @package_version@
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class FHComplete_Sniffs_ControlStructures_ControlSignatureSniff extends PHP_CodeSniffer_Standards_AbstractPatternSniff
{
/**
* If true, comments will be ignored if they are found in the code.
*
* @var boolean
*/
public $ignoreComments = true;
/**
* Returns the patterns that this test wishes to verify.
*
* @return string[]
*/
protected function getPatterns()
{
return array(
'tryEOL...{EOL...}EOL...catch (...)EOL...{EOL...}EOL',
'doEOL...{EOL...EOL...}EOL...while (...);EOL',
'while (...)EOL...{EOL',
'for (...)EOL...{EOL',
'if (...)EOL...{EOL',
'foreach (...)EOL...{EOL',
'}EOL...\s+else if (...)EOL...{EOL',
'}EOL...\s+elseif (...)EOL...{EOL',
'}EOL...\s+else+EOL...{EOL',
'doEOL...{EOL',
);
}//end getPatterns()
}//end class
@@ -1,48 +0,0 @@
<?php
/**
* PHP Version 5
*
* FHComplete
*/
/**
* Ensures that elseif is used instead of else if
*
*/
class FHComplete_Sniffs_ControlStructures_ElseIfDeclarationSniff implements PHP_CodeSniffer_Sniff
{
/**
* Returns an array of tokens this test wants to listen for.
*
* @return array
*/
public function register()
{
return array(T_ELSE);
}
/**
* Processes this test, when one of its tokens is encountered.
*
* Checks that ELSEIF is used instead of ELSE IF.
*
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
* @param integer $stackPtr The position of the current token in the
* stack passed in $tokens.
* @return void
*/
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
$nextToken = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
if ($tokens[$nextToken]['code'] !== T_IF) {
return;
}
$error = 'Usage of ELSE IF not allowed; use ELSEIF instead';
$phpcsFile->addError($error, $stackPtr, 'NotAllowed');
}
}
@@ -1,56 +0,0 @@
<?php
/**
* PHP Version 5
*
* FHComplete
*/
/**
* Ensures that while and do-while use curly brackets
*
*/
class FHComplete_Sniffs_ControlStructures_WhileStructuresSniff implements PHP_CodeSniffer_Sniff
{
/**
* Returns an array of tokens this test wants to listen for.
*
* @return array
*/
public function register()
{
return array(T_DO, T_WHILE);
}
/**
* Processes this test, when one of its tokens is encountered.
*
* Checks that while and do-while use curly brackets
*
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
* @param integer $stackPtr The position of the current token in the
* stack passed in $tokens.
* @return void
*/
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
$nextToken = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
if ($tokens[$nextToken]['code'] === T_OPEN_PARENTHESIS) {
$closer = $tokens[$nextToken]['parenthesis_closer'];
$diff = $closer - $stackPtr;
$nextToken = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + $diff + 1), null, true);
}
if ($tokens[$stackPtr]['code'] === T_WHILE && $tokens[$nextToken]['code'] === T_SEMICOLON) {
/* This while is probably part of a do-while construction, skip it .. */
return;
}
if ($tokens[$nextToken]['code'] !== T_OPEN_CURLY_BRACKET && $tokens[$nextToken]['code'] !== T_COLON) {
$error = 'Curly brackets required in a do-while or while loop';
$phpcsFile->addError($error, $stackPtr, 'NotAllowed');
}
}
}