Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Commit

Permalink
disallow_array_literal (#10)
Browse files Browse the repository at this point in the history
* disallow_array_literal

* Mismatched (v)array return type

* Allow array literals because of required hhvm 4.18 support
  • Loading branch information
lexidor authored and fredemmott committed Jan 13, 2020
1 parent 7915e2d commit c25d39f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/inlines/AutoLinkExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function consume(

$string = Str\slice($markdown, $offset);

$matches = [];
$matches = darray[];
$result = \preg_match_with_matches(
'/^(?<prefix>'.self::PREFIX.')(?<domain>'.self::DOMAIN.')/i',
$string,
Expand Down
2 changes: 1 addition & 1 deletion src/inlines/RawHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function consume(

$slice = Str\slice($string, $offset);

$matches = [];
$matches = darray[];
if (
\preg_match_with_matches(
'/^('.self::OPEN_TAG.'|'.self::CLOSING_TAG.'|'.self::DECLARATION.')/i',
Expand Down
2 changes: 1 addition & 1 deletion src/render/MarkdownRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ protected function renderInlineWithPlainTextContent(
return \mb_encode_numericentity(
$node->getContent(),
// start, end, offset, mask
[0, 0xffff, 0, 0xffff],
varray[0, 0xffff, 0, 0xffff],
'UTF-8',
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/EdgeCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

final class EdgeCaseTest extends TestCase {
public function getManualExamples(
): array<(string, string)> {
return [
): varray<(string, string)> {
return varray[
tuple("- foo\n\n", "<ul>\n<li>foo</li>\n</ul>\n"),
tuple("- foo\n\n\n", "<ul>\n<li>foo</li>\n</ul>\n"),
tuple(
Expand Down
4 changes: 2 additions & 2 deletions tests/SpecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class SpecTest extends TestCase {
// Sanity check - make sure it matches the last one in the spec
const int EXAMPLE_COUNT = 649;

public function getSpecExamples(): array<(string, string, string, ?string)> {
public function getSpecExamples(): varray<(string, string, string, ?string)> {
$text = \file_get_contents(__DIR__.'/../third-party/spec.txt');
$raw_examples = vec[];
$offset = 0;
Expand All @@ -45,7 +45,7 @@ public function getSpecExamples(): array<(string, string, string, ?string)> {
$offset = $end + Str\length(self::EXAMPLE_END);
}

$examples = [];
$examples = varray[];

foreach ($raw_examples as list($example, $extension)) {
$parts = Str\split($example, "\n.\n");
Expand Down

0 comments on commit c25d39f

Please sign in to comment.