Skip to content

Bug: Error parsing multiline PHPDOC @params

Problem Statement

The PHPDOC parser in Hazaar is currently unable to correctly parse multiline descriptions for @param elements in docblocks. This results in incomplete or incorrectly formatted parameter descriptions in the generated API documentation.

Steps to Reproduce

  1. Add a multiline description to a @param annotation in a docblock.
  2. Run the Hazaar API documentation generator.
  3. Observe that the description is either truncated, improperly formatted, or missing in the output.

Expected Behavior

  • The parser should correctly capture and concatenate multiline descriptions for @param elements, preserving their intended formatting.

Actual Behavior

  • The parser fails to properly associate additional lines with the correct @param element.
  • In some cases, only the first line of the description is included, while the remaining lines are ignored or incorrectly associated.

Benefits and Risks

Benefits

  • Fixing this issue will ensure that function parameter descriptions are fully captured and accurately represented in the API documentation.
  • Improves the quality and readability of generated documentation.
  • Helps developers understand function parameters better by preserving full descriptions.

Risks

  • Modifying the parser may introduce unintended side effects if not thoroughly tested.
  • Edge cases in formatting (e.g., mixed indentation styles) may need to be handled carefully.

Proposed Solution

  1. Update the PHPDOC parser to correctly detect and associate multiline descriptions with their respective @param elements.
  2. Adjust the parsing logic to handle indentation and line continuation correctly.
  3. Write test cases to validate correct handling of multiline @param descriptions.
  4. Verify that other docblock elements (e.g., @return, @throws) are not affected by the changes.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information