doc/lib: Throw LogicException if text is added without having a heading

This commit is contained in:
Eric Lippmann 2015-02-11 15:51:31 +01:00
parent 57a0b0005e
commit 310201eb5b
1 changed files with 4 additions and 0 deletions

View File

@ -3,6 +3,7 @@
namespace Icinga\Module\Doc; namespace Icinga\Module\Doc;
use LogicException;
use SplStack; use SplStack;
use Icinga\Data\Tree\SimpleTree; use Icinga\Data\Tree\SimpleTree;
use Icinga\Exception\NotReadableError; use Icinga\Exception\NotReadableError;
@ -169,6 +170,9 @@ class DocParser
} }
$stack->push($section); $stack->push($section);
} else { } else {
if ($stack->isEmpty()) {
throw new LogicException('Heading required');
}
$stack->top()->appendContent($line); $stack->top()->appendContent($line);
} }
// Save last line for setext-style headers // Save last line for setext-style headers