Skip to content

Conversation

@dereuromark
Copy link
Contributor

Summary

  • Adds collectMultiLineType() and parseCollectedTypeContent() helper methods to CommentingTrait for parsing type annotations that span multiple lines
  • Updates DocBlockParamSniff to detect and properly handle multi-line array shape annotations
  • Adds test cases covering various multi-line scenarios (nested generics, array shapes with multiple fields, mixed single and multi-line params)

This allows PHPDoc annotations like:

/**
 * @param array<string, array{
 *   msgid: string,
 *   msgid_plural: string|null,
 *   msgctxt: string|null,
 *   references: array<string>,
 *   comments: array<string>
 * }> $strings Extracted strings
 */

Test plan

  • Run existing DocBlockParamSniffTest - passes
  • Run composer cs-check - passes
  • Run composer stan - passes
  • Run composer test - all 82 tests pass

🤖 Generated with Claude Code

Adds helper methods to CommentingTrait for collecting type annotations
that span multiple lines (e.g., complex array shapes with nested structures).
Updates DocBlockParamSniff to use this functionality, allowing it to
correctly parse multi-line PHPDoc types like:

@param array<string, array{
  msgid: string,
  msgid_plural: string|null,
  references: array<string>
}> $strings

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dereuromark dereuromark merged commit 0773620 into master Nov 22, 2025
4 checks passed
@dereuromark dereuromark deleted the feature/multiline-array-shape-support branch November 22, 2025 21:29
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