-
-
Notifications
You must be signed in to change notification settings - Fork 89
Closed as not planned
Closed as not planned
Copy link
Description
Current situation
PHP codebases often contain inline (//
, #
) and/or multiline (/* ... */
) comments that include PHPDoc-style tags such as @param
, @return
, or @todo
.
However, these comments are not recognized as valid PHPDoc blocks because they lack the correct DocBlock delimiters (/** ... */
).
As a result, the PHP tokenizer may fail to parse these tags, leading to incomplete or inaccurate code analysis and documentation generation.
Solution
Develop a PHPCS sniff to detect inline/multiline comments that contain PHPDoc-style tags (e.g., @param
, @return
, @todo
).
Sniff behavior:
- identify comments (
T_COMMENT
) that include any PHPDoc-style tags; - flag these comments with an error or warning;
- automatically fix these comments by converting them to proper PHPDoc format (
/** ... */
); - the sniff should flag only comments where PHPDoc tags appear at the beginning of a new line; this ensures false positives are avoided when a PHPDoc tag is used merely as part of a description in the context, rather than as an actual PHPDoc tag.
Impact:
- enhance compatibility with the PHP tokenizer and related tools;
- promote consistent code quality by enforcing proper DocBlock syntax;
- support developers in maintaining well-documented and easily parsable codebases.
mukeshpanchal27