FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix error when phpdoc param has no type by LordSimal · Pull Request #403 · cakephp/cakephp-codesniffer · GitHub

fix error when phpdoc param has no type - #403

Merged
dereuromark merged 1 commit into
5.xfrom
5.x-fix-error-with-no-type
Dec 17, 2024
Merged

fix error when phpdoc param has no type#403
dereuromark merged 1 commit into
5.xfrom
5.x-fix-error-with-no-type

Conversation

LordSimal commented Dec 17, 2024
edited
Loading

Copy link
Copy Markdown
Member

Fixes #402

This adds a new warning if a param type has no type hint instead of just bailing out due to an error

LordSimal added this to the 5.x milestone Dec 17, 2024
LordSimal marked this pull request as draft December 17, 2024 21:41
LordSimal force-pushed the 5.x-fix-error-with-no-type branch from 86bf119 to cd67ba6 Compare December 17, 2024 21:49
LordSimal marked this pull request as ready for review December 17, 2024 21:49
dereuromark merged commit 9686722 into 5.x Dec 17, 2024
dereuromark deleted the 5.x-fix-error-with-no-type branch December 17, 2024 21:53

Copy link
Copy Markdown
Member

Side note
You can also use TypelessParamTagValueNode check to bail early here

            if ($valueNode instanceof InvalidTagValueNode || $valueNode instanceof TypelessParamTagValueNode) {
                if (!isset($valueNode->type)) {
                    $phpcsFile->addWarning('%s type hint is missing', $tag, 'MissingParamType', [$tokens[$tag]['content']]);
                }
                continue;
            }

Note the %s, since it can be others than param as well.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Error when phpdoc param has no type

2 participants


Back | FazBrowse Home | New Git URL