diff --git a/lib/PhpParser/PrettyPrinter/Standard.php b/lib/PhpParser/PrettyPrinter/Standard.php index 46cebce..45fe741 100644 --- a/lib/PhpParser/PrettyPrinter/Standard.php +++ b/lib/PhpParser/PrettyPrinter/Standard.php @@ -98,7 +98,7 @@ class Standard extends PrettyPrinterAbstract $stringValue = (string) $node->value; // ensure that number is really printed as float - return ctype_digit($stringValue) ? $stringValue . '.0' : $stringValue; + return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue; } // Assignments @@ -735,4 +735,4 @@ class Standard extends PrettyPrinterAbstract return $this->p($node); } } -} \ No newline at end of file +} diff --git a/test/code/prettyPrinter/numbers.test b/test/code/prettyPrinter/numbers.test new file mode 100644 index 0000000..292919b --- /dev/null +++ b/test/code/prettyPrinter/numbers.test @@ -0,0 +1,35 @@ +Number literals +----- +