Skip to content

refactor: allow extending Typo3Integration - #127

Open
contemas-tschmidt wants to merge 1 commit into
networkteam:mainfrom
contemas-tschmidt:allow-extending-integrations
Open

refactor: allow extending Typo3Integration#127
contemas-tschmidt wants to merge 1 commit into
networkteam:mainfrom
contemas-tschmidt:allow-extending-integrations

Conversation

@contemas-tschmidt

Copy link
Copy Markdown

Typo3Integration declares two of its methods protected:

final class Typo3Integration implements IntegrationInterface
{
    private function processEvent(Event $event): void { … }
    protected function setUrl(Event $event, ServerRequestInterface $request): void { … }
    protected function getServerRequest(): ?ServerRequestInterface { … }
}

protected differs from private only for subclasses, and final means there can be none — so the visibility currently has no effect. This drops final so that it does.

Why it matters in practice

While #121 / #124 are open, the obvious downstream workaround is a four-line subclass that guards setUrl() against a request without a URI. That is not possible, so the alternative is to reimplement the integration and replace the class in the integrations option — which then silently drifts from upstream whenever this one changes.

We learned this the hard way: the subclass looked correct, and final turned it into a fatal error on class load that took down a deployment. final here does not prevent a bad idea, it only makes the good version of it unavailable.

UserIntegration has no protected members and IgnoreEventIntegration is not affected by this, so this PR touches only the class where the intent is already visible in the code.

Scope

One line. processEvent() stays private — making it protected would be a larger decision about what counts as the extension surface, and this change does not depend on it.

Not a replacement for #124: that PR fixes the actual bug and should still be merged. This one is about what downstream can do in the meantime, and about extension points in general.

The class declares setUrl() and getServerRequest() as protected, which only
has an effect for subclasses -- but the class is final, so there can be none.
Dropping final makes that intent usable.

Concretely it allows a project to override setUrl() while an upstream fix for
a request-related problem is pending, instead of reimplementing the whole
integration and swapping it into the integrations option.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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