withStartToCloseTimeout(5) ); $cancelled = 'not'; $scope = Workflow::newCancellationScope( function () use ($simple) { yield Workflow::timer(2); yield $simple->slow('hello'); } )->onCancel( function () use (&$cancelled) { $cancelled = 'yes'; } ); yield Workflow::timer(1); $scope->cancel(); return $cancelled; } }