Skip to content

Commit

Permalink
Merge 9ac516f into fbacc46
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Dec 14, 2018
2 parents fbacc46 + 9ac516f commit c50849b
Show file tree
Hide file tree
Showing 103 changed files with 458 additions and 364 deletions.
4 changes: 3 additions & 1 deletion PHPCompatibility/AbstractComplexVersionSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace PHPCompatibility;

use PHP_CodeSniffer_File as File;

/**
* \PHPCompatibility\AbstractComplexVersionSniff.
*
Expand All @@ -31,7 +33,7 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
*
* @return void
*/
public function handleFeature(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo)
public function handleFeature(File $phpcsFile, $stackPtr, array $itemInfo)
{
$itemArray = $this->getItemArray($itemInfo);
$errorInfo = $this->getErrorInfo($itemArray, $itemInfo);
Expand Down
10 changes: 6 additions & 4 deletions PHPCompatibility/AbstractFunctionCallParameterSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
namespace PHPCompatibility;

use PHPCompatibility\Sniff;
use PHP_CodeSniffer_File as File;
use PHP_CodeSniffer_Tokens as Tokens;

/**
* \PHPCompatibility\AbstractFunctionCallParameterSniff.
Expand Down Expand Up @@ -83,7 +85,7 @@ public function register()
*
* @return void
*/
public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
public function process(File $phpcsFile, $stackPtr)
{
if ($this->bowOutEarly() === true) {
return;
Expand All @@ -97,7 +99,7 @@ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
return;
}

$prevNonEmpty = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
$prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);

if ($this->isMethod === true) {
if ($tokens[$prevNonEmpty]['code'] !== T_DOUBLE_COLON
Expand Down Expand Up @@ -154,7 +156,7 @@ abstract protected function bowOutEarly();
* @return int|void Integer stack pointer to skip forward or void to continue
* normal file processing.
*/
abstract public function processParameters(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $functionName, $parameters);
abstract public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters);


/**
Expand All @@ -170,7 +172,7 @@ abstract public function processParameters(\PHP_CodeSniffer_File $phpcsFile, $st
* @return int|void Integer stack pointer to skip forward or void to continue
* normal file processing.
*/
public function processNoParameters(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $functionName)
public function processNoParameters(File $phpcsFile, $stackPtr, $functionName)
{
return;
}
Expand Down
4 changes: 3 additions & 1 deletion PHPCompatibility/AbstractNewFeatureSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace PHPCompatibility;

use PHP_CodeSniffer_File as File;

/**
* \PHPCompatibility\AbstractNewFeatureSniff.
*
Expand Down Expand Up @@ -87,7 +89,7 @@ protected function getErrorMsgTemplate()
*
* @return void
*/
public function addError(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
{
$itemName = $this->getItemName($itemInfo, $errorInfo);
$error = $this->getErrorMsgTemplate();
Expand Down
4 changes: 3 additions & 1 deletion PHPCompatibility/AbstractRemovedFeatureSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace PHPCompatibility;

use PHP_CodeSniffer_File as File;

/**
* \PHPCompatibility\AbstractRemovedFeatureSniff.
*
Expand Down Expand Up @@ -109,7 +111,7 @@ protected function getAlternativeOptionTemplate()
*
* @return void
*/
public function addError(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
{
$itemName = $this->getItemName($itemInfo, $errorInfo);
$error = $this->getErrorMsgTemplate();
Expand Down
6 changes: 4 additions & 2 deletions PHPCompatibility/ComplexVersionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace PHPCompatibility;

use PHP_CodeSniffer_File as File;

/**
* \PHPCompatibility\ComplexVersionInterface.
*
Expand All @@ -35,7 +37,7 @@ interface ComplexVersionInterface
*
* @return void
*/
public function handleFeature(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo);
public function handleFeature(File $phpcsFile, $stackPtr, array $itemInfo);


/**
Expand Down Expand Up @@ -71,5 +73,5 @@ public function getErrorInfo(array $itemArray, array $itemInfo);
*
* @return void
*/
public function addError(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo);
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo);
}
15 changes: 8 additions & 7 deletions PHPCompatibility/PHPCSHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace PHPCompatibility;

use PHP_CodeSniffer_Exception as PHPCS_Exception;
use PHP_CodeSniffer_File as File;
use PHP_CodeSniffer_Tokens as Tokens;

Expand Down Expand Up @@ -101,7 +102,7 @@ public static function getConfigData($key)
*
* @return string|null
*/
public static function getCommandLineData($phpcsFile, $key)
public static function getCommandLineData(File $phpcsFile, $key)
{
if (class_exists('\PHP_CodeSniffer\Config')) {
// PHPCS 3.x.
Expand Down Expand Up @@ -218,7 +219,7 @@ public static function findStartOfStatement(File $phpcsFile, $start, $ignore = n
*
* @return int
*/
public static function findEndOfStatement(\PHP_CodeSniffer_File $phpcsFile, $start, $ignore = null)
public static function findEndOfStatement(File $phpcsFile, $start, $ignore = null)
{
if (version_compare(self::getVersion(), '3.3.0', '>=') === true) {
return $phpcsFile->findEndOfStatement($start, $ignore);
Expand Down Expand Up @@ -285,7 +286,7 @@ public static function findEndOfStatement(\PHP_CodeSniffer_File $phpcsFile, $sta
$i = $tokens[$i]['parenthesis_closer'];
}

if (isset(\PHP_CodeSniffer_Tokens::$emptyTokens[$tokens[$i]['code']]) === false) {
if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === false) {
$lastNotEmpty = $i;
}
}//end for
Expand Down Expand Up @@ -316,7 +317,7 @@ public static function findEndOfStatement(\PHP_CodeSniffer_File $phpcsFile, $sta
*
* @return string|false
*/
public static function findExtendedClassName(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
public static function findExtendedClassName(File $phpcsFile, $stackPtr)
{
if (version_compare(self::getVersion(), '3.1.0', '>=') === true) {
return $phpcsFile->findExtendedClassName($stackPtr);
Expand Down Expand Up @@ -381,7 +382,7 @@ public static function findExtendedClassName(\PHP_CodeSniffer_File $phpcsFile, $
*
* @return array|false
*/
public static function findImplementedInterfaceNames(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
public static function findImplementedInterfaceNames(File $phpcsFile, $stackPtr)
{
if (version_compare(self::getVersion(), '2.7.1', '>') === true) {
return $phpcsFile->findImplementedInterfaceNames($stackPtr);
Expand Down Expand Up @@ -467,7 +468,7 @@ public static function findImplementedInterfaceNames(\PHP_CodeSniffer_File $phpc
* @throws \PHP_CodeSniffer_Exception If the specified $stackPtr is not of
* type T_FUNCTION or T_CLOSURE.
*/
public static function getMethodParameters(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
public static function getMethodParameters(File $phpcsFile, $stackPtr)
{
if (version_compare(self::getVersion(), '3.3.0', '>=') === true) {
return $phpcsFile->getMethodParameters($stackPtr);
Expand All @@ -483,7 +484,7 @@ public static function getMethodParameters(\PHP_CodeSniffer_File $phpcsFile, $st
if ($tokens[$stackPtr]['code'] !== T_FUNCTION
&& $tokens[$stackPtr]['code'] !== T_CLOSURE
) {
throw new \PHP_CodeSniffer_Exception('$stackPtr must be of type T_FUNCTION or T_CLOSURE');
throw new PHPCS_Exception('$stackPtr must be of type T_FUNCTION or T_CLOSURE');
}

$opener = $tokens[$stackPtr]['parenthesis_opener'];
Expand Down
Loading

0 comments on commit c50849b

Please sign in to comment.