diff --git a/.travis.yml b/.travis.yml index 9405c5e..53abfb7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ sudo: required language: generic services: docker env: -- HHVM_VERSION=4.8-latest +- HHVM_VERSION=4.14-latest - HHVM_VERSION=latest - HHVM_VERSION=nightly install: diff --git a/composer.json b/composer.json index 2ec19cf..0b91831 100644 --- a/composer.json +++ b/composer.json @@ -3,12 +3,12 @@ "bin": [ "bin/hh-apidoc", "bin/hh-apidoc.hack" ], "license": "MIT", "require": { - "hhvm": "^4.8", + "hhvm": "^4.14", "hhvm/hsl": "^4.0", "facebook/fbmarkdown": "^1.0", "facebook/hh-clilib": "^2.1.0", "facebook/definition-finder": "^2.0.0", - "hhvm/hhast": "^4.8" + "hhvm/hhast": "^4.14" }, "require-dev": { "hhvm/hhvm-autoload": "^2.0" diff --git a/src/MarkdownExt/AutoLinkifyFilter.hack b/src/MarkdownExt/AutoLinkifyFilter.hack index 2fa9834..a4d8cd2 100644 --- a/src/MarkdownExt/AutoLinkifyFilter.hack +++ b/src/MarkdownExt/AutoLinkifyFilter.hack @@ -35,7 +35,7 @@ final class AutoLinkifyFilter extends Markdown\RenderFilter { Markdown\RenderContext $context, Markdown\ASTNode $node, ): vec { - if (!$node instanceof CodeSpan) { + if (!$node is CodeSpan) { return vec[$node]; } @@ -55,7 +55,7 @@ final class AutoLinkifyFilter extends Markdown\RenderFilter { } invariant( - $context instanceof RenderContext, + $context is RenderContext, 'Expected render context to be a %s', RenderContext::class, ); @@ -129,7 +129,7 @@ final class AutoLinkifyFilter extends Markdown\RenderFilter { } $def = $context->getDocumentable()['definition']; - if ($def instanceof ScannedClassish) { + if ($def is ScannedClassish) { $path = self::getPathForMethod($context, $def->getName(), $search); if ($path !== null) { return $path; diff --git a/src/MarkdownExt/SyntaxHighlightingFilter.hack b/src/MarkdownExt/SyntaxHighlightingFilter.hack index 1bc8b9a..e762bc5 100644 --- a/src/MarkdownExt/SyntaxHighlightingFilter.hack +++ b/src/MarkdownExt/SyntaxHighlightingFilter.hack @@ -33,10 +33,10 @@ final class SyntaxHighlightingFilter extends Markdown\RenderFilter { Markdown\RenderContext $context, Markdown\ASTNode $node, ): vec { - if (!$node instanceof CodeBlock) { + if (!$node is CodeBlock) { return vec[$node]; } - if ($context instanceof namespace\RenderContext) { + if ($context is namespace\RenderContext) { if ($context->getOutputFormat() !== OutputFormat::HTML) { return vec[$node]; } @@ -65,10 +65,6 @@ final class SyntaxHighlightingFilter extends Markdown\RenderFilter { /** Convert an HHAST FFP AST node into an HTML string. */ protected static function getHTML(HHAST\Node $node): string { - if ($node instanceof HHAST\Missing) { - return ''; - } - if ($node->isTrivia() || $node->isToken()) { $inner = \htmlspecialchars($node->getCode()); } else { @@ -77,7 +73,7 @@ final class SyntaxHighlightingFilter extends Markdown\RenderFilter { |> Str\join($$, ''); } - if ($node instanceof HHAST\NodeList ) { + if ($node is HHAST\NodeList<_> ) { return $inner; } diff --git a/src/PageSections/FunctionishParameters.hack b/src/PageSections/FunctionishParameters.hack index 0403e18..ba3e276 100644 --- a/src/PageSections/FunctionishParameters.hack +++ b/src/PageSections/FunctionishParameters.hack @@ -21,7 +21,7 @@ final class FunctionishParameters extends PageSection { <<__Override>> public function getMarkdown(): ?string { $f = $this->definition; - if (!$f instanceof ScannedFunctionish) { + if (!$f is ScannedFunctionish) { return null; } diff --git a/src/PageSections/FunctionishReturnValues.hack b/src/PageSections/FunctionishReturnValues.hack index 0bd7ee6..f2041a9 100644 --- a/src/PageSections/FunctionishReturnValues.hack +++ b/src/PageSections/FunctionishReturnValues.hack @@ -19,7 +19,7 @@ final class FunctionishReturnValues extends PageSection { <<__Override>> public function getMarkdown(): ?string { $f = $this->definition; - if (!$f instanceof ScannedFunctionish) { + if (!$f is ScannedFunctionish) { return null; } diff --git a/src/PageSections/FunctionishSignature.hack b/src/PageSections/FunctionishSignature.hack index 3b2daba..eb1b5da 100644 --- a/src/PageSections/FunctionishSignature.hack +++ b/src/PageSections/FunctionishSignature.hack @@ -16,7 +16,7 @@ final class FunctionishSignature extends PageSection { <<__Override>> public function getMarkdown(): ?string { $f = $this->definition; - if (!$f instanceof ScannedFunctionish) { + if (!$f is ScannedFunctionish) { return null; } diff --git a/src/PageSections/InterfaceSynopsis.hack b/src/PageSections/InterfaceSynopsis.hack index 265aa58..23f8a4d 100644 --- a/src/PageSections/InterfaceSynopsis.hack +++ b/src/PageSections/InterfaceSynopsis.hack @@ -24,7 +24,7 @@ final class InterfaceSynopsis extends PageSection { <<__Override>> public function getMarkdown(): ?string { $c = $this->definition; - if (!$c instanceof ScannedClassish) { + if (!$c is ScannedClassish) { return null; } @@ -104,13 +104,13 @@ final class InterfaceSynopsis extends PageSection { ScannedMethod $m, ): ?string { $pp = $this->context->getPathProvider(); - if ($c instanceof ScannedClass) { + if ($c is ScannedClass) { return $pp->getPathForClassMethod($c->getName(), $m->getName()); } - if ($c instanceof ScannedInterface) { + if ($c is ScannedInterface) { return $pp->getPathForInterfaceMethod($c->getName(), $m->getName()); } - if ($c instanceof ScannedTrait) { + if ($c is ScannedTrait) { return $pp->getPathForTraitMethod($c->getName(), $m->getName()); } invariant_violation("Don't know how to handle type %s", \get_class($c)); @@ -131,11 +131,11 @@ final class InterfaceSynopsis extends PageSection { $ret .= 'final '; } - if ($c instanceof ScannedClass) { + if ($c is ScannedClass) { $ret .= 'class '; - } else if ($c instanceof ScannedInterface) { + } else if ($c is ScannedInterface) { $ret .= 'interface '; - } else if ($c instanceof ScannedTrait) { + } else if ($c is ScannedTrait) { $ret .= 'trait '; } else { invariant_violation("Don't know what a %s is.", \get_class($c)); diff --git a/src/PageSections/NameHeading.hack b/src/PageSections/NameHeading.hack index 66451db..b31077a 100644 --- a/src/PageSections/NameHeading.hack +++ b/src/PageSections/NameHeading.hack @@ -23,7 +23,7 @@ final class NameHeading extends PageSection { $def = $this->definition; $md .= $def->getName(); - if ($def instanceof ScannedFunctionish) { + if ($def is ScannedFunctionish) { $md .= '()'; } diff --git a/src/PageSections/ShapeFields.hack b/src/PageSections/ShapeFields.hack index e7887ba..1c142a9 100644 --- a/src/PageSections/ShapeFields.hack +++ b/src/PageSections/ShapeFields.hack @@ -19,7 +19,7 @@ final class ShapeFields extends PageSection { public function getMarkdown(): ?string { $t = $this->definition; // Intentionally not documenting opaque type aliases - if (!$t instanceof ScannedType) { + if (!$t is ScannedType) { return null; } $t = $t->getAliasedType(); diff --git a/src/PageSections/TypeDeclaration.hack b/src/PageSections/TypeDeclaration.hack index 9a45550..70155f6 100644 --- a/src/PageSections/TypeDeclaration.hack +++ b/src/PageSections/TypeDeclaration.hack @@ -20,7 +20,7 @@ final class TypeDeclaration extends PageSection { <<__Override>> public function getMarkdown(): ?string { $t = $this->definition; - if (!$t instanceof ScannedTypeish) { + if (!$t is ScannedTypeish) { return null; } return $this->getTypeDeclaration($t); @@ -34,7 +34,7 @@ final class TypeDeclaration extends PageSection { $code .= 'namespace '.$ns.";\n\n"; } - if ($t instanceof ScannedType) { + if ($t is ScannedType) { $code .= 'type '; } else { $code .= 'newtype '; @@ -42,7 +42,7 @@ final class TypeDeclaration extends PageSection { $code .= _Private\ns_normalize_type($ns, $t->getName()); - if ($t instanceof ScannedType) { + if ($t is ScannedType) { $code .= ' = '. _Private\stringify_typehint( $t->getNamespaceName(), diff --git a/src/PageSections/_Private/stringify_functionish_signature.hack b/src/PageSections/_Private/stringify_functionish_signature.hack index d80e05c..6f6644a 100644 --- a/src/PageSections/_Private/stringify_functionish_signature.hack +++ b/src/PageSections/_Private/stringify_functionish_signature.hack @@ -29,7 +29,7 @@ function stringify_functionish_signature( $name = $function->getName(); } - if ($function instanceof ScannedMethod) { + if ($function is ScannedMethod) { if ($function->isAbstract()) { $ret .= 'abstract '; } diff --git a/src/create_index.hack b/src/create_index.hack index 2695572..d2b3c18 100644 --- a/src/create_index.hack +++ b/src/create_index.hack @@ -38,31 +38,31 @@ function create_index( $def = $what['definition']; $name = $def->getName(); - if ($def instanceof ScannedFunction) { + if ($def is ScannedFunction) { $index['functions'][] = $name; continue; } - if ($def instanceof ScannedType) { + if ($def is ScannedType) { $index['types'][] = $name; continue; } - if ($def instanceof ScannedNewtype) { + if ($def is ScannedNewtype) { $index['newtypes'][] = $name; continue; } - if ($def instanceof ScannedClass) { + if ($def is ScannedClass) { if (!C\contains_key($index['classes'], $name)) { $index['classes'][$def->getName()] = keyset[]; } continue; } - if ($def instanceof ScannedInterface) { + if ($def is ScannedInterface) { if (!C\contains_key($index['interfaces'], $name)) { $index['interfaces'][$def->getName()] = keyset[]; } continue; } - if ($def instanceof ScannedTrait) { + if ($def is ScannedTrait) { if (!C\contains_key($index['traits'], $name)) { $index['traits'][$def->getName()] = keyset[]; } @@ -70,7 +70,7 @@ function create_index( } invariant( - $def instanceof ScannedMethod, + $def is ScannedMethod, "Can't handle class %s", \get_class($def), ); @@ -78,21 +78,21 @@ function create_index( $p = $what['parent']; invariant($p !== null, 'got a method with null parent'); $pn = $p->getName(); - if ($p instanceof ScannedClass) { + if ($p is ScannedClass) { if (!C\contains_key($index['classes'], $pn)) { $index['classes'][$pn] = keyset[]; } $index['classes'][$pn][] = $name; continue; } - if ($p instanceof ScannedInterface) { + if ($p is ScannedInterface) { if (!C\contains_key($index['interfaces'], $pn)) { $index['interfaces'][$pn] = keyset[]; } $index['interfaces'][$pn][] = $name; continue; } - if ($p instanceof ScannedTrait) { + if ($p is ScannedTrait) { if (!C\contains_key($index['traits'], $pn)) { $index['traits'][$pn] = keyset[]; } diff --git a/src/from_parser.hack b/src/from_parser.hack index 91fba16..01ed1e9 100644 --- a/src/from_parser.hack +++ b/src/from_parser.hack @@ -41,7 +41,7 @@ function from_parser(BaseParser $parser): vec { $top_level, $data ==> { $class = $data['definition']; - if (!$class instanceof ScannedClassish) { + if (!$class is ScannedClassish) { return vec[]; } diff --git a/src/get_path_for_documentable.hack b/src/get_path_for_documentable.hack index 1819cf4..97f935a 100644 --- a/src/get_path_for_documentable.hack +++ b/src/get_path_for_documentable.hack @@ -24,34 +24,34 @@ function get_path_for_documentable( Documentable $what, ): ?string { $def = $what['definition']; - if ($def instanceof ScannedClass) { + if ($def is ScannedClass) { return $provider->getPathForClass($def->getName()); } - if ($def instanceof ScannedInterface) { + if ($def is ScannedInterface) { return $provider->getPathForInterface($def->getName()); } - if ($def instanceof ScannedTrait) { + if ($def is ScannedTrait) { return $provider->getPathForTrait($def->getName()); } - if ($def instanceof ScannedFunction) { + if ($def is ScannedFunction) { return $provider->getPathForFunction($def->getName()); } - if ($def instanceof ScannedType) { + if ($def is ScannedType) { return $provider->getPathForTransparentTypeAlias($def->getName()); } - if ($def instanceof ScannedNewtype) { + if ($def is ScannedNewtype) { return $provider->getPathForOpaqueTypeAlias($def->getName()); } - if ($def instanceof ScannedMethod) { + if ($def is ScannedMethod) { $p = $what['parent']; - if ($p instanceof ScannedClass) { + if ($p is ScannedClass) { return $provider->getPathForClassMethod($p->getName(), $def->getName()); } - if ($p instanceof ScannedInterface) { + if ($p is ScannedInterface) { return $provider->getPathForInterfaceMethod($p->getName(), $def->getName()); } - if ($p instanceof ScannedTrait) { + if ($p is ScannedTrait) { return $provider->getPathForTraitMethod($p->getName(), $def->getName()); } }