本文整理汇总了PHP中PHP_CodeSniffer_File::getMethodProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeSniffer_File::getMethodProperties方法的具体用法?PHP PHP_CodeSniffer_File::getMethodProperties怎么用?PHP PHP_CodeSniffer_File::getMethodProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP_CodeSniffer_File
的用法示例。
在下文中一共展示了PHP_CodeSniffer_File::getMethodProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processTokenWithinScope
/**
* Processes the tokens within the scope.
*
* @param PHP_CodeSniffer_File $phpcsFile The file being processed.
* @param int $stackPtr The position where this token was
* found.
* @param int $currScope The position of the current scope.
*
* @return void
*/
protected function processTokenWithinScope(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $currScope)
{
$methodName = $phpcsFile->getDeclarationName($stackPtr);
if ($methodName === null) {
// Ignore closures.
return;
}
$className = $phpcsFile->getDeclarationName($currScope);
$errorData = array($className . '::' . $methodName);
// Is this a magic method. IE. is prefixed with "__".
if (preg_match('|^__|', $methodName) !== 0) {
$magicPart = substr($methodName, 2);
if (in_array($magicPart, $this->magicMethods) === false) {
$error = 'Method name "%s" is invalid; only PHP magic methods should be prefixed with a double underscore';
$phpcsFile->addError($error, $stackPtr, 'MethodDoubleUnderscore', $errorData);
}
return;
}
$methodProps = $phpcsFile->getMethodProperties($stackPtr);
$scope = $methodProps['scope'];
$scopeSpecified = $methodProps['scope_specified'];
// Methods should not contain underscores.
if (strpos($methodName, '_') !== false) {
if ($scopeSpecified === true) {
$error = '%s method name "%s" is not in lowerCamel format, it must not contain underscores';
$data = array(ucfirst($scope), $errorData[0]);
$phpcsFile->addError($error, $stackPtr, 'ScopeNotLowerCamel', $data);
} else {
$error = 'Method name "%s" is not in lowerCamel format, it must not contain underscores';
$phpcsFile->addError($error, $stackPtr, 'NotLowerCamel', $errorData);
}
}
}
示例2: processTokenWithinScope
/**
* Processes this test, when one of its tokens is encountered.
*
* @param PHP_CodeSniffer_File $phpcsFile The current file being scanned.
* @param integer $stackPtr The position of the current token in the
* stack passed in $tokens.
* @param integer $currScope A pointer to the start of the scope.
*
* @return void
*/
public function processTokenWithinScope(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $currScope)
{
$tokens = $phpcsFile->getTokens();
$function = $tokens[$stackPtr + 2];
if ($function['code'] !== T_STRING) {
return;
}
$functionName = $function['content'];
$classOpener = $tokens[$currScope]['scope_condition'];
$className = $tokens[$classOpener + 2]['content'];
$methodProps = $phpcsFile->getMethodProperties($stackPtr);
if ($methodProps['is_static'] === true) {
if (isset($tokens[$stackPtr]['scope_closer']) === false) {
// There is no scope opener or closer, so the function
// must be abstract.
return;
}
$thisUsage = $stackPtr;
while (($thisUsage = $phpcsFile->findNext(array(T_VARIABLE), $thisUsage + 1, $tokens[$stackPtr]['scope_closer'], false, '$this')) !== false) {
if ($thisUsage === false) {
return;
}
$error = 'Usage of "$this" in static methods will cause runtime errors';
$phpcsFile->addError($error, $thisUsage, 'Found');
}
//while
}
}
示例3: processTokenWithinScope
/**
* Processes the tokens within the scope.
*
* @param PHP_CodeSniffer_File $phpcsfile The file being processed.
* @param int $stackptr The position where this token was
* found.
* @param int $currscope The position of the current scope.
*
* @return void
*/
protected function processTokenWithinScope(PHP_CodeSniffer_File $phpcsfile, $stackptr, $currscope)
{
$classname = $phpcsfile->getDeclarationName($currscope);
$methodname = $phpcsfile->getDeclarationName($stackptr);
// Is this a magic method. IE. is prefixed with "__".
if (preg_match('|^__|', $methodname) !== 0) {
$magicpart = substr($methodname, 2);
if (!in_array($magicpart, $this->magicmethods)) {
$error = "method name \"{$classname}::{$methodname}\" is invalid; " . 'only PHP magic methods should be prefixed with a double underscore';
$phpcsfile->addError($error, $stackptr);
}
return;
}
$methodprops = $phpcsfile->getMethodProperties($stackptr);
$scope = $methodprops['scope'];
$scopespecified = $methodprops['scope_specified'];
// Only lower-case accepted
if (preg_match('/[A-Z]+/', $methodname) && !in_array($methodname, $this->permittedmethods)) {
if ($scopespecified === true) {
$error = ucfirst($scope) . ' method name "' . $classname . '::' . $methodname . '" must be in lower-case letters only';
} else {
$error = 'method name "' . $classname . '::' . $methodname . '" must be in lower-case letters only';
}
$phpcsfile->adderror($error, $stackptr);
return;
}
}
示例4: process
/**
* Processes the tokens that this sniff is interested in.
*
* @param PHP_CodeSniffer_File $phpcsFile The file where the token was found.
* @param int $stackPtr The position in the stack where
* the token was found.
*
* @return void
* @see PHP_CodeSniffer_Sniff::process()
*/
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
$token = $tokens[$stackPtr]['content'];
// Only accept class member functions
if (false === $phpcsFile->hasCondition($stackPtr, T_CLASS)) {
return;
}
$nextTokenIndex = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true);
$methodName = $tokens[$nextTokenIndex]['content'];
$methodProperties = $phpcsFile->getMethodProperties($stackPtr);
switch ($methodName) {
case '__call':
$this->_checkCall($phpcsFile, $stackPtr, $methodName, $methodProperties);
break;
case '__get':
$this->_checkGet($phpcsFile, $stackPtr, $methodName, $methodProperties);
break;
case '__isset':
$this->_checkIsset($phpcsFile, $stackPtr, $methodName, $methodProperties);
break;
case '__set':
$this->_checkSet($phpcsFile, $stackPtr, $methodName, $methodProperties);
break;
case '__toString':
$this->_checkToString($phpcsFile, $stackPtr, $methodName, $methodProperties);
break;
case '__unset':
$this->_checkUnset($phpcsFile, $stackPtr, $methodName, $methodProperties);
break;
default:
break;
}
}
示例5: processTokenWithinScope
protected function processTokenWithinScope(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $currScope)
{
$className = $phpcsFile->getDeclarationName($currScope);
$methodName = $phpcsFile->getDeclarationName($stackPtr);
// Only magic methods should be prefixed with "__"
if (preg_match('|^__|', $methodName) !== 0) {
$magicPart = substr($methodName, 2);
if (in_array($magicPart, $this->magicMethods) === false) {
$error = sprintf("Method name \"%s::%s\" is invalid; only PHP magic methods should be prefixed with a double underscore", $className, $methodName);
$phpcsFile->addError($error, $stackPtr);
}
return;
}
// There should be given a valid scope
$methodProperties = $phpcsFile->getMethodProperties($stackPtr);
if ($methodProperties['scope_specified'] !== true) {
$error = sprintf("No scope declaration for method \"%s::%s\" found", $className, $methodName);
$phpcsFile->addWarning($error, $stackPtr);
return;
}
// Method names should be camel-cased and not underscored
if (PHP_CodeSniffer::isCamelCaps($methodName, false, true, false) === false) {
$error = sprintf("Method name \"%s::%s\" is not in camel caps format", $className, $methodName);
$phpcsFile->addError($error, $stackPtr);
return;
}
}
示例6: processTokenWithinScope
/**
* Processes the tokens within the scope.
*
* @param PHP_CodeSniffer_File $phpcsFile The file being processed.
* @param int $stackPtr The position where this token was
* found.
* @param int $currScope The position of the current scope.
*
* @return void
*/
protected function processTokenWithinScope(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $currScope)
{
$methodName = $phpcsFile->getDeclarationName($stackPtr);
if ($methodName === null) {
// Ignore closures.
return;
}
$className = $phpcsFile->getDeclarationName($currScope);
$errorData = array($className . '::' . $methodName);
// Is this a magic method. i.e., is prefixed with "__" ?
if (preg_match('|^__|', $methodName) !== 0) {
$magicPart = strtolower(substr($methodName, 2));
if (isset($this->magicMethods[$magicPart]) === false && isset($this->methodsDoubleUnderscore[$magicPart]) === false) {
$error = 'Method name "%s" is invalid; only PHP magic methods should be prefixed with a double underscore';
$phpcsFile->addError($error, $stackPtr, 'MethodDoubleUnderscore', $errorData);
}
return;
}
$methodProps = $phpcsFile->getMethodProperties($stackPtr);
if (PHP_CodeSniffer::isCamelCaps($methodName, false, true, $this->strict) === false) {
if ($methodProps['scope_specified'] === true) {
$error = '%s method name "%s" is not in lowerCamel format';
$data = array(ucfirst($methodProps['scope']), $errorData[0]);
$phpcsFile->addError($error, $stackPtr, 'ScopeNotCamelCaps', $data);
} else {
$error = 'Method name "%s" is not in lowerCamel format';
$phpcsFile->addError($error, $stackPtr, 'NotCamelCaps', $errorData);
}
$phpcsFile->recordMetric($stackPtr, 'CamelCase method name', 'no');
return;
} else {
$phpcsFile->recordMetric($stackPtr, 'CamelCase method name', 'yes');
}
}
示例7: processTokenWithinScope
/**
* Processes the tokens within the scope.
*
* @param PHP_CodeSniffer_File $phpcsFile The file being processed.
* @param int $stackPtr The position where this token was
* found.
* @param int $currScope The position of the current scope.
*
* @return void
*/
protected function processTokenWithinScope(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $currScope)
{
$className = $phpcsFile->getDeclarationName($currScope);
$methodName = $phpcsFile->getDeclarationName($stackPtr);
// Is this a magic method. IE. is prefixed with "__".
if (preg_match('|^__|', $methodName) !== 0) {
$magicPart = substr($methodName, 2);
if (in_array($magicPart, $this->_magicMethods) === false) {
$error = "Method name \"{$className}::{$methodName}\" is invalid; only PHP magic methods should be prefixed with a double underscore";
$phpcsFile->addError($error, $stackPtr);
}
return;
}
// PHP4 constructors are allowed to break our rules.
if ($methodName === $className) {
return;
}
// PHP4 destructors are allowed to break our rules.
if ($methodName === '_' . $className) {
return;
}
$methodProps = $phpcsFile->getMethodProperties($stackPtr);
$isPublic = $methodProps['scope'] === 'public' ? true : false;
$scope = $methodProps['scope'];
$scopeSpecified = $methodProps['scope_specified'];
// If it's a private method, it must have an underscore on the front.
if ($isPublic === false && $methodName[0] !== '_') {
$error = ucfirst($scope) . " method name \"{$className}::{$methodName}\" must be prefixed with an underscore";
$phpcsFile->addError($error, $stackPtr);
return;
}
// If it's not a private method, it must not have an underscore on the front.
if ($isPublic === true && $scopeSpecified === true && $methodName[0] === '_') {
$error = "Public method name \"{$className}::{$methodName}\" must not be prefixed with an underscore";
$phpcsFile->addError($error, $stackPtr);
return;
}
// If the scope was specified on the method, then the method must be
// camel caps and an underscore should be checked for. If it wasn't
// specified, treat it like a public method and remove the underscore
// prefix if there is one because we cant determine if it is private or
// public.
$testMethodName = $methodName;
if ($scopeSpecified === false && $methodName[0] === '_') {
$testMethodName = substr($methodName, 1);
}
if (PHP_CodeSniffer::isCamelCaps($testMethodName, false, $isPublic, false) === false) {
if ($scopeSpecified === true) {
$error = ucfirst($scope) . " method name \"{$className}::{$methodName}\" is not in camel caps format";
} else {
$error = "Method name \"{$className}::{$methodName}\" is not in camel caps format";
}
$phpcsFile->addError($error, $stackPtr);
return;
}
}
示例8: process
/**
* Processes this test, when one of its tokens is encountered.
*
* @param PHP_CodeSniffer_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)
{
$tokens = $phpcsFile->getTokens();
if ($tokens[$stackPtr]['code'] === T_FUNCTION) {
$methodProps = $phpcsFile->getMethodProperties($stackPtr);
// Abstract methods do not require a closing comment.
if ($methodProps['is_abstract'] === true) {
return;
}
// Closures do not require a closing comment.
if ($methodProps['is_closure'] === true) {
return;
}
// If this function is in an interface then we don't require
// a closing comment.
if ($phpcsFile->hasCondition($stackPtr, T_INTERFACE) === true) {
return;
}
if (isset($tokens[$stackPtr]['scope_closer']) === false) {
$error = 'Possible parse error: non-abstract method defined as abstract';
$phpcsFile->addWarning($error, $stackPtr);
return;
}
$decName = $phpcsFile->getDeclarationName($stackPtr);
$comment = '//end ' . $decName . '()';
} else {
if ($tokens[$stackPtr]['code'] === T_CLASS) {
$comment = '//end class';
} else {
$comment = '//end interface';
}
}
//end if
if (isset($tokens[$stackPtr]['scope_closer']) === false) {
$error = 'Possible parse error: ';
$error .= $tokens[$stackPtr]['content'];
$error .= ' missing opening or closing brace';
$phpcsFile->addWarning($error, $stackPtr);
return;
}
$closingBracket = $tokens[$stackPtr]['scope_closer'];
if ($closingBracket === null) {
// Possible inline structure. Other tests will handle it.
return;
}
$error = 'Expected ' . $comment;
if (isset($tokens[$closingBracket + 1]) === false || $tokens[$closingBracket + 1]['code'] !== T_COMMENT) {
$phpcsFile->addError($error, $closingBracket);
return;
}
if (rtrim($tokens[$closingBracket + 1]['content']) !== $comment) {
$phpcsFile->addError($error, $closingBracket);
return;
}
}
示例9: processTokenWithinScope
/**
* Processes the tokens within the scope.
*
* @param PHP_CodeSniffer_File $phpcsFile The file being processed.
* @param integer $stackPtr The position where this token was found.
* @param integer $currScope The position of the current scope.
* @return void
*/
protected function processTokenWithinScope(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $currScope)
{
$methodName = $phpcsFile->getDeclarationName($stackPtr);
if ($methodName === null) {
// Ignore closures.
return;
}
$className = $phpcsFile->getDeclarationName($currScope);
$errorData = array($className . '::' . $methodName);
// PHP4 constructors are allowed to break our rules.
if ($methodName === $className) {
return;
}
// PHP4 destructors are allowed to break our rules.
if ($methodName === '_' . $className) {
return;
}
// Ignore magic methods
if (preg_match('/^__(' . implode('|', $this->_magicMethods) . ')$/', $methodName)) {
return;
}
$methodProps = $phpcsFile->getMethodProperties($stackPtr);
if ($methodProps['scope_specified'] === false) {
// Let another sniffer take care of that
return;
}
$isPublic = $methodProps['scope'] === 'public';
$isProtected = $methodProps['scope'] === 'protected';
$isPrivate = $methodProps['scope'] === 'private';
$scope = $methodProps['scope'];
if ($isPublic === true) {
if ($methodName[0] === '_') {
$error = 'Public method name "%s" must not be prefixed with underscore';
$phpcsFile->addError($error, $stackPtr, 'PublicWithUnderscore', $errorData);
return;
}
// Underscored public methods in controller are allowed to break our rules.
if (substr($className, -10) === 'Controller') {
return;
}
// Underscored public methods in shells are allowed to break our rules.
if (substr($className, -5) === 'Shell') {
return;
}
// Underscored public methods in tasks are allowed to break our rules.
if (substr($className, -4) === 'Task') {
return;
}
} elseif ($isPrivate === true) {
$filename = $phpcsFile->getFilename();
$warning = 'Private method name "%s" in CakePHP core is discouraged';
$phpcsFile->addWarning($warning, $stackPtr, 'PrivateMethodInCore', $errorData);
}
}
示例10: process
/**
* Processes the tokens that this sniff is interested in.
*
* @param PHP_CodeSniffer_File $phpcsFile The file where the token was found.
* @param int $stackPtr The position in the stack where
* the token was found.
*
* @return void
*/
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$methodName = $phpcsFile->getDeclarationName($stackPtr);
$methodProps = $phpcsFile->getMethodProperties($stackPtr);
if ($methodProps['is_static']) {
if (!PHP_CodeSniffer_Standards_Silverstripe_SilverstripeCodingStandard::isLowerCaseWithUnderScore($methodName)) {
$error = "Function name \"{$methodName}\" is invalid Static methods should be in lowercase_with_underscores() format.";
$phpcsFile->addError($error, $stackPtr);
}
} else {
}
}
示例11: isTestClassMethod
/**
* Check if a method is a PHPUnit test class method.
* @param int $stackPtr
* @return bool
*/
public function isTestClassMethod($stackPtr)
{
if (!array_key_exists($stackPtr, $this->testClassMethods)) {
$this->testClassMethods[$stackPtr] = false;
if ($this->isTestClass($stackPtr)) {
$props = $this->phpcsFile->getMethodProperties($stackPtr);
if ('public' == $props['scope'] && !$props['is_abstract'] && !$props['is_closure'] && stripos($this->phpcsFile->getDeclarationName($stackPtr), 'test') === 0) {
$this->testClassMethods[$stackPtr] = true;
}
}
}
return $this->testClassMethods[$stackPtr];
}
示例12: process
/**
* {@inheritdoc}
*/
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
if (false === ($commentEnd = $phpcsFile->findPrevious(array(T_COMMENT, T_DOC_COMMENT, T_CLASS, T_FUNCTION, T_OPEN_TAG), $stackPtr - 1))) {
return;
}
$tokens = $phpcsFile->getTokens();
$code = $tokens[$commentEnd]['code'];
$method = $phpcsFile->getMethodProperties($stackPtr);
$commentRequired = $this->isRequiredScope($method['scope']);
if ($code === T_COMMENT && !$commentRequired || $code !== T_DOC_COMMENT && !$commentRequired) {
return;
}
parent::process($phpcsFile, $stackPtr);
}
示例13: processTokenWithinScope
/**
* Override parent function to allow custom code validation
*
* @param PHP_CodeSniffer_File $phpcsFile The file being processed.
* @param int $stackPtr The position where this token was
* found.
* @param int $currScope The position of the current scope.
*
* @return void
*/
protected function processTokenWithinScope(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $currScope)
{
$methodName = $phpcsFile->getDeclarationName($stackPtr);
if ($methodName === null) {
// Ignore closures.
return;
}
$className = $phpcsFile->getDeclarationName($currScope);
// Is this a magic method. IE. is prefixed with "__".
if (preg_match('|^__|', $methodName) !== 0) {
$magicPart = substr($methodName, 2);
if (in_array($magicPart, $this->magicMethods) === false) {
$error = "Method name \"{$className}::{$methodName}\" is invalid; only PHP magic methods should be prefixed with a double underscore";
$phpcsFile->addError($error, $stackPtr);
}
return;
}
// PHP4 constructors are allowed to break our rules.
if ($methodName === $className) {
return;
}
// PHP4 destructors are allowed to break our rules.
if ($methodName === '_' . $className) {
return;
}
$methodProps = $phpcsFile->getMethodProperties($stackPtr);
$isPublic = $methodProps['scope'] === 'private' ? false : true;
$scope = $methodProps['scope'];
$scopeSpecified = $methodProps['scope_specified'];
// If it's a private method, it must have an underscore on the front.
if ($isPublic === false && $methodName[0] !== '_') {
$error = "Private method name \"{$className}::{$methodName}\" must be prefixed with an underscore";
$phpcsFile->addError($error, $stackPtr);
return;
}
// We want to allow private and protected methods to start with an underscore
$testMethodName = $methodName;
if (($scopeSpecified === false || $scope == 'protected') && $methodName[0] === '_') {
$testMethodName = substr($methodName, 1);
}
if (PHP_CodeSniffer::isCamelCaps($testMethodName, false, $isPublic, false) === false) {
if ($scopeSpecified === true) {
$error = ucfirst($scope) . " method name \"{$className}::{$methodName}\" is not in camel caps format";
} else {
$error = "Method name \"{$className}::{$methodName}\" is not in camel caps format";
}
$phpcsFile->addError($error, $stackPtr);
return;
}
}
示例14: processTokenWithinScope
/**
* Processes the tokens within the scope.
*
* @param PHP_CodeSniffer_File $phpcsFile The file being processed.
* @param int $stackPtr The position where this token was
* found.
* @param int $currScope The position of the current scope.
*
* @return void
*/
protected function processTokenWithinScope(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $currScope)
{
$methodName = $phpcsFile->getDeclarationName($stackPtr);
if ($methodName === null) {
// Ignore closures.
return;
}
$className = $phpcsFile->getDeclarationName($currScope);
$errorData = array($className . '::' . $methodName);
// Is this a magic method. IE. is prefixed with "__".
if (preg_match('|^__|', $methodName) !== 0) {
$magicPart = strtolower(substr($methodName, 2));
if (in_array($magicPart, $this->magicMethods) === false) {
$error = 'Method name "%s" is invalid; only PHP magic methods should be prefixed with a double underscore';
$phpcsFile->addError($error, $stackPtr, 'MethodDoubleUnderscore', $errorData);
}
return;
}
$methodProps = $phpcsFile->getMethodProperties($stackPtr);
$scope = $methodProps['scope'];
$scopeSpecified = $methodProps['scope_specified'];
// If it's not a private method, it must not have an underscore on the front.
if ($scopeSpecified === true && $methodName[0] === '_') {
$error = '%s method name "%s" must not be prefixed with an underscore';
$data = array(ucfirst($scope), $errorData[0]);
$phpcsFile->addError($error, $stackPtr, 'MethodUnderscore', $data);
return;
}
// If the scope was specified on the method, then the method must be
// camel caps and an underscore should be checked for. If it wasn't
// specified, treat it like a public method and remove the underscore
// prefix if there is one because we cant determine if it is private or
// public.
$testMethodName = $methodName;
if ($scopeSpecified === false && $methodName[0] === '_') {
$testMethodName = substr($methodName, 1);
}
if (PHP_CodeSniffer::isCamelCaps($testMethodName, false, true, false) === false) {
if ($scopeSpecified === true) {
$error = '%s method name "%s" is not in camel caps format';
$data = array(ucfirst($scope), $errorData[0]);
$phpcsFile->addError($error, $stackPtr, 'ScopeNotCamelCaps', $data);
} else {
$error = 'Method name "%s" is not in camel caps format';
$phpcsFile->addError($error, $stackPtr, 'NotCamelCaps', $errorData);
}
return;
}
}
示例15: process
/**
* Processes this test, when one of its tokens is encountered.
*
* @param PHP_CodeSniffer_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)
{
if (false === ($commentEnd = $phpcsFile->findPrevious(array(T_COMMENT, T_DOC_COMMENT, T_CLASS, T_FUNCTION, T_OPEN_TAG), $stackPtr - 1))) {
return;
}
$tokens = $phpcsFile->getTokens();
$code = $tokens[$commentEnd]['code'];
// a comment is not required on protected/private methods
$method = $phpcsFile->getMethodProperties($stackPtr);
$commentRequired = in_array($method['scope'], array('public', 'protected', 'private'));
if ($code === T_COMMENT && !$commentRequired || $code !== T_DOC_COMMENT && !$commentRequired) {
return;
}
parent::process($phpcsFile, $stackPtr);
}