Skip to content

Fix Extra @param found in method annotation with PHP Attributes#500

Open
danielfilipek-ug wants to merge 1 commit intomagento:developfrom
danielfilipek-ug:patch-1
Open

Fix Extra @param found in method annotation with PHP Attributes#500
danielfilipek-ug wants to merge 1 commit intomagento:developfrom
danielfilipek-ug:patch-1

Conversation

@danielfilipek-ug
Copy link
Copy Markdown

The getMethodArguments method in Magento Coding Standard was incorrectly counting PHP constructor arguments when PHP attributes (e.g., #[SerializedName('created_at')]) were present.

The sniffer would stop counting parameters after encountering an attribute, resulting in incorrect code validations and false errors in the quality control system.

 The getMethodArguments method in Magento Coding Standard was incorrectly counting PHP constructor arguments when PHP attributes (e.g.,
  #[SerializedName('created_at')]) were present. The sniffer would stop counting parameters after encountering an attribute, resulting in incorrect
   code validations and false errors in the quality control system.
@fredden
Copy link
Copy Markdown
Member

fredden commented Aug 29, 2025

This looks like a complicated sniff. I expect it can be simplified by using the 'owner' detail that PHP_CodeSniffer provides to find the open/close parenthesis.

These properties may help for someone who wants to explore this further:
https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/ca606d9f60838b9a96ceb12dec7b935d5d64efce/src/Tokenizers/PHP.php#L2879-L2883

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants