php8.1: added readonly modifier (#6)
This commit is contained in:
@@ -147,7 +147,7 @@ func (p *printer) Nullable(n *ast.Nullable) {
|
||||
|
||||
func (p *printer) Parameter(n *ast.Parameter) {
|
||||
p.printList(n.AttrGroups)
|
||||
p.printNode(n.Visibility)
|
||||
p.printList(n.Modifiers)
|
||||
p.printNode(n.Type)
|
||||
p.printToken(n.AmpersandTkn, nil)
|
||||
p.printToken(n.VariadicTkn, nil)
|
||||
|
||||
25
pkg/visitor/printer/printer_php8_1_test.go
Normal file
25
pkg/visitor/printer/printer_php8_1_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package printer_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/VKCOM/php-parser/internal/tester"
|
||||
)
|
||||
|
||||
func TestParseAndPrintReadonlyModifierPHP81(t *testing.T) {
|
||||
tester.NewParserPrintTestSuite(t).UsePHP8().Run(`<?php
|
||||
class Foo {
|
||||
readonly string $a;
|
||||
private readonly string $a;
|
||||
private string $a;
|
||||
private readonly $a = 100;
|
||||
|
||||
public function __construct(
|
||||
readonly string $a,
|
||||
private readonly string $a,
|
||||
private string $a,
|
||||
private readonly $a = 100,
|
||||
) {}
|
||||
}
|
||||
`)
|
||||
}
|
||||
Reference in New Issue
Block a user