Skip to content

Collect dependencies defined in @throws docblock tags#513

Draft
micheleorselli wants to merge 6 commits intomainfrom
collect_throws_types
Draft

Collect dependencies defined in @throws docblock tags#513
micheleorselli wants to merge 6 commits intomainfrom
collect_throws_types

Conversation

@micheleorselli
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented May 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.89%. Comparing base (5378d17) to head (fbcd94c).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #513      +/-   ##
============================================
+ Coverage     97.85%   97.89%   +0.03%     
- Complexity      646      657      +11     
============================================
  Files            83       83              
  Lines          1864     1896      +32     
============================================
+ Hits           1824     1856      +32     
  Misses           40       40              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud
Copy link

@fain182
Copy link
Collaborator

fain182 commented Jul 7, 2025

fixes #514

@fain182
Copy link
Collaborator

fain182 commented Dec 19, 2025

to complete this we should fix the row number, that now is the first line of the comment instead of the line of the throws.

fain182 pushed a commit that referenced this pull request Feb 10, 2026
…correct line numbers

- Merge PR #513 branch (collect_throws_types) into working branch
- Resolve conflicts in FileVisitor.php (keep both handlePropertyHookNode and handleThrowsTags)
- Fix @throws line number: previously used method start line, now computes the
  actual file line of each @throws tag using PHPStan's startLine attribute
  combined with the docblock's start line in the file
- Modify Docblock::getThrowTagsTypes() to return [{type, line}] pairs instead
  of plain strings, exposing per-tag line info from PHPStan parser
- Update tests to reflect that PHP core classes (e.g. \Exception) are filtered
  out by the existing isPhpCoreClass() check in ClassDescriptionBuilder

Fixes #514

https://claude.ai/code/session_01H3NqdUfGArp9bzf1WiXMos
micheleorselli and others added 3 commits February 16, 2026 15:20
Add two integration tests to verify that dependencies defined in @throws
docblock tags are properly collected:
- test_it_collects_throws_tag_as_dependencies: Tests collection of relative
  and fully qualified exception names in @throws tags
- test_it_collects_throws_tag_with_fully_qualified_names: Tests handling of
  different naming conventions (backslash-prefixed, relative to namespace)

These tests validate that the @throws tag parsing feature works end-to-end
and that exceptions are properly resolved to their fully qualified names.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
@fain182 fain182 force-pushed the collect_throws_types branch from fa33a58 to abad339 Compare February 16, 2026 14:21
fain182 and others added 3 commits February 16, 2026 15:33
- Exception and other PHP core classes are filtered by isPhpCoreClass,
  so they should not be expected as collected dependencies
- Restore NotBlank and UuidFactoryInterface in DocblockTypesResolverTest
  which were incorrectly removed from expectations
- Replace deprecated PHP_7_4 constant with PHP_8_0

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
The startLine attribute was incorrectly set to the method's start line.
Now uses the docblock start line combined with the relative line of each
@throws tag (from ParserConfig lines=true) to compute the correct
absolute line in the file.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
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.

2 participants