doc/lib: Throw LogicException if text is added without having a heading
This commit is contained in:
parent
57a0b0005e
commit
310201eb5b
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue