diff --git a/src/printer-php.js b/src/printer-php.js index 967453efe561..5919278261c2 100644 --- a/src/printer-php.js +++ b/src/printer-php.js @@ -309,7 +309,29 @@ function printStatement(node) { switch (node.kind) { case "class": return concat([ - group(concat(["class ", node.name, " {"])), + group( + concat([ + node.isAbstract ? "abstract " : "", + node.isFinal ? "final " : "", + "class ", + node.name, + indent( + concat([ + node.extends + ? concat([line, "extends ", printNode(node.extends)]) + : "", + node.implements + ? concat([ + line, + "implements ", + join(", ", node.implements.map(printNode)) + ]) + : "" + ]) + ), + " {" + ]) + ), hardline, indent( concat(node.body.map(child => concat([hardline, printNode(child)]))) diff --git a/tests/php_class/__snapshots__/jsfmt.spec.js.snap b/tests/php_class/__snapshots__/jsfmt.spec.js.snap index 23600c3904ad..9c01deffe05c 100644 --- a/tests/php_class/__snapshots__/jsfmt.spec.js.snap +++ b/tests/php_class/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`class.php 1`] = ` +exports[`class.php - php-verify: class.php 1`] = `