HippoPHP\Hippo\Checks\Naming\FullNamespaceCheck::checkFileInternal PHP Method

checkFileInternal() protected method

checkFileInternal(): defined by AbstractCheck.
See also: AbstractCheck::checkFileInternal()
protected checkFileInternal ( CheckContext $checkContext, Config $config )
$checkContext HippoPHP\Hippo\CheckContext
$config HippoPHP\Hippo\Config\Config
    protected function checkFileInternal(CheckContext $checkContext, Config $config)
    {
        $file = $checkContext->getFile();
        $tokens = $checkContext->getTokenList();
        try {
            do {
                // Jump us to the next token we want to check.
                $tokens->seekToType(T_USE)->skipToNextNonWhitespace()->current();
                if ($tokens->current()->getContent() !== '(') {
                    // Now if the next token does not equal T_NS_SEPARATOR we are not fully qualified.
                    if (!$tokens->current()->isType(T_NS_SEPARATOR)) {
                        $token = $tokens->current();
                        $this->addViolation($file, $token->getLine(), $token->getColumn(), 'Use fully qualified namespaces.');
                    }
                }
            } while ($tokens->valid());
        } catch (\HippoPHP\Tokenizer\Exception\OutOfBoundsException $e) {
            // Ignore the exception, we're at the end of the file.
        }
    }