File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -1811,13 +1811,15 @@ public function getMemberProperties($stackPtr)
1811
1811
T_PROTECTED => T_PROTECTED ,
1812
1812
T_STATIC => T_STATIC ,
1813
1813
T_VAR => T_VAR ,
1814
+ T_READONLY => T_READONLY ,
1814
1815
];
1815
1816
1816
1817
$ valid += Util \Tokens::$ emptyTokens ;
1817
1818
1818
1819
$ scope = 'public ' ;
1819
1820
$ scopeSpecified = false ;
1820
1821
$ isStatic = false ;
1822
+ $ isReadonly = false ;
1821
1823
1822
1824
$ startOfStatement = $ this ->findPrevious (
1823
1825
[
@@ -1850,6 +1852,9 @@ public function getMemberProperties($stackPtr)
1850
1852
case T_STATIC :
1851
1853
$ isStatic = true ;
1852
1854
break ;
1855
+ case T_READONLY :
1856
+ $ isReadonly = true ;
1857
+ break ;
1853
1858
}
1854
1859
}//end for
1855
1860
@@ -1901,6 +1906,7 @@ public function getMemberProperties($stackPtr)
1901
1906
'scope ' => $ scope ,
1902
1907
'scope_specified ' => $ scopeSpecified ,
1903
1908
'is_static ' => $ isStatic ,
1909
+ 'is_readonly ' => $ isReadonly ,
1904
1910
'type ' => $ type ,
1905
1911
'type_token ' => $ typeToken ,
1906
1912
'type_end_token ' => $ typeEndToken ,
Original file line number Diff line number Diff line change @@ -239,6 +239,11 @@ $anon = class() {
239
239
/* testPHP8DuplicateTypeInUnionWhitespaceAndComment */
240
240
// Intentional fatal error - duplicate types are not allowed in union types, but that's not the concern of the method.
241
241
public int |string| /*comment*/ INT $ duplicateTypeInUnion ;
242
+
243
+ /* testPHP81NotReadonly */
244
+ private string $ notReadonly ;
245
+ /* testPHP81Readonly */
246
+ public readonly int $ readonly ;
242
247
};
243
248
244
249
$ anon = class {
Original file line number Diff line number Diff line change @@ -610,6 +610,28 @@ public function dataGetMemberProperties()
610
610
'nullable_type ' => false ,
611
611
],
612
612
],
613
+ [
614
+ '/* testPHP81NotReadonly */ ' ,
615
+ [
616
+ 'scope ' => 'private ' ,
617
+ 'scope_specified ' => true ,
618
+ 'is_static ' => false ,
619
+ 'is_readonly ' => false ,
620
+ 'type ' => 'string ' ,
621
+ 'nullable_type ' => false ,
622
+ ],
623
+ ],
624
+ [
625
+ '/* testPHP81Readonly */ ' ,
626
+ [
627
+ 'scope ' => 'public ' ,
628
+ 'scope_specified ' => true ,
629
+ 'is_static ' => false ,
630
+ 'is_readonly ' => true ,
631
+ 'type ' => 'int ' ,
632
+ 'nullable_type ' => false ,
633
+ ],
634
+ ],
613
635
[
614
636
'/* testPHP8PropertySingleAttribute */ ' ,
615
637
[
You can’t perform that action at this time.
0 commit comments