mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-01-17 15:18:17 +01:00
Fix pretty printing of whole-numbered floats
This time properly. Only remaining problem is that floats like 1e1000 are printed as INF. This may or may not be acceptable. The value will be the same, but the tests will signal a diff failure.
This commit is contained in:
parent
b77d66e5bd
commit
7078252444
@ -78,9 +78,10 @@ class PHPParser_PrettyPrinter_Zend extends PHPParser_PrettyPrinterAbstract
|
||||
}
|
||||
|
||||
public function pScalar_DNumber(PHPParser_Node_Scalar_DNumber $node) {
|
||||
return (string) (int) $node->value == (string) $node->value
|
||||
? (string) $node->value . '.0' // ensure that number is really printed as float
|
||||
: (string) $node->value;
|
||||
$stringValue = (string) $node->value;
|
||||
|
||||
// ensure that number is really printed as float
|
||||
return ctype_digit($stringValue) ? $stringValue . '.0' : $stringValue;
|
||||
}
|
||||
|
||||
// Assignments
|
||||
|
Loading…
x
Reference in New Issue
Block a user