Skip to content

refactor: keep block bindings free of Laravel before they become a package - #492

Merged
ogorzalka merged 3 commits into
release/v13.36.1from
refactor/bindings-ports
Oct 15, 2026
Merged

ogorzalka merged 3 commits into
release/v13.36.1from
refactor/bindings-ports

Conversation

@ogorzalka

@ogorzalka ogorzalka commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Step 1 of the extraction of pollora/block-bindings (plan: .claude/plans/meta-roles-bindings-packages.md in pollora-test).

  • BindingResolver takes a PSR-11 ContainerInterface (get() autowires under Laravel). Two new contracts carry what Laravel's container and events did for it: MethodInvokerInterface (the method of a #[BlockBinding] source gets the services its typed parameters name, the binding context by its type or as $context) and BindingEventsInterface (BindingResolved). LaravelMethodInvoker and LaravelBindingEvents implement them for Laravel; ReflectionMethodInvoker is the default without it. How a source is declared and written does not change.
  • OptionSource and BindingEditorData take the listed options as an array, read from block-bindings.options by the provider with explicit bindings (an autowired nullable or defaulted parameter would have silently become empty).
  • Htmlable becomes method_exists($value, 'toHtml'); Str::headline()/snake() become Naming (pollora/attributes 0.1.1).
  • What needs Laravel moves to Pollora\BlockBinding\Infrastructure\Laravel: provider, doctor check, the two commands and their stub.
  • surface.json regenerated: the diff is the moved classes, the new contracts and the changed constructors.

Checked: suite in sequence 1635 passed, PHPStan clean, Rector and Pint; the 28 captures of pollora-test (bindings resolved over REST for four sets, editor data, binding:list, concert pages, roles, doctor…) are identical to the references taken before the change.

Added after review of the code: a third contract. BindingContext::post() asked the framework's Pollora\Models\Post (Eloquent model with the typed meta accessors). PostFinderInterface now loads it: LaravelPostFinder gives the framework's model, so a source gets the same object as before; without Laravel it is Colt's Post. post() is typed as Colt's Post, which the framework's extends. Covered by a unit test and by the captures (identical).

…ckage

The resolver takes a PSR-11 container; two contracts carry what Laravel did for it
(MethodInvokerInterface for the parameters of a source's method, BindingEventsInterface for
BindingResolved); the options a project lists reach OptionSource and the editor data as an
array; labels and names come from Naming; the Laravel side (provider, doctor check, commands)
moves to Pollora\BlockBinding\Infrastructure\Laravel. Pages, REST responses and command
outputs of pollora-test are identical to the references taken before.
BindingContext::post() asked the framework's Post model; a PostFinderInterface now gives it
(the framework's Post under Laravel, Colt's without it), so the context no longer reaches the
framework. The captures of pollora-test are still identical.
@ogorzalka
ogorzalka merged commit ca8f0ca into release/v13.36.1 Oct 15, 2026
10 checks passed
@ogorzalka
ogorzalka deleted the refactor/bindings-ports branch October 15, 2026 15:23
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