dimanche 2 août 2020

Detect if PHP generator accepts send()?

Is it possible to somehow detect if a generator can accept any send() command? That is, if it has any line like this:

$gen = yield;

Use-case is when generators are used to factor out side-effects (as in redux-saga). If no expression depends on the result of any side-effect, all side-effects can be run concurrently (non-blocking IO).

Did not find any useful info in the reflection API: https://www.php.net/manual/en/class.reflectiongenerator.php





Aucun commentaire:

Enregistrer un commentaire