Skip to content

test: cover native CakePHP association target inference - #3

Closed
josbeir wants to merge 1 commit into
mainfrom
fix/association-target-analysis-types
Closed

josbeir wants to merge 1 commit into
mainfrom
fix/association-target-analysis-types

Conversation

@josbeir

@josbeir josbeir commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

CakePHP 6.x already declares @method T getTarget() on its four ORM association classes, which lets Mago retain the concrete target table without a source patch. Replace the proposed patch with regression coverage and leave the shipped preset unchanged.

The installed-consumer check covers BelongsTo, BelongsToMany, HasMany, and HasOne using fixtures that match CakePHP's annotations. Positive cases must return the concrete target type; negative cases must report four incompatible return types. The CakePHP 6.x compatibility script runs the same checks against the actual framework source without patches or extensions.

Validation: all package checks pass, including 12 PHPUnit tests, consumer checks, corpus validation, formatter and fixer checks. The CakePHP 6.x compatibility and analysis checks also pass against a local checkout. Rebased onto main after PR #4.

@josbeir
josbeir force-pushed the fix/association-target-analysis-types branch from 1647c75 to f06be79 Compare October 21, 2026 18:26
@josbeir josbeir changed the title fix: preserve CakePHP association targets in Mago analysis test: cover native CakePHP association target inference Oct 21, 2026
@josbeir

josbeir commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

Closing this because the original issue was fixed upstream after this PR was opened.

This PR was opened on October 6. CakePHP added @method T getTarget() to all four association classes on October 9 in cakephp/cakephp@d4c1fe4, then merged that change from 5.next into 6.x on October 10: cakephp/cakephp@f3c73ed.

Those annotations let Mago preserve the concrete target table type without a source patch. Verified against current CakePHP 6.x source with Mago 1.47.2 and 1.54.0.

The original patch addressed a real gap at the time. Its replacement now only adds regression tests, so there is no remaining fix needed in this package.

@josbeir josbeir closed this Oct 21, 2026
@josbeir
josbeir deleted the fix/association-target-analysis-types branch October 21, 2026 18:31
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