From cf43987202e6f3cf9ecd7dc933296eaa97a9ed41 Mon Sep 17 00:00:00 2001 From: Sandip Chandela <49310430+sandipklevu@users.noreply.github.com> Date: Wed, 24 May 2023 11:57:37 +0530 Subject: [PATCH 1/2] allow readonly between phpdoc and property name --- .../Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php index 3732e2ac..0913be26 100644 --- a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php @@ -32,6 +32,7 @@ class ClassPropertyPHPDocFormattingSniff extends AbstractVariableSniff T_NULLABLE, T_BITWISE_AND, T_TYPE_UNION, + T_READONLY, ]; /** From 889b4d21076d2ddef54d948c63688770a6449310 Mon Sep 17 00:00:00 2001 From: sandip Date: Mon, 12 Jun 2023 15:42:27 +0530 Subject: [PATCH 2/2] Add test case for readonly property --- .../ClassPropertyPHPDocFormattingUnitTest.inc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc index cde71269..aca8a73b 100644 --- a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc +++ b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc @@ -200,4 +200,14 @@ class correctlyFormattedClassMemberDocBlock * @deprecated This property will be removed in version 1.0.0 without replacement */ protected string $deprecatedWithKeyword; + + /** + * @var string + */ + protected readonly string $readOnlyString; + + /** + * @var int + */ + protected readonly int $readOnlyInteger; }