comparison 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
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
258 258
259 protected function pExpr_AssignOp_Pow(AssignOp\Pow $node) { 259 protected function pExpr_AssignOp_Pow(AssignOp\Pow $node) {
260 return $this->pInfixOp(AssignOp\Pow::class, $node->var, ' **= ', $node->expr); 260 return $this->pInfixOp(AssignOp\Pow::class, $node->var, ' **= ', $node->expr);
261 } 261 }
262 262
263 protected function pExpr_AssignOp_Coalesce(AssignOp\Coalesce $node) {
264 return $this->pInfixOp(AssignOp\Coalesce::class, $node->var, ' ??= ', $node->expr);
265 }
266
263 // Binary expressions 267 // Binary expressions
264 268
265 protected function pExpr_BinaryOp_Plus(BinaryOp\Plus $node) { 269 protected function pExpr_BinaryOp_Plus(BinaryOp\Plus $node) {
266 return $this->pInfixOp(BinaryOp\Plus::class, $node->left, ' + ', $node->right); 270 return $this->pInfixOp(BinaryOp\Plus::class, $node->left, ' + ', $node->right);
267 } 271 }
433 protected function pExpr_Cast_Int(Cast\Int_ $node) { 437 protected function pExpr_Cast_Int(Cast\Int_ $node) {
434 return $this->pPrefixOp(Cast\Int_::class, '(int) ', $node->expr); 438 return $this->pPrefixOp(Cast\Int_::class, '(int) ', $node->expr);
435 } 439 }
436 440
437 protected function pExpr_Cast_Double(Cast\Double $node) { 441 protected function pExpr_Cast_Double(Cast\Double $node) {
438 return $this->pPrefixOp(Cast\Double::class, '(double) ', $node->expr); 442 $kind = $node->getAttribute('kind', Cast\Double::KIND_DOUBLE);
443 if ($kind === Cast\Double::KIND_DOUBLE) {
444 $cast = '(double)';
445 } elseif ($kind === Cast\Double::KIND_FLOAT) {
446 $cast = '(float)';
447 } elseif ($kind === Cast\Double::KIND_REAL) {
448 $cast = '(real)';
449 }
450 return $this->pPrefixOp(Cast\Double::class, $cast . ' ', $node->expr);
439 } 451 }
440 452
441 protected function pExpr_Cast_String(Cast\String_ $node) { 453 protected function pExpr_Cast_String(Cast\String_ $node) {
442 return $this->pPrefixOp(Cast\String_::class, '(string) ', $node->expr); 454 return $this->pPrefixOp(Cast\String_::class, '(string) ', $node->expr);
443 } 455 }
678 . (null !== $node->newName ? ' ' . $node->newName : '') 690 . (null !== $node->newName ? ' ' . $node->newName : '')
679 . ';'; 691 . ';';
680 } 692 }
681 693
682 protected function pStmt_Property(Stmt\Property $node) { 694 protected function pStmt_Property(Stmt\Property $node) {
683 return (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags)) . $this->pCommaSeparated($node->props) . ';'; 695 return (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags))
696 . ($node->type ? $this->p($node->type) . ' ' : '')
697 . $this->pCommaSeparated($node->props) . ';';
684 } 698 }
685 699
686 protected function pStmt_PropertyProperty(Stmt\PropertyProperty $node) { 700 protected function pStmt_PropertyProperty(Stmt\PropertyProperty $node) {
687 return '$' . $node->name 701 return '$' . $node->name
688 . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); 702 . (null !== $node->default ? ' = ' . $this->p($node->default) : '');