Skip to content

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

Merged
soyuka merged 1 commit intoapi-platform:4.3from
KevinMartinsDev:refactor/entrypoint-action-worker-mode
Apr 27, 2026
Merged

refactor(symfony): remove static state from EntrypointAction#7919
soyuka merged 1 commit intoapi-platform:4.3from
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

@soyuka soyuka changed the base branch from main to 4.3 April 27, 2026 12:36
@soyuka soyuka force-pushed the refactor/entrypoint-action-worker-mode branch from 02ecd93 to 6cf2ab5 Compare April 27, 2026 12:37
@soyuka
Copy link
Copy Markdown
Member

soyuka commented Apr 27, 2026

good catch thanks!

@soyuka soyuka changed the title refactor(symfony): remove static state from EntrypointAction for Work… refactor(symfony): remove static state from EntrypointAction Apr 27, 2026
@soyuka soyuka merged commit 418f42c into api-platform:4.3 Apr 27, 2026
116 of 117 checks passed
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.

2 participants