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

Commit

Permalink
Stop depending on namespace fallback for functions and constants
Browse files Browse the repository at this point in the history
HHAST did these changes.
  • Loading branch information
fredemmott committed Feb 9, 2018
1 parent 6a4e406 commit 18955d8
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .hhconfig
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
assume_php=false
enable_experimental_tc_features = no_fallback_in_namespaces
safe_array = true
safe_vector_array = true
2 changes: 1 addition & 1 deletion src/_Private/get_html_entity_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function get_html_entity_table(): dict<string, string> {
"Expected %s to exist",
$file,
);
$data = \json_decode(\file_get_contents($file), JSON_FB_HACK_ARRAYS);
$data = \json_decode(\file_get_contents($file), \JSON_FB_HACK_ARRAYS);

return Dict\map($data, $x ==> $x['characters']);
}
2 changes: 1 addition & 1 deletion src/inlines/Emphasis.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ private static function debugDump(
int $position,
vec<Stack\Node> $stack,
): void {
printf("-------------------- %d\n", $position);
\printf("-------------------- %d\n", $position);
print(
Vec\map_with_key(
$stack,
Expand Down
8 changes: 4 additions & 4 deletions src/inlines/_Private/EmphasisStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function toInlines(Context $ctx): vec<Inline> {

<<__Override>>
public function debugDump(string $_markdown): string {
return '(text '.var_export($this->text, true).')';
return '(text '.\var_export($this->text, true).')';
}
}

Expand Down Expand Up @@ -69,7 +69,7 @@ public function debugDump(string $_markdown): string {
return '(delim '.
(($this->flags & Inlines\Emphasis::IS_START) ? 'open' : '').
(($this->flags & Inlines\Emphasis::IS_END) ? 'close' : '').
' '.var_export($this->getText(), true).')';
' '.\var_export($this->getText(), true).')';
}
}

Expand All @@ -86,7 +86,7 @@ public function toInlines(Context $_): vec<Inline> {

<<__Override>>
public function debugDump(string $_markdown): string {
return '(inline '.get_class($this->content).')';
return '(inline '.\get_class($this->content).')';
}
}

Expand Down Expand Up @@ -125,7 +125,7 @@ public function debugDump(string $markdown): string {
return '('.
($node->isStrong() ? 'strong' : 'em')
.' '.
var_export(
\var_export(
Str\slice($markdown, $this->startOffset, $this->getLength()),
true,
)
Expand Down
2 changes: 1 addition & 1 deletion src/inlines/_Private/parse_with_blacklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function parse_with_blacklist (
invariant(
$new_offset > $offset,
"Failed to consume any data with %s",
get_class($inline),
\get_class($inline),
);
$offset = $new_offset;
$out[] = $inline;
Expand Down
2 changes: 1 addition & 1 deletion src/inlines/parse.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function parse(
'Offset: %d; Length: %d; Final class: %s',
$offset,
$length,
get_class(C\lastx($parsed)),
\get_class(C\lastx($parsed)),
);
return $parsed;
}
4 changes: 2 additions & 2 deletions src/render/HTMLRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function renderHeading(Blocks\Heading $node): string {
$level = $node->getLevel();
return $node->getHeading()
|> $this->renderNodes($$)
|> sprintf("<h%d>%s</h%d>\n", $level, $$, $level);
|> \sprintf("<h%d>%s</h%d>\n", $level, $$, $level);
}

<<__Override>>
Expand Down Expand Up @@ -210,7 +210,7 @@ protected function renderListOfItems(Blocks\ListOfItems $node): string {
$start ='<ol>';
$end = '</ol>';
} else {
$start = sprintf('<ol start="%d">', $start);
$start = \sprintf('<ol start="%d">', $start);
$end = '</ol>';
}
return $node->getItems()
Expand Down
4 changes: 2 additions & 2 deletions src/render/RenderContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public function enableNamedExtension(string $extension): this {
$this->enabledExtensions = $this->extensions
|> Vec\filter(
$$,
$obj ==> Str\ends_with_ci(get_class($obj), "\\".$extension.'Extension'),
$obj ==> Str\ends_with_ci(\get_class($obj), "\\".$extension.'Extension'),
)
|> Vec\concat($$, $this->enabledExtensions)
|> Vec\unique_by($$, $x ==> get_class($x));
|> Vec\unique_by($$, $x ==> \get_class($x));
return $this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/render/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ protected function renderResolvedNode(

invariant_violation(
"Unhandled node type: %s",
get_class($node),
\get_class($node),
);
}
}
2 changes: 1 addition & 1 deletion src/unparsed-blocks/ContainerBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected static function consumeChildren(
invariant(
$pre_count > $lines->getCount(),
'consuming failed to reduce line count with class "%s" on line "%s"',
get_class($child),
\get_class($child),
$lines->getFirstLine(),
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/unparsed-blocks/FencedBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static function consume(
$matched = vec[$first];

if (
is_a(static::class, HTMLBlock::class, true)
\is_a(static::class, HTMLBlock::class, true)
&& \preg_match($end, $first) === 1
) {
// Keyed specifically to HTMLBlock as the behavior for the rest of the
Expand Down
2 changes: 1 addition & 1 deletion src/unparsed-blocks/LinkReferenceDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getKey(): string {
public static function normalizeKey(string $in): string {
return $in
|> Str\trim($$)
|> \mb_convert_case($$, MB_CASE_LOWER, "UTF-8")
|> \mb_convert_case($$, \MB_CASE_LOWER, "UTF-8")
|> \preg_replace('/\s+/', ' ', $$);
}

Expand Down
2 changes: 1 addition & 1 deletion src/unparsed-blocks/ListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function consume(
invariant(
\is_int($max_indent),
'expected to get a maximum indentation from context, got a %s',
gettype($max_indent),
\gettype($max_indent),
);

// Consume leading whitespace
Expand Down

0 comments on commit 18955d8

Please sign in to comment.