From 9c2ca35b8463bc02082730e6ab04234e5f0bd210 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 24 Aug 2024 09:09:48 +0200 Subject: [PATCH] ObjectDeclarations::getDeclaredProperties(): improve documentation Add a note about constructor promoted properties being included in the return value. --- PHPCSUtils/Utils/ObjectDeclarations.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PHPCSUtils/Utils/ObjectDeclarations.php b/PHPCSUtils/Utils/ObjectDeclarations.php index de5dc56c..478c5c77 100644 --- a/PHPCSUtils/Utils/ObjectDeclarations.php +++ b/PHPCSUtils/Utils/ObjectDeclarations.php @@ -433,8 +433,13 @@ public static function getDeclaredEnumCases(File $phpcsFile, $stackPtr) /** * Retrieve all properties declared in an OO structure. * - * Note: interfaces and enums cannot contain properties. This method does not take this into - * account to allow sniffs to flag this kind of incorrect PHP code. + * Notes: + * - Properties declared via PHP 8.0+ contructor property promotion **will** be included + * in the return value. + * However, keep in mind that passing the stack pointer of such a property to the + * {@see Variables::getMemberProperties()} method is not supported. + * - Interfaces and enums cannot contain properties. This method does not take this into + * account to allow sniffs to flag this kind of incorrect PHP code. * * @since 1.1.0 *