@@ -49,9 +49,7 @@ class Foo
49
49
public ReAdOnLy string $ caseInsensitiveProperty ;
50
50
51
51
/* testReadonlyConstructorPropertyPromotion */
52
- public function __construct (private readonly bool $ constructorPropertyPromotion )
53
- {
54
- }
52
+ public function __construct (private readonly bool $ constructorPropertyPromotion ) {}
55
53
56
54
/* testReadonlyConstructorPropertyPromotionWithReference */
57
55
public function __construct (private ReadOnly bool &$ constructorPropertyPromotion ) {}
@@ -68,8 +66,6 @@ class ClassName {
68
66
69
67
/* testReadonlyUsedAsMethodName */
70
68
public function readonly () {
71
- // Do something.
72
-
73
69
/* testReadonlyUsedAsPropertyName */
74
70
$ this ->readonly = 'foo ' ;
75
71
@@ -79,16 +75,27 @@ class ClassName {
79
75
}
80
76
81
77
/* testReadonlyUsedAsFunctionName */
82
- function readonly ()
83
- {
84
- }
78
+ function readonly () {}
79
+
80
+ /* testReadonlyUsedAsFunctionNameWithReturnByRef */
81
+ function &readonly () {}
85
82
86
83
/* testReadonlyUsedAsNamespaceName */
87
84
namespace Readonly ;
88
85
/* testReadonlyUsedAsPartOfNamespaceName */
89
86
namespace My \Readonly \Collection ;
90
87
/* testReadonlyAsFunctionCall */
91
88
$ var = readonly ($ a , $ b );
89
+ /* testReadonlyAsNamespacedFunctionCall */
90
+ $ var = My \NS \readonly ($ a , $ b );
91
+ /* testReadonlyAsNamespaceRelativeFunctionCall */
92
+ $ var = namespace \ReadOnly ($ a , $ b );
93
+ /* testReadonlyAsMethodCall */
94
+ $ var = $ obj ->readonly ($ a , $ b );
95
+ /* testReadonlyAsNullsafeMethodCall */
96
+ $ var = $ obj ?->readOnly($ a , $ b );
97
+ /* testReadonlyAsStaticMethodCallWithSpace */
98
+ $ var = ClassName::readonly ($ a , $ b );
92
99
/* testClassConstantFetchWithReadonlyAsConstantName */
93
100
echo ClassName::READONLY ;
94
101
0 commit comments