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)
18111811 T_PROTECTED => T_PROTECTED ,
18121812 T_STATIC => T_STATIC ,
18131813 T_VAR => T_VAR ,
1814+ T_READONLY => T_READONLY ,
18141815 ];
18151816
18161817 $ valid += Util \Tokens::$ emptyTokens ;
18171818
18181819 $ scope = 'public ' ;
18191820 $ scopeSpecified = false ;
18201821 $ isStatic = false ;
1822+ $ isReadonly = false ;
18211823
18221824 $ startOfStatement = $ this ->findPrevious (
18231825 [
@@ -1850,6 +1852,9 @@ public function getMemberProperties($stackPtr)
18501852 case T_STATIC :
18511853 $ isStatic = true ;
18521854 break ;
1855+ case T_READONLY :
1856+ $ isReadonly = true ;
1857+ break ;
18531858 }
18541859 }//end for
18551860
@@ -1901,6 +1906,7 @@ public function getMemberProperties($stackPtr)
19011906 'scope ' => $ scope ,
19021907 'scope_specified ' => $ scopeSpecified ,
19031908 'is_static ' => $ isStatic ,
1909+ 'is_readonly ' => $ isReadonly ,
19041910 'type ' => $ type ,
19051911 'type_token ' => $ typeToken ,
19061912 'type_end_token ' => $ typeEndToken ,
Original file line number Diff line number Diff line change @@ -239,6 +239,11 @@ $anon = class() {
239239 /* testPHP8DuplicateTypeInUnionWhitespaceAndComment */
240240 // Intentional fatal error - duplicate types are not allowed in union types, but that's not the concern of the method.
241241 public int |string| /*comment*/ INT $ duplicateTypeInUnion ;
242+
243+ /* testPHP81NotReadonly */
244+ private string $ notReadonly ;
245+ /* testPHP81Readonly */
246+ public readonly int $ readonly ;
242247};
243248
244249$ anon = class {
Original file line number Diff line number Diff line change @@ -610,6 +610,28 @@ public function dataGetMemberProperties()
610610 'nullable_type ' => false ,
611611 ],
612612 ],
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+ ],
613635 [
614636 '/* testPHP8PropertySingleAttribute */ ' ,
615637 [
You can’t perform that action at this time.
0 commit comments