Merge branch '3.x'

This commit is contained in:
Nikita Popov 2017-07-19 17:14:23 +02:00
commit d11ef05aaf
2 changed files with 5 additions and 1 deletions

View File

@ -8,7 +8,6 @@ class Name extends NodeAbstract
{
/**
* @var string[] Parts of the name
* @deprecated Avoid directly accessing $parts, use methods instead.
*/
public $parts;

View File

@ -190,6 +190,11 @@ class Standard extends PrettyPrinterAbstract
$stringValue = sprintf('%.17G', $node->value);
}
// %G is locale dependent and there exists no locale-independent alternative. We don't want
// mess with switching locales here, so let's assume that a comma is the only non-standard
// decimal separator we may encounter...
$stringValue = str_replace(',', '.', $stringValue);
// ensure that number is really printed as float
return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue;
}