magento-coding-standard icon indicating copy to clipboard operation
magento-coding-standard copied to clipboard

Fix Class Property DocBlock sniff for union/intersection types

Open CRC-Mismatch opened this issue 6 months ago • 1 comments

Since PHP_CodeSniffer 3.7.0, there's a separate token T_TYPE_INTERSECTION for the & type-intersection specifier, instead of using the same T_BITWISE_AND token for both type intersections and the bitwise operator. Due to this, the Magento2.Commenting.ClassPropertyPHPDocFormatting sniff fails to detect the DocBlock for intersection-typed properties in projects that use newer versions.

image

Also, since PHP 8.2 added support for DNF types, two new tokens were added to PHP_CodeSniffer in 3.10.0 for the parentheses.

This PR proposes pinning the minimum PHP_CodeSniffer version to ^3.10.0 in order to fully support the newer DNF types, while also fixing the sniff's allowed tokens to correctly detect DocBlocks for intersection-typed properties.

CRC-Mismatch avatar Jul 31 '24 12:07 CRC-Mismatch