Problem/Motivation

Every Yoyaku submodule is meant to be separable, yet two of them name a class from a module they do not declare:

  • yoyaku_calendar names Drupal\yoyaku_payment\PaymentPolicyResolverInterface in AvailabilityFeed and SlotBookingForm, to show a price.
  • yoyaku_orchestra names Drupal\yoyaku_manager\ResourceAccessInterface in its resource_managers audience, to resolve a resource's managers.

Both work today only because PHP resolves a nullable parameter type lazily, so an optional service typed on an absent module's interface holds right up to the moment a value is passed. Shipped apart, they would fatal.

A third case named in the first draft, yoyaku_placement constructing yoyaku_cart's CartCheckoutEvent, is already resolved: the controller asks the engine's BookingCartInterface and links the cart by route name, which is a string and degrades on its own.

Proposed resolution

Keep both integrations optional without naming an undeclared class. The engine owns a narrow seam interface, Drupal\yoyaku\PriceResolverInterface, which PaymentPolicyResolverInterface extends, so the calendar names only the engine's. The audience exists for one integration and nothing else, so its home is a yoyaku_orchestra_manager bridge submodule depending on both sides, following yoyaku_orchestra_order and yoyaku_payment_orchestra; its guard goes with the move, since a guard that answers with nobody is worse than none.

Remaining tasks

  • A check that fails when a submodule names a class from a module it does not declare, transitively, over shipped code only.

AI-Generated: Yes (Claude Code was used to help draft this issue summary and to write the code and tests on the merge request. I reviewed and ran the work myself before posting it.)

Issue fork yoyaku-3616250

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Title: Three submodules import a class from a module they do not declare, so they cannot ship apart » Declare every module whose classes a submodule names
Issue summary: View changes
mably’s picture

Status: Active » Needs review

  • mably committed de191696 on 1.x
    task: #3616250 Declare every module whose classes a submodule names
    
    By...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.