Skip to content

feat: introduce ServerAction enum for type-safe command actions#135

Merged
s2x merged 6 commits intomasterfrom
feature/php82-server-action-enum
Apr 14, 2026
Merged

feat: introduce ServerAction enum for type-safe command actions#135
s2x merged 6 commits intomasterfrom
feature/php82-server-action-enum

Conversation

@s2x
Copy link
Copy Markdown
Collaborator

@s2x s2x commented Apr 14, 2026

Summary

  • Utworzono ServerAction backed enum zastępujący stałą ALLOWED_ACTIONS w WorkermanCommand
  • Enum zapewnia type-safety oraz IDE autocompletion dla akcji: start, stop, restart, reload, status, connections

Changes

  • New: src/Command/ServerAction.php - backed enum
  • New: tests/Command/ServerActionTest.php - testy enuma
  • Modified: src/Command/WorkermanCommand.php - użycie enuma zamiast tablicy stringów

Benefits

  • Type safety — walidacja akcji przez ServerAction::tryFrom()
  • IDE autocompletion dla enum cases
  • Eliminacja literówek w stringach
  • Pełna backward compatibility (te same argumenty konsolowe)

Verification

  • ✅ PHPStan: 0 errors
  • ✅ PHPUnit: 283 tests, 876 assertions

Closes #52

Comment thread src/Command/ServerAction.php Outdated
@s2x s2x merged commit fe019e1 into master Apr 14, 2026
22 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.

PHP 8.2 — Review enum and constants in traits usage

1 participant