Skip to content

Commit 7d584c4

Browse files
committed
Add tests for modifiers on record parameters
See #7 (comment)
1 parent 61ba9b1 commit 7d584c4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/php/lang/ast/syntax/php/Records.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function setup($language, $emitter) {
9292
foreach ($node->components as $c) {
9393
$l= $c->line;
9494

95-
$modifiers= $c->promote ?? 'private';
95+
$modifiers= null === $c->promote ? ['private'] : explode(' ', $c->promote);
9696
$c->promote= null;
9797
$signature->parameters[]= $c;
9898

@@ -102,7 +102,7 @@ public function setup($language, $emitter) {
102102

103103
// Property declaration + accessor method
104104
$type= $c->variadic ? ($c->type ? new IsArray($c->type) : new IsLiteral('array')) : $c->type;
105-
$body[]= new Property([$modifiers], $c->name, $type, null, [], null, $l);
105+
$body[]= new Property($modifiers, $c->name, $type, null, [], null, $l);
106106
$body[]= new Method(['public'], $c->name, new Signature([], $type), [new ReturnStatement($r, $l)]);
107107

108108
// Code for string representation, hashcode and comparison

0 commit comments

Comments
 (0)