ComponentsScope::isCancelled

Scope::isCancelled ​

(PHP 8.6+, True Async 1.0)

php
public function isCancelled(): bool

Checks whether the scope has been cancelled. A scope is marked as cancelled after a call to cancel() or dispose().

Return Value ​

bool — true if the scope has been cancelled, false otherwise.

Examples ​

Example #1 Checking scope cancellation ​

php
<?php

use Async\Scope;

$scope = new Scope();

var_dump($scope->isCancelled()); // bool(false)

$scope->cancel();

var_dump($scope->isCancelled()); // bool(true)

See Also ​