Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Class Property DocBlock sniff for union/intersection types #483

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

CRC-Mismatch
Copy link

@CRC-Mismatch CRC-Mismatch commented Jul 31, 2024

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
Copy link
Author

CRC-Mismatch commented Sep 18, 2024

@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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Reviewer Approved
Development

Successfully merging this pull request may close these issues.

4 participants