diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4c29d1..4103c86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: + php: - '7.4' - '8.0' - '8.1' @@ -26,4 +26,5 @@ jobs: - run: composer install --no-progress # - run: composer codestyle - run: composer phpstan + if: matrix.php == '8.1' - run: composer tests diff --git a/Michelf/MarkdownExtra.php b/Michelf/MarkdownExtra.php index 060a4ae..796949e 100644 --- a/Michelf/MarkdownExtra.php +++ b/Michelf/MarkdownExtra.php @@ -601,6 +601,7 @@ class MarkdownExtra extends \Michelf\Markdown { else { $parsed .= $tag; } + // @phpstan-ignore-next-line } while ($depth >= 0); return array($parsed, $text); diff --git a/composer.json b/composer.json index 07f5a5b..7cb59cf 100644 --- a/composer.json +++ b/composer.json @@ -24,11 +24,10 @@ "psr-4": { "Michelf\\": "Michelf/" } }, "require-dev": { - "phpspec/prophecy": "^1.6", "friendsofphp/php-cs-fixer": "^3.0", "phpunit/phpunit": "^9.5", - "phpstan/phpstan": "^1.0", - "phpstan/phpstan-phpunit": "^1.0" + "phpstan/phpstan": ">=1.0", + "phpstan/phpstan-phpunit": ">=1.0" }, "scripts": { diff --git a/test/helpers/MarkdownTestHelper.php b/test/helpers/MarkdownTestHelper.php index ffca0c9..fc74636 100644 --- a/test/helpers/MarkdownTestHelper.php +++ b/test/helpers/MarkdownTestHelper.php @@ -22,7 +22,6 @@ class MarkdownTestHelper $dataValues = array(); - /** @var SplFileInfo $inputFile */ foreach ($regexIterator as $inputFiles) { foreach ($inputFiles as $inputMarkdownPath) { $xhtml = true; @@ -163,6 +162,7 @@ class MarkdownTestHelper foreach ($node_list as $node) { switch ($node->nodeType) { case XML_ELEMENT_NODE: + /** @var DOMElement $node */ static::normalizeElementContent($node, $whitespace_preserve); static::normalizeElementAttributes($node); @@ -207,6 +207,7 @@ class MarkdownTestHelper break; case XML_TEXT_NODE: + /** @var DOMText $node */ if (!$whitespace_preserve) { if (trim($node->data) === "") { $node->data = $whitespace; @@ -222,8 +223,8 @@ class MarkdownTestHelper ($whitespace === "\n\n" || $whitespace === "\n")) { if ($element->firstChild) { if ($element->firstChild->nodeType == XML_TEXT_NODE) { - $element->firstChild->data = - preg_replace('{^\s+}', "\n", $element->firstChild->data); + $element->firstChild->data = // @phpstan-ignore-line + preg_replace('{^\s+}', "\n", $element->firstChild->data ?? ''); } else { $element->insertBefore(new DOMText("\n"), $element->firstChild); @@ -231,8 +232,8 @@ class MarkdownTestHelper } if ($element->lastChild) { if ($element->lastChild->nodeType == XML_TEXT_NODE) { - $element->lastChild->data = - preg_replace('{\s+$}', "\n", $element->lastChild->data); + $element->lastChild->data = // @phpstan-ignore-line + preg_replace('{\s+$}', "\n", $element->lastChild->data ?? ''); } else { $element->insertBefore(new DOMText("\n"), null);