andrewdyer / andrewdyer/command-bus
Handler validation allows objects without a real handle method
Abierto
- Lenguaje dominante
- PHP
- Estrellas
- 0
- Forks
- 0
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
the `CommandBus::register()` uses `is_callable([$handler, 'handle'])` to validate that a handler has a public `handle()` method. However, is_callable() returns `true` for any object implementing `__call()`, even if no concrete `handle()` method exists — contradicting the exception message and documented contract.
Fix: Replace the `is_callable()` check with `method_exists()` + `ReflectionMethod::isPublic():`
```php
isPublic()) {
throw new InvalidArgumentException(...);
}
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.