Bug: Some annotations break API docs
Problem Statement
The API documentation generator is experiencing two primary issues:
- The
@var
annotation inHazaar\Console\Application.php
for class properties is being output as a description (e.g.,"@var array<Command>"
) instead of being parsed as a type declaration. - Errors are being thrown during the parsing and rendering process:
Error: Undefined property: Hazaar\Parser\PHP\ParserFunction::$return
Error: Array to string conversion
These issues are affecting the correctness of the generated documentation and causing runtime errors.
Steps to Reproduce
- Run the API documentation generator on the
Hazaar\Console\Application.php
file containing class properties annotated with@var
and functions with a@return
tag. - Observe the generated documentation for the incorrect handling of the
@var
annotation. - Check the logs or output for the following errors:
Error: Undefined property: Hazaar\Parser\PHP\ParserFunction::$return
Array to string conversion
Expected Behavior
- The
@var
annotation inHazaar\Console\Application.php
should be parsed as a type declaration and appropriately rendered in the documentation. - No runtime errors should occur during parsing or rendering.
Actual Behavior
- The
@var
annotation inHazaar\Console\Application.php
is incorrectly treated as a property description. - Errors are logged during the parsing process:
Undefined property: Hazaar\Parser\PHP\ParserFunction::$return
Array to string conversion
Benefits and Risks
Benefits
- Resolving these issues ensures accurate and reliable API documentation generation.
- Eliminates runtime errors that disrupt the generation process.
Risks
- Fixing these issues may require changes to the parsing logic, which could impact other aspects of the documentation generator.
Proposed Solution
- Update the
@var
parsing logic to correctly interpret it as a type declaration rather than a description. - Add validation and error handling for the
return
property inHazaar\Parser\PHP\ParserFunction
to preventUndefined property
errors. - Review and update the handling of data types to resolve the
Array to string conversion
error.
Priority/Severity
-
High (This will bring a huge increase in performance/productivity/usability/legislative cover) -
Medium (This will bring a good increase in performance/productivity/usability) -
Low (anything else e.g., trivial, minor improvements)