Skip to content

Add intersection type support and fix singularType union parsing#87

Merged
dereuromark merged 1 commit intomasterfrom
fix/remaining-type-parsing-issues
Mar 23, 2026
Merged

Add intersection type support and fix singularType union parsing#87
dereuromark merged 1 commit intomasterfrom
fix/remaining-type-parsing-issues

Conversation

@dereuromark
Copy link
Copy Markdown
Contributor

Summary

  • Fix singularType field to parse union types (was using single-type extraction)
  • Add intersection type (&) support to dependency extraction
  • Handle parenthesized DNF types like (Foo|Bar)&Baz

Changes

The extractDtoNamesFromType() method now:

  1. Removes parentheses for DNF types
  2. Splits on both | (union) and & (intersection) operators using preg_split('/[|&]/')

The singularType field now uses extractDtoNamesFromType() (plural) instead of extractDtoNameFromType() (singular), ensuring union types in collection singular types are correctly parsed.

New Tests

Test Purpose
testSingularTypeWithUnionParsed Union in singularType detected
testIntersectionTypeCircularDependencyDetected Foo&Bar intersection detected
testLazyIntersectionTypeBreaksCycle Lazy intersection skipped
testParenthesizedDnfTypeCircularDependencyDetected `(Foo
testMixedUnionAndIntersectionTypes `Foo
testLazySingularTypeUnionBreaksCycle Lazy singularType union skipped

- Parse singularType field for union types (was only parsing single type)
- Add intersection type (`&`) support to type parsing
- Handle parenthesized DNF types like `(Foo|Bar)&Baz`
- Use `preg_split('/[|&]/')` to split on both operators
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.46%. Comparing base (1821437) to head (4b49d11).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master      #87   +/-   ##
=========================================
  Coverage     83.46%   83.46%           
  Complexity     1386     1386           
=========================================
  Files            40       40           
  Lines          3344     3345    +1     
=========================================
+ Hits           2791     2792    +1     
  Misses          553      553           

☔ 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.

@dereuromark dereuromark merged commit 7fe50ce into master Mar 23, 2026
12 checks passed
@dereuromark dereuromark deleted the fix/remaining-type-parsing-issues branch March 23, 2026 01:37
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.

1 participant