Skip to content

[prophet-report] ExplicitDataFactoryProphet: The [AUTO-FIXABLE] auto-fix is a no-op for the object-typed ::from() sites it… #44

@jessegall

Description

@jessegall

Reported automatically by a code-commandments agent.

Prophet ExplicitDataFactoryProphet
Location domain/Shop/Projections/Shop.php:242

What's wrong

The [AUTO-FIXABLE] auto-fix is a no-op for the object-typed ::from() sites it detects. 'judge' flags 'ShopData::from($this)' (Shop::toData) as an ExplicitDataFactory SIN ('given a non-array (object)'), but 'commandments repent --prophet=ExplicitDataFactoryProphet' makes NO changes for it (reports 'No changes made'/'No sins to fix') — so the promised migration to an explicit fromX() factory never happens; the runtime FromArrayOnly assert then breaks ~30 test classes. Repent should generate the fromShop() factory and rewrite the call site. Secondary: the closure param-hint case 'fn (Shop $shop) => ShopData::from($shop)' (AppContext.php:163) is not even detected, though the scripture lists 'parameter hints' as resolvable. Repro: set ExplicitDataFactoryProphet severity=sin, run repent --prophet=ExplicitDataFactoryProphet.

Flagged code

return ShopData::from($this);

For the fixer

Decide whether this is a false positive (tighten/guard the prophet), a wrong rule (adjust the rule or its config), or correct-but-unclear (improve the message/scripture). Add a fixture from the flagged code above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions