@@ -1315,10 +1315,12 @@ public function getDeclarationName($stackPtr)
1315
1315
* 'default_equal_token' => integer, // The stack pointer to the equals sign.
1316
1316
*
1317
1317
* Parameters declared using PHP 8 constructor property promotion, have these additional array indexes:
1318
- * 'property_visibility' => string, // The property visibility as declared.
1319
- * 'visibility_token' => integer, // The stack pointer to the visibility modifier token.
1320
- * 'property_readonly' => bool, // TRUE if the readonly keyword was found.
1321
- * 'readonly_token' => integer, // The stack pointer to the readonly modifier token.
1318
+ * 'property_visibility' => string, // The property visibility as declared.
1319
+ * 'visibility_token' => integer|false, // The stack pointer to the visibility modifier token
1320
+ * // or FALSE if the visibility is not explicitly declared.
1321
+ * 'property_readonly' => boolean, // TRUE if the readonly keyword was found.
1322
+ * 'readonly_token' => integer, // The stack pointer to the readonly modifier token.
1323
+ * // This index will only be set if the property is readonly.
1322
1324
*
1323
1325
* @param int $stackPtr The position in the stack of the function token
1324
1326
* to acquire the parameters for.
@@ -1536,15 +1538,20 @@ public function getMethodParameters($stackPtr)
1536
1538
$ vars [$ paramCount ]['type_hint_end_token ' ] = $ typeHintEndToken ;
1537
1539
$ vars [$ paramCount ]['nullable_type ' ] = $ nullableType ;
1538
1540
1539
- if ($ visibilityToken !== null ) {
1540
- $ vars [$ paramCount ]['property_visibility ' ] = $ this -> tokens [ $ visibilityToken ][ ' content ' ] ;
1541
- $ vars [$ paramCount ]['visibility_token ' ] = $ visibilityToken ;
1541
+ if ($ visibilityToken !== null || $ readonlyToken !== null ) {
1542
+ $ vars [$ paramCount ]['property_visibility ' ] = ' public ' ;
1543
+ $ vars [$ paramCount ]['visibility_token ' ] = false ;
1542
1544
$ vars [$ paramCount ]['property_readonly ' ] = false ;
1543
- }
1544
1545
1545
- if ($ readonlyToken !== null ) {
1546
- $ vars [$ paramCount ]['property_readonly ' ] = true ;
1547
- $ vars [$ paramCount ]['readonly_token ' ] = $ readonlyToken ;
1546
+ if ($ visibilityToken !== null ) {
1547
+ $ vars [$ paramCount ]['property_visibility ' ] = $ this ->tokens [$ visibilityToken ]['content ' ];
1548
+ $ vars [$ paramCount ]['visibility_token ' ] = $ visibilityToken ;
1549
+ }
1550
+
1551
+ if ($ readonlyToken !== null ) {
1552
+ $ vars [$ paramCount ]['property_readonly ' ] = true ;
1553
+ $ vars [$ paramCount ]['readonly_token ' ] = $ readonlyToken ;
1554
+ }
1548
1555
}
1549
1556
1550
1557
if ($ this ->tokens [$ i ]['code ' ] === T_COMMA ) {
0 commit comments