diff --git a/.hhconfig b/.hhconfig index afb06b5..fa1a553 100644 --- a/.hhconfig +++ b/.hhconfig @@ -1,4 +1,5 @@ assume_php=false +disable_static_local_variables = true ignored_paths = [ "vendor/.+/tests/.+" ] disallow_elvis_space=true disallow_non_arraykey_keys=true diff --git a/composer.lock b/composer.lock index e86fa42..cdfe506 100644 --- a/composer.lock +++ b/composer.lock @@ -153,16 +153,16 @@ }, { "name": "facebook/hh-clilib", - "version": "v2.1.0", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/hhvm/hh-clilib.git", - "reference": "44f30c1f07b9d36430bfff721a119a0d43b15edd" + "reference": "9d6b1a8686951da24ab68ffeba25ae85d1788408" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hhvm/hh-clilib/zipball/44f30c1f07b9d36430bfff721a119a0d43b15edd", - "reference": "44f30c1f07b9d36430bfff721a119a0d43b15edd", + "url": "https://api.github.com/repos/hhvm/hh-clilib/zipball/9d6b1a8686951da24ab68ffeba25ae85d1788408", + "reference": "9d6b1a8686951da24ab68ffeba25ae85d1788408", "shasum": "" }, "require": { @@ -173,7 +173,7 @@ "require-dev": { "facebook/fbexpect": "^2.1.0", "hhvm/hacktest": "^1.0.0", - "hhvm/hhast": "^4.0" + "hhvm/hhast": "^4.0.2" }, "type": "library", "extra": { @@ -185,7 +185,7 @@ "license": [ "MIT" ], - "time": "2019-02-12T20:14:07+00:00" + "time": "2019-03-26T18:31:27+00:00" }, { "name": "hhvm/hacktest", @@ -274,16 +274,16 @@ }, { "name": "hhvm/hhvm-autoload", - "version": "v2.0.5", + "version": "v2.0.6", "source": { "type": "git", "url": "https://github.com/hhvm/hhvm-autoload.git", - "reference": "dbd50d7fb1856d1f6757e10bc30eb2bf5d17b3f1" + "reference": "4f510960e71adcad661c33ae355d0d9670d9c805" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hhvm/hhvm-autoload/zipball/dbd50d7fb1856d1f6757e10bc30eb2bf5d17b3f1", - "reference": "dbd50d7fb1856d1f6757e10bc30eb2bf5d17b3f1", + "url": "https://api.github.com/repos/hhvm/hhvm-autoload/zipball/4f510960e71adcad661c33ae355d0d9670d9c805", + "reference": "4f510960e71adcad661c33ae355d0d9670d9c805", "shasum": "" }, "require": { @@ -317,7 +317,7 @@ ] }, "notification-url": "https://packagist.org/downloads/", - "time": "2019-03-22T21:27:20+00:00" + "time": "2019-03-26T17:57:44+00:00" }, { "name": "hhvm/hsl-experimental", diff --git a/src/render/MarkdownRenderer.php b/src/render/MarkdownRenderer.php index 15d5f27..e73bc03 100644 --- a/src/render/MarkdownRenderer.php +++ b/src/render/MarkdownRenderer.php @@ -107,11 +107,7 @@ protected function renderLinkReferenceDefinition( // reference definitions when constructing the AST; keeping them in case // this is mixed with other markdown, or if we end up creating a separate // ReferenceLink AST node that renderers need to deal with. - $md = \sprintf( - '[%s]: <%s>', - $def->getLabel(), - $def->getDestination(), - ); + $md = \sprintf('[%s]: <%s>', $def->getLabel(), $def->getDestination()); $title = $def->getTitle(); if ($title === null) { return $md; @@ -171,23 +167,23 @@ protected function renderListItem( if ($list->isLoose()) { $content = $item->getChildren() - |> $this->renderNodes($$) - |> $$."\n"; + |> $this->renderNodes($$) + |> $$."\n"; } else { $content = $item->getChildren() |> Vec\map( $$, $child ==> { - if ($child instanceof Blocks\Paragraph) { - return $this->renderNodes($child->getContents()); - } - if ($child instanceof Blocks\Block) { - return Str\trim($this->render($child)); - } - return $this->render($child); - }, - ) - |> Str\join($$, "\n"); + if ($child instanceof Blocks\Paragraph) { + return $this->renderNodes($child->getContents()); + } + if ($child instanceof Blocks\Block) { + return Str\trim($this->render($child)); + } + return $this->render($child); + }, + ) + |> Str\join($$, "\n"); } return $content |> Str\split($$, "\n") @@ -200,12 +196,16 @@ protected function renderListItem( |> $sep.$$; } + private int $numberOfLists = 0; + <<__Override>> protected function renderListOfItems(Blocks\ListOfItems $node): string { - static $list_count = 0; - ++$list_count; + ++$this->numberOfLists; return $node->getItems() - |> Vec\map($$, $item ==> $this->renderListItem($list_count, $node, $item)) + |> Vec\map( + $$, + $item ==> $this->renderListItem($this->numberOfLists, $node, $item), + ) |> Str\join($$, "\n"); } @@ -322,7 +322,7 @@ protected function renderInlineWithPlainTextContent( <<__Override>> protected function renderCodeSpan(Inlines\CodeSpan $node): string { $code = $node->getCode(); - $len = Str\length((string) $this->outContext) + Str\length($code); + $len = Str\length((string)$this->outContext) + Str\length($code); $sep = '`'; for ($sep_len = 1; $sep_len <= $len + 1; ++$sep_len) { @@ -330,7 +330,7 @@ protected function renderCodeSpan(Inlines\CodeSpan $node): string { if (Str\contains($code, $sep)) { continue; } - if (Str\contains((string) $this->outContext, $sep)) { + if (Str\contains((string)$this->outContext, $sep)) { continue; } break; @@ -399,7 +399,9 @@ protected function renderSoftLineBreak(): string { } <<__Override>> - protected function renderStrikethroughExtension(Inlines\StrikethroughExtension $node): string { + protected function renderStrikethroughExtension( + Inlines\StrikethroughExtension $node, + ): string { $children = $node->getChildren() |> Vec\map($$, $child ==> $this->render($child)) |> Str\join($$, '');