Ejemplo n.º 1
0
if (isset($blocks['php'])) {
    foreach ($blocks['php'] as $block) {
        if ($errors = php_lint_errors($block['code'])) {
            $errstr = implode("\n - ", $errors);
            throw new \RuntimeException("Linting block on {$block['file']}:{$block['line']} failed with errors:\n - " . $errstr);
        }
    }
}
lint_nope_blocks:
$nope = new \Nope\Parser();
foreach ($allBlocks as $block) {
    if ($block['lang'] == 'php') {
        $tokens = token_get_all($block['code']);
        foreach ($tokens as $token) {
            if (is_array($token) && $token[0] == T_DOC_COMMENT) {
                $parsed = $nope->parseDocComment($token[1]);
            }
        }
    } elseif ($block['lang'] == 'nope') {
        $parsed = $nope->parseDocComment($block['code']);
    }
}
function doctest_run_php_group($group)
{
    $scope = [];
    foreach ($group as $test) {
        $scope = array_merge($scope, doctest_run_php($test, $scope));
    }
}
function doctest_run_php($test, $scope = [])
{