diff --git a/scripts/DocGenerator.php b/scripts/DocGenerator.php index 9d414b284f31..359a73b61ec6 100644 --- a/scripts/DocGenerator.php +++ b/scripts/DocGenerator.php @@ -194,17 +194,20 @@ private function buildExamples($examples) $exampleParts = explode('```', $examples); foreach ($exampleParts as $example) { + $example = trim($example); $caption = ''; if (strlen($example) === 0) { continue; } - // strip the syntax highlighting, it won't be used in the doc site - $example = ltrim($example, 'php'); - $example = trim($example); $lines = explode(PHP_EOL, $example); + // strip the syntax highlighting, it won't be used in the doc site + if (substr($lines[0], 0, 3) === 'php') { + unset($lines[0]); + } + foreach ($lines as $key => $line) { if (substr($line, 0, 2) === '//') { $caption .= $this->markdown->parse(substr($line, 3));