Skip to content

refactor(symfony): remove static state from EntrypointAction for Work…#7919

Open
KevinMartinsDev wants to merge 1 commit intoapi-platform:mainfrom
KevinMartinsDev:refactor/entrypoint-action-worker-mode
Open

refactor(symfony): remove static state from EntrypointAction for Work…#7919
KevinMartinsDev wants to merge 1 commit intoapi-platform:mainfrom
KevinMartinsDev:refactor/entrypoint-action-worker-mode

Conversation

@KevinMartinsDev
Copy link
Copy Markdown

@KevinMartinsDev KevinMartinsDev commented Apr 19, 2026

Description

This Pull Request is the first step of the worker mode compatibility audit (see #7918). It addresses the usage of static properties for state persistence within Symfony Actions.

In persistent memory runtimes like FrankenPHP or Swoole, static properties persist across the entire process lifetime. In the case of EntrypointAction, storing the ResourceNameCollection in a static property is unnecessary since the service is already a singleton in the container.

Moving this to an instance property ensures:

  • Cleanliness: Avoids global state within the process.
  • Thread-safety: Better alignment with modern PHP runtime expectations.
  • Consistency: Matches standard service-oriented architecture.

Changes

  • Removed static scope from $resourceNameCollection in EntrypointAction.
  • Updated __invoke to use instance-level lazy loading with the ??= operator.

Context

This fix is part of a global audit performed with Igor-PHP.

Part of #7918

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