diff --git a/psalm.xml b/psalm.xml index 22601f8..dc281a3 100644 --- a/psalm.xml +++ b/psalm.xml @@ -30,5 +30,10 @@ + + + + + diff --git a/src/Components/Blocks/BlockQuote.php b/src/Components/Blocks/BlockQuote.php index d356358..32b8adf 100644 --- a/src/Components/Blocks/BlockQuote.php +++ b/src/Components/Blocks/BlockQuote.php @@ -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); diff --git a/src/Components/Blocks/IndentedCode.php b/src/Components/Blocks/IndentedCode.php index b40bc2d..b5ae8fb 100644 --- a/src/Components/Blocks/IndentedCode.php +++ b/src/Components/Blocks/IndentedCode.php @@ -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; } diff --git a/src/Components/Blocks/TList.php b/src/Components/Blocks/TList.php index 7f318dd..b368c98 100644 --- a/src/Components/Blocks/TList.php +++ b/src/Components/Blocks/TList.php @@ -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( diff --git a/src/Components/Blocks/Table.php b/src/Components/Blocks/Table.php index ee4db72..0ede0f6 100644 --- a/src/Components/Blocks/Table.php +++ b/src/Components/Blocks/Table.php @@ -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; } diff --git a/src/Configurables/DefinitionBook.php b/src/Configurables/DefinitionBook.php index 38e55b0..4c437da 100644 --- a/src/Configurables/DefinitionBook.php +++ b/src/Configurables/DefinitionBook.php @@ -48,6 +48,7 @@ final class DefinitionBook implements MutableConfigurable return null; } + /** @return static */ public function isolatedCopy(): self { return new self($this->book); diff --git a/src/Configurables/SlugRegister.php b/src/Configurables/SlugRegister.php index 1a659e0..3b36dbe 100644 --- a/src/Configurables/SlugRegister.php +++ b/src/Configurables/SlugRegister.php @@ -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); diff --git a/src/Parsedown.php b/src/Parsedown.php index bd1407b..bfb5bdf 100644 --- a/src/Parsedown.php +++ b/src/Parsedown.php @@ -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; diff --git a/tests/CommonMarkTestWeak.php b/tests/CommonMarkTestWeak.php index e04ad3c..9293de9 100644 --- a/tests/CommonMarkTestWeak.php +++ b/tests/CommonMarkTestWeak.php @@ -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); diff --git a/tests/ParsedownTest.php b/tests/ParsedownTest.php index f0833c5..c8a51f0 100755 --- a/tests/ParsedownTest.php +++ b/tests/ParsedownTest.php @@ -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; } diff --git a/tests/src/StateTest.php b/tests/src/StateTest.php index 0cc58a2..babb419 100644 --- a/tests/src/StateTest.php +++ b/tests/src/StateTest.php @@ -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()