isUnarySuccessorOperator() public method

Checks if there is an unary successor operator under given index.
public isUnarySuccessorOperator ( integer $index ) : boolean
$index integer
return boolean
 /**
  * {@inheritdoc}
  */
 public function fix(\SplFileInfo $file, Tokens $tokens)
 {
     $tokensAnalyzer = new TokensAnalyzer($tokens);
     for ($index = $tokens->count() - 1; $index >= 0; --$index) {
         if ($tokensAnalyzer->isUnarySuccessorOperator($index)) {
             $tokens->removeLeadingWhitespace($index);
             continue;
         }
         if ($tokensAnalyzer->isUnaryPredecessorOperator($index)) {
             $tokens->removeTrailingWhitespace($index);
             continue;
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function fix(\SplFileInfo $file, Tokens $tokens)
 {
     $tokensAnalyzer = new TokensAnalyzer($tokens);
     for ($index = $tokens->count() - 1; 0 <= $index; --$index) {
         $token = $tokens[$index];
         if (!$token->isGivenKind(array(T_INC, T_DEC)) || !$tokensAnalyzer->isUnarySuccessorOperator($index)) {
             continue;
         }
         $nextToken = $tokens[$tokens->getNextMeaningfulToken($index)];
         if (!$nextToken->equalsAny(array(';', ')'))) {
             continue;
         }
         $startIndex = $this->findStart($tokens, $index);
         $prevToken = $tokens[$tokens->getPrevMeaningfulToken($startIndex)];
         if ($prevToken->equalsAny(array(';', '{', '}', array(T_OPEN_TAG)))) {
             $tokens->insertAt($startIndex, clone $token);
             $token->clear();
         }
     }
 }
 /**
  * @dataProvider provideIsBinaryOperator70
  * @requires PHP 7.0
  */
 public function testIsBinaryOperator70($source, array $expected)
 {
     $tokensAnalyzer = new TokensAnalyzer(Tokens::fromCode($source));
     foreach ($expected as $index => $isBinary) {
         $this->assertSame($isBinary, $tokensAnalyzer->isBinaryOperator($index));
         if ($isBinary) {
             $this->assertFalse($tokensAnalyzer->isUnarySuccessorOperator($index));
             $this->assertFalse($tokensAnalyzer->isUnaryPredecessorOperator($index));
         }
     }
 }