Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove any levels of indentation > 1 #40

Closed
bmitch opened this issue Dec 11, 2016 · 1 comment
Closed

Remove any levels of indentation > 1 #40

bmitch opened this issue Dec 11, 2016 · 1 comment

Comments

@bmitch
Copy link
Owner

bmitch commented Dec 11, 2016

  • /**
    * Inspect the tokens in the scope of the provided $token.
    * @codingStandardsIgnoreStart
    * @param array $token Token Data.
    * @param array $tokens Tokens.
    * @return void
    */
    protected function inspectScope(array $token, array $tokens)
    {
    $start = $token['scope_opener'];
    $end = $token['scope_closer'];
    $this->relativeScopeLevel = $tokens[$start]['level'];
    for ($index=$start; $index <= $end; $index++) {
    $nestedToken = $tokens[$index];
    if ($nestedToken['type'] === "T_SWITCH") {
    return;
    }
    $this->adjustMaxIndentationFound($nestedToken);
    }
    }
    // @codingStandardsIgnoreEnd

  • /**
    * Processes the tokens that this sniff is interested in.
    * @codingStandardsIgnoreStart
    * @param PHP_CodeSniffer_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(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
    $tokens = $phpcsFile->getTokens();
    $returnTokenIndex = $stackPtr;
    $returnValueToken = '';
    $numberOfTokens = count($tokens);
    for ($index = $returnTokenIndex; $index < $numberOfTokens; $index++) {
    if ($tokens[$index]['type'] === 'T_SEMICOLON') {
    $returnValueToken = $tokens[$index - 1];
    break;
    }
    }
    // @codingStandardsIgnoreEnd
    if ($returnValueToken['type'] === 'T_NULL') {
    $error = "Return null value found.";
    $phpcsFile->addError($error, $stackPtr);
    }
    }

Once fixed can remove the @codingStandardsIgnoreStart in the method doc block.

@winkbrace
Copy link

I think we can mark this solved ;)

@bmitch bmitch closed this as completed Dec 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants