From 5219f7571913f8063de224b231df19ac892645f3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 6 Dec 2016 12:26:21 +0100 Subject: [PATCH] Fix pretty-printing of nullable types --- lib/PhpParser/PrettyPrinter/Standard.php | 2 +- test/PhpParser/NodeVisitor/NameResolverTest.php | 2 +- test/code/prettyPrinter/stmt/nullable_types.test | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/PhpParser/PrettyPrinter/Standard.php b/lib/PhpParser/PrettyPrinter/Standard.php index 6347516..52b1148 100644 --- a/lib/PhpParser/PrettyPrinter/Standard.php +++ b/lib/PhpParser/PrettyPrinter/Standard.php @@ -34,7 +34,7 @@ class Standard extends PrettyPrinterAbstract } protected function pNullableType(Node\NullableType $node) { - return '?' . $node->type; + return '?' . $this->pType($node->type); } // Names diff --git a/test/PhpParser/NodeVisitor/NameResolverTest.php b/test/PhpParser/NodeVisitor/NameResolverTest.php index 536f6e1..a9c6cb5 100644 --- a/test/PhpParser/NodeVisitor/NameResolverTest.php +++ b/test/PhpParser/NodeVisitor/NameResolverTest.php @@ -244,7 +244,7 @@ function fn2(array $a) : array } function (\NS\A $a) : \NS\A { }; -function fn3(?NS\A $a) : ?NS\A +function fn3(?\NS\A $a) : ?\NS\A { } function fn4(?array $a) : ?array diff --git a/test/code/prettyPrinter/stmt/nullable_types.test b/test/code/prettyPrinter/stmt/nullable_types.test index 3db3b4b..6a40e20 100644 --- a/test/code/prettyPrinter/stmt/nullable_types.test +++ b/test/code/prettyPrinter/stmt/nullable_types.test @@ -1,11 +1,11 @@ Nullable types -----