@@ -49,9 +49,7 @@ class Foo
4949 public ReAdOnLy string $ caseInsensitiveProperty ;
5050
5151 /* testReadonlyConstructorPropertyPromotion */
52- public function __construct (private readonly bool $ constructorPropertyPromotion )
53- {
54- }
52+ public function __construct (private readonly bool $ constructorPropertyPromotion ) {}
5553
5654 /* testReadonlyConstructorPropertyPromotionWithReference */
5755 public function __construct (private ReadOnly bool &$ constructorPropertyPromotion ) {}
@@ -68,8 +66,6 @@ class ClassName {
6866
6967 /* testReadonlyUsedAsMethodName */
7068 public function readonly () {
71- // Do something.
72-
7369 /* testReadonlyUsedAsPropertyName */
7470 $ this ->readonly = 'foo ' ;
7571
@@ -79,16 +75,27 @@ class ClassName {
7975}
8076
8177/* testReadonlyUsedAsFunctionName */
82- function readonly ()
83- {
84- }
78+ function readonly () {}
79+
80+ /* testReadonlyUsedAsFunctionNameWithReturnByRef */
81+ function &readonly () {}
8582
8683/* testReadonlyUsedAsNamespaceName */
8784namespace Readonly ;
8885/* testReadonlyUsedAsPartOfNamespaceName */
8986namespace My \Readonly \Collection ;
9087/* testReadonlyAsFunctionCall */
9188$ 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 );
9299/* testClassConstantFetchWithReadonlyAsConstantName */
93100echo ClassName::READONLY ;
94101
0 commit comments