Check for the absence of a white space after the text.

@param TokenInfo $token
the token
352267
private function _checkNoWhiteSpaceAfter($token) {
		if ($this->_isActive('noSpaceAfterToken')) {

			$text = $token->text;

			if (!$this->_config->isException('noSpaceAfterToken', $text)) {

				// The next token is a whitespace
				if ($this->tokenizer->checkNextToken(T_WHITESPACE)) {

					// And the next valid token is on the same line
					$tokenAfter = $this->tokenizer->peekNextValidToken();
					if ($tokenAfter->line === $token->line) {
						$msg = $this->_getMessage('NO_SPACE_AFTER_TOKEN', $text);
						$this->_writeError('noSpaceAfterToken', $msg);
					}
				}
			}
		}
	}
951248
protected function getLastWhitespaceOfPreviousLine(array $tokens, $index) {
		$currentLine = $tokens[$index]['line'];
		$index--;
		while ($tokens[$index]['line'] === $currentLine) {
			$index--;
		}

		return $index;
	}
135237
protected function skipTo($token)
	{
		while (++$this->i < $this->cnt)
		{
			if ($this->tokens[$this->i] === $token)
			{
				return true;
			}
		}

		return false;
	}
671820
private function _processControlStatement($token) {
		$csText = strtolower($token->text);

		$this->_inControlStatement = true;
		$this->_currentStatement = $csText;

		// first token: if not one whitespace, error
		if ($this->_isActive('spaceAfterControlStmt')) {
			if (!$this->tokenizer->checkNextToken(T_WHITESPACE)) {
				if (($token->id !== T_ELSE) && ($token->id !== T_TRY) && ($token->id !== T_DO)) {
					$msg = $this->_getMessage('SPACE_AFTER_TOKEN', $csText);
					$this->_writeError('spaceAfterControlStmt', $msg);
				}
			}
		}

		// for some control structures like "else" and "do",
		// there is no statements they will be followed directly by "{"
		if (($token->id === T_ELSE) || ($token->id === T_DO) || ($token->id === T_TRY)) {
			if ($this->tokenizer->checkNextValidToken(T_BRACES_OPEN)) {
				$this->_inControlStatement = false;
				$this->_justAfterControlStmt = true;
			}
		}

		// "else if" is different
		if ($token->id === T_ELSE) {
			if ($this->tokenizer->checkNextValidToken(T_IF)) {
				// control statement for "else" is done
				// new control statement "if" will start
				$this->_inControlStatement = false;
			}

			// ELSE just after a IF with no curly : we close the IF statement
			if ($this->statementStack->getCurrentStackItem()->type === StatementItem::TYPE_IF && $this->statementStack->getCurrentStackItem()->noCurly === true) {
				$this->statementStack->pop();
			}
		}

		if ($token->id === T_IF) {
			// IF just after a ELSE with no curly : we close the ELSE statement
			if ($this->statementStack->getCurrentStackItem()->type === StatementItem::TYPE_ELSE && $this->statementStack->getCurrentStackItem()->noCurly === true) {
				$this->statementStack->pop();
			}
		}

		// "else" and "elseif" should start in the same line as "}"
		if ($token->id === T_ELSE || $token->id === T_ELSEIF) {
			$position = $this->_config->getTestProperty('controlStructElse', 'position');
			$previousToken = $this->tokenizer->peekPrvsValidToken();
			if ($previousToken->id === T_BRACES_CLOSE) {
				if (($position === SAME_LINE) && ($previousToken->line !== $token->line)) {
					$msg = $this->_getMessage('CS_STMT_ALIGNED_WITH_CURLY', $csText);
					$this->_writeError('controlStructElse', $msg);
				}
				if (($position === NEW_LINE) && ($previousToken->line === $token->line)) {
					$msg = $this->_getMessage('CS_STMT_ON_NEW_LINE', $csText);
					$this->_writeError('controlStructElse', $msg);
				}
			}
		}

		// The checkNeedBraces rule is usually launched after a closing parenthesis
		// In the case of the "else", we need to launch it now
		if ($token->id === T_ELSE) {
			$this->_checkNeedBraces();
		}

		// By default we consider that the statement block will start after the next '{'
		// In case there is no curly opening we need to consider the next line as being the statement
		if ($this->tokenizer->checkNextValidToken(T_PARENTHESIS_OPEN)) {
			// in case the statement type is IF, FOR, FOREACH, CATCH, WHILE we skip the conditional
			$startPos = $this->tokenizer->findClosingParenthesisPosition($token->position);
		} else {
			$startPos = $token->position;
		}

		// Now we expect the '{' token
		if (!$this->tokenizer->checkNextValidToken(T_BRACES_OPEN, null, $startPos + 1)) {

			// If not the case, we store the control statement in the stack
			$stackitem = new StatementItem();
			$stackitem->line = $token->line;
			$stackitem->type = strtoupper($csText);
			$stackitem->name = $csText;
			$stackitem->noCurly = true;
			$this->statementStack->push($stackitem);
		}

		// To avoid a false positive when treating the while statement of a do/while
		// We keep track that we have met a do statement
		if ($token->id === T_DO) {
			// Note : The current stack item is not yet the control statement itself, it's the parent
			$this->statementStack->getCurrentStackItem()->afterDoStatement = true;
		}
	}
84390
private function _checkWhiteSpaceBefore($text) {
		if ($this->_isActive('checkWhiteSpaceBefore')) {

			if (!$this->_config->isException('checkWhiteSpaceBefore', $text)) {

				if (!$this->tokenizer->checkPreviousToken(T_WHITESPACE)) {
					$msg = $this->_getMessage('SPACE_BEFORE_TOKEN', $text);
					$this->_writeError('checkWhiteSpaceBefore', $msg);
				}
			}
		}
	}
169849
public function addSeparator($token)
    {
        $cellContent = $this->wikiContentArr[$this->separatorCount];
        if ($cellContent === '') {
            if ($this->previousGenerator) {
                $this->previousGenerator->setColSpan($this->previousGenerator->getColSpan() + 1);
            }
        } else {
            if (preg_match('/^\s\s/', $cellContent) &&
                preg_match('/\s\s$/', $cellContent)) {
                if (trim($cellContent) != '') {
                    $this->generator->setAlign('center');
                }
            } elseif (preg_match('/^\s\s/', $cellContent)) {
                $this->generator->setAlign('right');
            } elseif (preg_match('/\s\s$/', $cellContent) && preg_match('/^\S/', $cellContent)) {
                $this->generator->setAlign('left');
            }
            $this->row->addGenerator($this->generator);
            $this->wikiContent .= $cellContent;
            $this->previousGenerator = $this->generator;
            $this->generator = $this->documentGenerator->getInlineGenerator($this->generatorName);
            if ($token == '^') {
                $this->generator->setIsHeader(true);
            }
            ++$this->separatorCount;
            $this->contents[$this->separatorCount] = '';
            $this->wikiContentArr[$this->separatorCount] = '';
        }
        $this->currentSeparator = $token;
        $this->wikiContent .= $token;
    }
1136984
public function contains(string $token): bool
    {
        $this->tokenize();
        return in_array($token, $this->tokens);
    }
472266
private function escape_token_string(&$text, $token) {
        $text = str_replace("~".$token, $this->protect($token), $text);
    }
1274935
private function fixControlStructure(Tokens $tokens, $index)
    {
        // Ensure a single whitespace
        if (!$tokens[$index - 1]->isWhitespace() || $tokens[$index - 1]->isWhitespace($this->singleLineWhitespaceOptions)) {
            $tokens->ensureWhitespaceAtIndex($index - 1, 1, ' ');
        }

    }
1341516
public static function isClause($token)
    {
        if (($token->type === Token::TYPE_KEYWORD && isset(Parser::$STATEMENT_PARSERS[$token->keyword]))
            || ($token->type === Token::TYPE_NONE && strtoupper($token->token) === 'DELIMITER')
        ) {
            return 2;
        } elseif ($token->type === Token::TYPE_KEYWORD && isset(Parser::$KEYWORD_PARSERS[$token->keyword])
        ) {
            return 1;
        }

        return false;
    }
1206083
private function _checkPreferQuotes($token) {
		if ($this->_isActive('preferQuotes')) {
			$style = $this->_config->getTestProperty('preferQuotes', 'type');
			if ($style === SINGLE_QUOTE && $token->text === '"') {
				$this->_writeError('preferQuotes', $this->_getMessage("PREFER_SINGLE_QUOTES"));
			} elseif ($style === DOUBLE_QUOTE && $token->text === "'") {
				$this->_writeError('preferQuotes', $this->_getMessage("PREFER_DOUBLE_QUOTES"));
			}
		}
	}
366143
private function _checkPhpTagsStartLine($token) {
		if ($this->_isActive('phpTagsStartLine')) {
			if (!$this->_isLineStart) {
				$this->_writeError('phpTagsStartLine', $this->_getMessage('PHP_TAGS_START_LINE'));
			}
		}
	}
219397
public function renderHeaderClose(Token $token) {
        $aligns = $token->get('align', null);

        $content = '|';

        foreach ($aligns as $align) {
            switch ($align) {
                case 'left':
                    $content .= ' :' . str_pad('', 9, '-') . ' |';
                    break;
                case 'right':
                    $content .= ' ' . str_pad('', 9, '-') . ': |';
                    break;
                case 'center':
                    $content .= ' :' . str_pad('', 8, '-') . ': |';
                    break;
                default:
                    $content .= ' ' . str_pad('', 10, '-') . ' |';
                    break;
            }
        }

        return "\n" . $content;
    }
143212
protected function isNextNonWhitespaceTokenEqualTo($tokenPosition, $stringValue, $scanForward)
    {
        $ignoreWhitespace = !ctype_space($stringValue);

        while (isset($this->tokens[$scanForward ? ++$tokenPosition : --$tokenPosition])) {
            $currentTokenString = $this->getTokenStringValueAt($tokenPosition);
            if ($ignoreWhitespace && ctype_space($currentTokenString)) {
                continue;
            }

            return $stringValue === $currentTokenString;
        }

        return false;
    }
1004389
private function output($string, $token)
    {
        if ($this->newLine && $this->options & JSON_PRETTY_PRINT) {
            $indent = str_repeat($this->indent, count($this->stack));
            $this->write("\n", JsonToken::T_WHITESPACE);

            if ($indent !== '') {
                $this->write($indent, JsonToken::T_WHITESPACE);
            }

            $this->line++;
            $this->column = strlen($indent) + 1;
        }

        $this->newLine = false;
        $this->write($string, $token);
        $this->column += strlen($string);
    }
661629
private function checkAndRegisterSortingProblemsOfTypes(int $token): void
    {
        $foundContentsOrg = $this->getContentsOfTokenType($token);

        $foundContentsSorted = $this->sortTokensWithoutPos($foundContentsOrg);

        $this->checkAndRegisterSortingProblems($foundContentsOrg, $foundContentsSorted);
    }
324909
public function match($token, $ignoreSpaces = true)
    {
        switch($token) {
        case Tokens::T_WHITESPACE:
            $pos = $this->getPosAfterSpaces($this->pos);

            $spaces = substr($this->value, $this->pos, $pos - $this->pos);

            $this->pos = $pos;
            return $spaces;
        case Tokens::T_IDENTIFIER:
            if($ignoreSpaces) {
                $this->ignoreSpaces();
            }
            //
            if(preg_match('/^[\w\d_]+/i', substr($this->value, $this->pos), $matches))
            {
                $identifier = $matches[0];
                $this->pos += strlen($identifier);
                return $identifier;
            }

            throw new \InvalidArgumentException(sprintf('T_IDENTIFIER is not matched with next token.'));
            break;
        default:
            $literal = $this->literals->getLiteralForToken($token);
            
            if($this->literals->isSpace($literal)) {
                $ignoreSpaces = false;
            }
            if($ignoreSpaces) {
                $this->ignoreSpaces();
            }
            // If next token is match with the literal, forward the point
            if($literal !== substr($this->value, $this->pos, strlen($literal))) {
                throw new \InvalidArgumentException(sprintf('Token "%s" is not match with next token on "%s"', $literal, substr($this->value, $this->pos)));
            }
            // 
            $this->pos += strlen($literal);

            return $literal;
            break;
        }
    }