Skip to content
Permalink
Browse files

Fix phpstan failures

  • Loading branch information...
colinodell committed Apr 10, 2019
1 parent d90b8b6 commit 00045a6b224326554345728aaef81335cda96c38
@@ -188,7 +188,7 @@ public function finalize(ContextInterface $context, int $endLineNumber)
*/
public function handleRemainingContents(ContextInterface $context, Cursor $cursor)
{
/** @var FencedCode $container */
/** @var self $container */
$container = $context->getContainer();
// check for closing code fence
@@ -202,7 +202,7 @@ public function handleRemainingContents(ContextInterface $context, Cursor $curso
}
}
$context->getTip()->addLine($cursor->getRemainder());
$container->addLine($cursor->getRemainder());
}
/**
@@ -104,7 +104,9 @@ public function finalize(ContextInterface $context, int $endLineNumber)
*/
public function handleRemainingContents(ContextInterface $context, Cursor $cursor)
{
$context->getTip()->addLine($cursor->getRemainder());
/** @var self $tip */
$tip = $context->getTip();
$tip->addLine($cursor->getRemainder());
// Check for end condition
if ($this->type >= self::TYPE_1_CODE_CONTAINER && $this->type <= self::TYPE_5_CDATA) {
@@ -81,6 +81,8 @@ public function finalize(ContextInterface $context, int $endLineNumber)
*/
public function handleRemainingContents(ContextInterface $context, Cursor $cursor)
{
$context->getTip()->addLine($cursor->getRemainder());
/** @var self $tip */
$tip = $context->getTip();
$tip->addLine($cursor->getRemainder());
}
}
@@ -98,7 +98,10 @@ protected function parseReferences(ContextInterface $context, Cursor $cursor)
public function handleRemainingContents(ContextInterface $context, Cursor $cursor)
{
$cursor->advanceToNextNonSpaceOrTab();
$context->getTip()->addLine($cursor->getRemainder());
/** @var self $tip */
$tip = $context->getTip();
$tip->addLine($cursor->getRemainder());
}
/**
@@ -116,10 +116,7 @@ private function incorporateLine(ContextInterface $context)
// What remains at the offset is a text line. Add the text to the appropriate container.
// First check for a lazy paragraph continuation:
if ($this->isLazyParagraphContinuation($context, $cursor)) {
// lazy paragraph continuation
$context->getTip()->addLine($cursor->getRemainder());
if ($this->handleLazyParagraphContinuation($context, $cursor)) {
return;
}
@@ -135,9 +132,10 @@ private function incorporateLine(ContextInterface $context)
$context->getContainer()->handleRemainingContents($context, $cursor);
} elseif (!$cursor->isBlank()) {
// Create paragraph container for line
$context->addBlock(new Paragraph());
$p = new Paragraph();
$context->addBlock($p);
$cursor->advanceToNextNonSpaceOrTab();
$context->getTip()->addLine($cursor->getRemainder());
$p->addLine($cursor->getRemainder());
}
}
@@ -223,12 +221,22 @@ private function parseBlocks(ContextInterface $context, Cursor $cursor)
*
* @return bool
*/
private function isLazyParagraphContinuation(ContextInterface $context, Cursor $cursor): bool
private function handleLazyParagraphContinuation(ContextInterface $context, Cursor $cursor): bool
{
return $context->getTip() instanceof Paragraph &&
$tip = $context->getTip();
if ($tip instanceof Paragraph &&
!$context->getBlockCloser()->areAllClosed() &&
!$cursor->isBlank() &&
\count($context->getTip()->getStrings()) > 0;
\count($tip->getStrings()) > 0) {
// lazy paragraph continuation
$tip->addLine($cursor->getRemainder());
return true;
}
return false;
}
/**

0 comments on commit 00045a6

Please sign in to comment.
You can’t perform that action at this time.