magento-coding-standard
magento-coding-standard copied to clipboard
Fix Class Property DocBlock sniff for union/intersection types
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.
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.
@ihor-sviziev any chance of merging this? The problem literally prevents some developers from using the supported PHP versions' typing system to its full extent, forcing us to fall back to PhpDocs and redundant conditionals if we need to pass CI tests...
Nevermind, let's forgo supported versions and leave the developers to their own devices...
@sidolov @engcom-Hotel any chanse we can merge it?
@ihor-sviziev @sidolov if there's any chance to merge for a new release, I'd be glad to hear from you if there's anything that should be changed, reopen the PR and work on it again, since it was opened over 8 months ago and by now there could be some conflicts...