andrewdyer / andrewdyer/command-bus

Handler validation allows objects without a real handle method

Aperta
#3 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
PHP
Stelle
0
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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(...);
}
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.