status; } #[WorkflowMethod(name: 'CancelledMidflightWorkflow')] public function handler() { $simple = Workflow::newActivityStub( SimpleActivity::class, ActivityOptions::new()->withStartToCloseTimeout(5) ); $this->status[] = 'start'; $scope = Workflow::newCancellationScope( function () use ($simple) { $this->status[] = 'in scope'; $simple->slow('1'); } )->onCancel( function () { $this->status[] = 'on cancel'; } ); $scope->cancel(); $this->status[] = 'done cancel'; return 'OK'; } }