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