Skip to content

Commit 30afeb8

Browse files
committed
Fix readonly property type (#178)
1 parent 86e643b commit 30afeb8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Languages/Php/Patterns/PropertyTypesPattern.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#[PatternTest(input: 'public Bar $bar', output: 'Bar')]
1313
#[PatternTest(input: 'protected Bar $bar', output: 'Bar')]
1414
#[PatternTest(input: 'private Bar $bar', output: 'Bar')]
15+
#[PatternTest(input: 'private readonly Bar $bar', output: 'Bar')]
16+
#[PatternTest(input: 'public readonly Bar $bar', output: 'Bar')]
17+
#[PatternTest(input: 'protected readonly Bar $bar', output: 'Bar')]
1518
#[PatternTest(input: 'public Foo|Bar $bar', output: 'Foo|Bar')]
1619
#[PatternTest(input: 'public Foo|Bar&Baz $bar', output: 'Foo|Bar&Baz')]
1720
#[PatternTest(input: 'public (Bar&Baz)|null $bar', output: '(Bar&Baz)|null')]
@@ -29,7 +32,7 @@
2932

3033
public function getPattern(): string
3134
{
32-
return '(public|private|protected)(\s*static\s*)?(\s*\((get|set)\)\s*)?(\s(?<match>[^\s]*)) (\$[\w]+)';
35+
return '(public|private|protected)(\s*readonly\s*)?(\s*static\s*)?(\s*\((get|set)\)\s*)?(\s(?<match>[^\s]*)) (\$[\w]+)';
3336
}
3437

3538
public function getTokenType(): TokenTypeEnum

0 commit comments

Comments
 (0)