diff vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents c2387f117808
children
line wrap: on
line diff
--- a/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php	Thu Feb 28 13:21:36 2019 +0000
@@ -260,6 +260,10 @@
         return $this->pInfixOp(AssignOp\Pow::class, $node->var, ' **= ', $node->expr);
     }
 
+    protected function pExpr_AssignOp_Coalesce(AssignOp\Coalesce $node) {
+        return $this->pInfixOp(AssignOp\Coalesce::class, $node->var, ' ??= ', $node->expr);
+    }
+
     // Binary expressions
 
     protected function pExpr_BinaryOp_Plus(BinaryOp\Plus $node) {
@@ -435,7 +439,15 @@
     }
 
     protected function pExpr_Cast_Double(Cast\Double $node) {
-        return $this->pPrefixOp(Cast\Double::class, '(double) ', $node->expr);
+        $kind = $node->getAttribute('kind', Cast\Double::KIND_DOUBLE);
+        if ($kind === Cast\Double::KIND_DOUBLE) {
+            $cast = '(double)';
+        } elseif ($kind === Cast\Double::KIND_FLOAT) {
+            $cast = '(float)';
+        } elseif ($kind === Cast\Double::KIND_REAL) {
+            $cast = '(real)';
+        }
+        return $this->pPrefixOp(Cast\Double::class, $cast . ' ', $node->expr);
     }
 
     protected function pExpr_Cast_String(Cast\String_ $node) {
@@ -680,7 +692,9 @@
     }
 
     protected function pStmt_Property(Stmt\Property $node) {
-        return (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags)) . $this->pCommaSeparated($node->props) . ';';
+        return (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags))
+            . ($node->type ? $this->p($node->type) . ' ' : '')
+            . $this->pCommaSeparated($node->props) . ';';
     }
 
     protected function pStmt_PropertyProperty(Stmt\PropertyProperty $node) {