mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Fix psalm errors
This commit is contained in:
parent
98aab22002
commit
ca16d7573d
@ -30,5 +30,10 @@
|
|||||||
<PossiblyNullReference>
|
<PossiblyNullReference>
|
||||||
<errorLevel type="suppress"><directory name="tests/src" /></errorLevel>
|
<errorLevel type="suppress"><directory name="tests/src" /></errorLevel>
|
||||||
</PossiblyNullReference>
|
</PossiblyNullReference>
|
||||||
|
<InternalMethod>
|
||||||
|
<errorLevel type="suppress">
|
||||||
|
<directory name="tests" />
|
||||||
|
</errorLevel>
|
||||||
|
</InternalMethod>
|
||||||
</issueHandlers>
|
</issueHandlers>
|
||||||
</psalm>
|
</psalm>
|
||||||
|
@ -82,7 +82,7 @@ final class BlockQuote implements ContinuableBlock
|
|||||||
return new self($Lines);
|
return new self($Lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $Context->precedingEmptyLines() > 0) {
|
if (!($Context->precedingEmptyLines() > 0)) {
|
||||||
$indentOffset = $Context->line()->indentOffset() + $Context->line()->indent();
|
$indentOffset = $Context->line()->indentOffset() + $Context->line()->indent();
|
||||||
$Lines = $this->Lines->appendingTextLines($Context->line()->text(), $indentOffset);
|
$Lines = $this->Lines->appendingTextLines($Context->line()->text(), $indentOffset);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ final class IndentedCode implements ContinuableBlock
|
|||||||
State $State,
|
State $State,
|
||||||
Block $Block = null
|
Block $Block = null
|
||||||
) {
|
) {
|
||||||
if (isset($Block) && $Block instanceof Paragraph && ! $Context->precedingEmptyLines() > 0) {
|
if (isset($Block) && $Block instanceof Paragraph && ! ($Context->precedingEmptyLines() > 0)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ final class TList implements ContinuableBlock
|
|||||||
$listStart !== 1
|
$listStart !== 1
|
||||||
&& isset($Block)
|
&& isset($Block)
|
||||||
&& $Block instanceof Paragraph
|
&& $Block instanceof Paragraph
|
||||||
&& ! $Context->precedingEmptyLines() > 0
|
&& ! ($Context->precedingEmptyLines() > 0)
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ final class TList implements ContinuableBlock
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $Context->precedingEmptyLines() > 0) {
|
if (! ($Context->precedingEmptyLines() > 0)) {
|
||||||
$text = $Context->line()->ltrimBodyUpto($requiredIndent);
|
$text = $Context->line()->ltrimBodyUpto($requiredIndent);
|
||||||
|
|
||||||
$Lis[\count($Lis) -1] = $Lis[\count($Lis) -1]->appendingTextLines(
|
$Lis[\count($Lis) -1] = $Lis[\count($Lis) -1]->appendingTextLines(
|
||||||
|
@ -112,7 +112,6 @@ final class Table implements AcquisitioningBlock, ContinuableBlock
|
|||||||
if (
|
if (
|
||||||
! \preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]++`|`)++/', $row, $matches)
|
! \preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]++`|`)++/', $row, $matches)
|
||||||
|| ! isset($matches[0])
|
|| ! isset($matches[0])
|
||||||
|| ! \is_array($matches[0])
|
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ final class DefinitionBook implements MutableConfigurable
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return static */
|
||||||
public function isolatedCopy(): self
|
public function isolatedCopy(): self
|
||||||
{
|
{
|
||||||
return new self($this->book);
|
return new self($this->book);
|
||||||
|
@ -37,6 +37,7 @@ final class SlugRegister implements MutableConfigurable
|
|||||||
return $this->register[$slug] ?? 0;
|
return $this->register[$slug] ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return static */
|
||||||
public function isolatedCopy(): self
|
public function isolatedCopy(): self
|
||||||
{
|
{
|
||||||
return new self($this->register);
|
return new self($this->register);
|
||||||
|
@ -15,7 +15,6 @@ use Erusev\Parsedown\Configurables\BlockTypes;
|
|||||||
use Erusev\Parsedown\Configurables\InlineTypes;
|
use Erusev\Parsedown\Configurables\InlineTypes;
|
||||||
use Erusev\Parsedown\Configurables\RecursionLimiter;
|
use Erusev\Parsedown\Configurables\RecursionLimiter;
|
||||||
use Erusev\Parsedown\Html\Renderable;
|
use Erusev\Parsedown\Html\Renderable;
|
||||||
use Erusev\Parsedown\Html\Renderables\Text;
|
|
||||||
use Erusev\Parsedown\Parsing\Excerpt;
|
use Erusev\Parsedown\Parsing\Excerpt;
|
||||||
use Erusev\Parsedown\Parsing\Line;
|
use Erusev\Parsedown\Parsing\Line;
|
||||||
use Erusev\Parsedown\Parsing\Lines;
|
use Erusev\Parsedown\Parsing\Lines;
|
||||||
|
@ -30,16 +30,11 @@ class CommonMarkTestWeak extends CommonMarkTestStrict
|
|||||||
{
|
{
|
||||||
$textLevelElements = \array_keys(Element::TEXT_LEVEL_ELEMENTS);
|
$textLevelElements = \array_keys(Element::TEXT_LEVEL_ELEMENTS);
|
||||||
|
|
||||||
\array_walk(
|
$textLevelElements = \array_map(
|
||||||
$textLevelElements,
|
function ($e) { return \preg_quote($e, '/'); },
|
||||||
/**
|
$textLevelElements
|
||||||
* @param string &$element
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function (&$element) {
|
|
||||||
$element = \preg_quote($element, '/');
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->textLevelElementRegex = '\b(?:' . \implode('|', $textLevelElements) . ')\b';
|
$this->textLevelElementRegex = '\b(?:' . \implode('|', $textLevelElements) . ')\b';
|
||||||
|
|
||||||
parent::__construct($name, $data, $dataName);
|
parent::__construct($name, $data, $dataName);
|
||||||
|
@ -75,10 +75,7 @@ class ParsedownTest extends TestCase
|
|||||||
|
|
||||||
foreach ($this->dirs as $dir) {
|
foreach ($this->dirs as $dir) {
|
||||||
$Folder = new \DirectoryIterator($dir);
|
$Folder = new \DirectoryIterator($dir);
|
||||||
|
|
||||||
foreach ($Folder as $File) {
|
foreach ($Folder as $File) {
|
||||||
/** @var $File DirectoryIterator */
|
|
||||||
|
|
||||||
if (! $File->isFile()) {
|
if (! $File->isFile()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ final class StateTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
* @throws \PHPUnit\Framework\Exception
|
||||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function testStateCloneVisibility()
|
public function testStateCloneVisibility()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user