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

Added support for array multi line function comments #3687

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

Conversation

martinssipenko
Copy link
Contributor

This change adds the ability to define array structures over several lines.

Background:

PHPStan allows using array shapes that can quickly turn into very long comment lines and this change allows them to be broken over several lines for readability purposes without having to disable the given Sniff.

/**
 * @param array<array{
 *            foo: array{foo: int},
 *            bar: int
 *        }> $bb B.
 */
public function multiLineArray(array $bb)
{
}

Before:

Would result in Squiz.Commenting.FunctionComment.MissingParamName or Squiz.Commenting.FunctionComment.MissingParamTag or similar errors.

And the doc block would need to be written as:

/**
 * @param array<array{foo: array{foo: int}, bar: int}> $bb B.
 */

After:

No errors are being reported.

@martinssipenko martinssipenko marked this pull request as ready for review October 7, 2022 15:08
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.

1 participant