Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure we stop looking for file phpdoc block asap #173

Merged

Conversation

stronk7
Copy link
Member

@stronk7 stronk7 commented Jun 27, 2024

Previously, we were allowing the getDocTagFromOpenTag() method to advance too much when looking for file phpdoc blocks. Now we stop as soon as any of the stop tokens is found.

Note that this case is very edge one, only reproducible when there are lots of missing class/function phpdoc block, causing some other phpdoc block (type-hinting a variable or whatever) to be picked.

In any case, I think that it's perfectly ok to shortcut the search that way, it can save us some precious iterations.

Fixes #172

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.11%. Comparing base (85e9e0a) to head (13b8e00).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #173   +/-   ##
=========================================
  Coverage     98.11%   98.11%           
- Complexity      949      950    +1     
=========================================
  Files            40       40           
  Lines          2809     2811    +2     
=========================================
+ Hits           2756     2758    +2     
  Misses           53       53           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stronk7 stronk7 force-pushed the shortcut_get_doc_from_open_tag_earlier branch 2 times, most recently from 41afe81 to 3126f19 Compare June 29, 2024 15:49
Previously, we were allowing the getDocTagFromOpenTag()
method to advance too much when looking for file phpdoc
blocks. Now we stop as soon as any of the stop tokens is found.

Note that this case is very edge one, only reproducible when
there are lots of missing class/function phpdoc block, causing
some other phpdoc block to be picked.

In any case, I think that it's perfectly ok to shortcut the
search that way, it can save us some precious iterations.

Fixes moodlehq#172
@stronk7 stronk7 force-pushed the shortcut_get_doc_from_open_tag_earlier branch from 3126f19 to 13b8e00 Compare June 29, 2024 16:39
@stronk7
Copy link
Member Author

stronk7 commented Jun 29, 2024

Just amended a few comments and add a new case, via provider, to ensure all cases are covered.

@andrewnicols andrewnicols merged commit a0bfb12 into moodlehq:main Jul 1, 2024
13 checks passed
@stronk7 stronk7 deleted the shortcut_get_doc_from_open_tag_earlier branch July 1, 2024 13:57
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.

Commenting.PackageSniff fix seems broken when first doc comment is an inline one
2 participants