diff --git a/CHANGELOG.md b/CHANGELOG.md index 317038c..2eebec5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Deadlock detection now throws `Async\DeadlockError` exception instead of multiple warnings - **Breaking Change**: Applications relying on deadlock warnings will need to be updated to catch `Async\DeadlockError` exceptions +- **Breaking Change: PHP Coding Standards Compliance** - Function names updated to follow official PHP naming conventions: + - `spawnWith()` → `spawn_with()` + - `awaitAnyOrFail()` → `await_any_or_fail()` + - `awaitFirstSuccess()` → `await_first_success()` + - `awaitAllOrFail()` → `await_all_or_fail()` + - `awaitAll()` → `await_all()` + - `awaitAnyOfOrFail()` → `await_any_of_or_fail()` + - `awaitAnyOf()` → `await_any_of()` + - `currentContext()` → `current_context()` + - `coroutineContext()` → `coroutine_context()` + - `currentCoroutine()` → `current_coroutine()` + - `rootContext()` → `root_context()` + - `getCoroutines()` → `get_coroutines()` + - `gracefulShutdown()` → `graceful_shutdown()` + - **Rationale**: Compliance with [PHP Coding Standards](https://github.com/php/policies/blob/main/coding-standards-and-naming.rst) - functions must use lowercase with underscores ## [0.4.0] - 2025-09-30 diff --git a/async.c b/async.c index d9762aa..60833e1 100644 --- a/async.c +++ b/async.c @@ -89,7 +89,7 @@ PHP_FUNCTION(Async_spawn) RETURN_OBJ_COPY(&coroutine->std); } -PHP_FUNCTION(Async_spawnWith) +PHP_FUNCTION(Async_spawn_with) { THROW_IF_ASYNC_OFF; THROW_IF_SCHEDULER_CONTEXT; @@ -290,7 +290,7 @@ PHP_FUNCTION(Async_await) zend_async_waker_clean(coroutine); } -PHP_FUNCTION(Async_awaitAnyOrFail) +PHP_FUNCTION(Async_await_any_or_fail) { zval *futures; zend_object *cancellation = NULL; @@ -340,7 +340,7 @@ PHP_FUNCTION(Async_awaitAnyOrFail) RETURN_ZVAL(&result, 0, 0); } -PHP_FUNCTION(Async_awaitFirstSuccess) +PHP_FUNCTION(Async_await_first_success) { zval *futures; zend_object *cancellation = NULL; @@ -396,7 +396,7 @@ PHP_FUNCTION(Async_awaitFirstSuccess) RETURN_ARR(return_array); } -PHP_FUNCTION(Async_awaitAllOrFail) +PHP_FUNCTION(Async_await_all_or_fail) { zval *futures; zend_object *cancellation = NULL; @@ -435,7 +435,7 @@ PHP_FUNCTION(Async_awaitAllOrFail) RETURN_ARR(results); } -PHP_FUNCTION(Async_awaitAll) +PHP_FUNCTION(Async_await_all) { zval *futures; zend_object *cancellation = NULL; @@ -485,7 +485,7 @@ PHP_FUNCTION(Async_awaitAll) RETURN_ARR(return_array); } -PHP_FUNCTION(Async_awaitAnyOfOrFail) +PHP_FUNCTION(Async_await_any_of_or_fail) { zval *futures; zend_object *cancellation = NULL; @@ -528,7 +528,7 @@ PHP_FUNCTION(Async_awaitAnyOfOrFail) RETURN_ARR(results); } -PHP_FUNCTION(Async_awaitAnyOf) +PHP_FUNCTION(Async_await_any_of) { zval *futures; zend_object *cancellation = NULL; @@ -633,7 +633,7 @@ PHP_FUNCTION(Async_timeout) RETURN_OBJ(zend_object); } -PHP_FUNCTION(Async_currentContext) +PHP_FUNCTION(Async_current_context) { ZEND_PARSE_PARAMETERS_NONE(); @@ -661,7 +661,7 @@ PHP_FUNCTION(Async_currentContext) RETURN_OBJ_COPY(&context->std); } -PHP_FUNCTION(Async_coroutineContext) +PHP_FUNCTION(Async_coroutine_context) { ZEND_PARSE_PARAMETERS_NONE(); @@ -688,7 +688,7 @@ PHP_FUNCTION(Async_coroutineContext) RETURN_OBJ_COPY(&context->std); } -PHP_FUNCTION(Async_currentCoroutine) +PHP_FUNCTION(Async_current_coroutine) { ZEND_PARSE_PARAMETERS_NONE(); @@ -706,7 +706,7 @@ PHP_FUNCTION(Async_currentCoroutine) RETURN_OBJ_COPY(&coroutine->std); } -PHP_FUNCTION(Async_rootContext) +PHP_FUNCTION(Async_root_context) { ZEND_PARSE_PARAMETERS_NONE(); @@ -721,7 +721,7 @@ PHP_FUNCTION(Async_rootContext) RETURN_OBJ_COPY(&context->std); } -PHP_FUNCTION(Async_getCoroutines) +PHP_FUNCTION(Async_get_coroutines) { ZEND_PARSE_PARAMETERS_NONE(); @@ -739,7 +739,7 @@ PHP_FUNCTION(Async_getCoroutines) ZEND_HASH_FOREACH_END(); } -PHP_FUNCTION(Async_gracefulShutdown) +PHP_FUNCTION(Async_graceful_shutdown) { zend_object *cancellation = NULL; @@ -909,8 +909,7 @@ static PHP_GINIT_FUNCTION(async) } /* {{{ PHP_GSHUTDOWN_FUNCTION */ -static PHP_GSHUTDOWN_FUNCTION(async) -{ +static PHP_GSHUTDOWN_FUNCTION(async){ #ifdef PHP_WIN32 #endif } /* }}} */ diff --git a/async.stub.php b/async.stub.php index 36e32e2..798dced 100644 --- a/async.stub.php +++ b/async.stub.php @@ -23,7 +23,7 @@ function spawn(callable $task, mixed ... $args): Coroutine {} * * @return Coroutine */ -function spawnWith(ScopeProvider $provider, callable $task, mixed ... $args): Coroutine {} +function spawn_with(ScopeProvider $provider, callable $task, mixed ... $args): Coroutine {} /** * Suspends the execution of a Coroutine until the Scheduler takes control. @@ -37,30 +37,30 @@ function protect(\Closure $closure): mixed {} function await(Awaitable $awaitable, ?Awaitable $cancellation = null): mixed {} -function awaitAnyOrFail(iterable $triggers, ?Awaitable $cancellation = null): mixed {} +function await_any_or_fail(iterable $triggers, ?Awaitable $cancellation = null): mixed {} -function awaitFirstSuccess(iterable $triggers, ?Awaitable $cancellation = null): mixed {} +function await_first_success(iterable $triggers, ?Awaitable $cancellation = null): mixed {} -function awaitAllOrFail(iterable $triggers, ?Awaitable $cancellation = null, bool $preserveKeyOrder = true): array {} +function await_all_or_fail(iterable $triggers, ?Awaitable $cancellation = null, bool $preserveKeyOrder = true): array {} -function awaitAll(iterable $triggers, ?Awaitable $cancellation = null, bool $preserveKeyOrder = true, bool $fillNull = false): array {} +function await_all(iterable $triggers, ?Awaitable $cancellation = null, bool $preserveKeyOrder = true, bool $fillNull = false): array {} -function awaitAnyOfOrFail(int $count, iterable $triggers, ?Awaitable $cancellation = null, bool $preserveKeyOrder = true): array {} +function await_any_of_or_fail(int $count, iterable $triggers, ?Awaitable $cancellation = null, bool $preserveKeyOrder = true): array {} -function awaitAnyOf(int $count, iterable $triggers, ?Awaitable $cancellation = null, bool $preserveKeyOrder = true, bool $fillNull = false): array {} +function await_any_of(int $count, iterable $triggers, ?Awaitable $cancellation = null, bool $preserveKeyOrder = true, bool $fillNull = false): array {} function delay(int $ms): void {} function timeout(int $ms): Awaitable {} -function currentContext(): Context {} +function current_context(): Context {} -function coroutineContext(): Context {} +function coroutine_context(): Context {} /** * Returns the current coroutine. */ -function currentCoroutine(): Coroutine {} +function current_coroutine(): Coroutine {} /** * Adds an onFinally handler for the current coroutine. @@ -70,19 +70,19 @@ function currentCoroutine(): Coroutine {} /** * Returns the root Scope. */ -function rootContext(): Context {} +function root_context(): Context {} /** * Returns the list of all coroutines * * @return Coroutine[] */ -function getCoroutines(): array {} +function get_coroutines(): array {} /** * Start the graceful shutdown of the Scheduler. */ -function gracefulShutdown(?CancellationError $cancellationError = null): void {} +function graceful_shutdown(?CancellationError $cancellationError = null): void {} /** * Execute an external program. diff --git a/async_arginfo.h b/async_arginfo.h index e764743..3106716 100644 --- a/async_arginfo.h +++ b/async_arginfo.h @@ -1,12 +1,12 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: aca45cee02a4df47e8e1bc3c2517e6925bd522a9 */ + * Stub hash: b455b6ae5681c59882adb70f7d033f77d62de5a4 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_Async_spawn, 0, 1, Async\\Coroutine, 0) ZEND_ARG_TYPE_INFO(0, task, IS_CALLABLE, 0) ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_Async_spawnWith, 0, 2, Async\\Coroutine, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_Async_spawn_with, 0, 2, Async\\Coroutine, 0) ZEND_ARG_OBJ_INFO(0, provider, Async\\ScopeProvider, 0) ZEND_ARG_TYPE_INFO(0, task, IS_CALLABLE, 0) ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0) @@ -24,34 +24,34 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_await, 0, 1, IS_MIXED, 0) ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, cancellation, Async\\Awaitable, 1, "null") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_awaitAnyOrFail, 0, 1, IS_MIXED, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_await_any_or_fail, 0, 1, IS_MIXED, 0) ZEND_ARG_OBJ_TYPE_MASK(0, triggers, Traversable, MAY_BE_ARRAY, NULL) ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, cancellation, Async\\Awaitable, 1, "null") ZEND_END_ARG_INFO() -#define arginfo_Async_awaitFirstSuccess arginfo_Async_awaitAnyOrFail +#define arginfo_Async_await_first_success arginfo_Async_await_any_or_fail -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_awaitAllOrFail, 0, 1, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_await_all_or_fail, 0, 1, IS_ARRAY, 0) ZEND_ARG_OBJ_TYPE_MASK(0, triggers, Traversable, MAY_BE_ARRAY, NULL) ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, cancellation, Async\\Awaitable, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, preserveKeyOrder, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_awaitAll, 0, 1, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_await_all, 0, 1, IS_ARRAY, 0) ZEND_ARG_OBJ_TYPE_MASK(0, triggers, Traversable, MAY_BE_ARRAY, NULL) ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, cancellation, Async\\Awaitable, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, preserveKeyOrder, _IS_BOOL, 0, "true") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fillNull, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_awaitAnyOfOrFail, 0, 2, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_await_any_of_or_fail, 0, 2, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0) ZEND_ARG_OBJ_TYPE_MASK(0, triggers, Traversable, MAY_BE_ARRAY, NULL) ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, cancellation, Async\\Awaitable, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, preserveKeyOrder, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_awaitAnyOf, 0, 2, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_await_any_of, 0, 2, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0) ZEND_ARG_OBJ_TYPE_MASK(0, triggers, Traversable, MAY_BE_ARRAY, NULL) ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, cancellation, Async\\Awaitable, 1, "null") @@ -67,20 +67,20 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_Async_timeout, 0, 1, Async\\Await ZEND_ARG_TYPE_INFO(0, ms, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_Async_currentContext, 0, 0, Async\\Context, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_Async_current_context, 0, 0, Async\\Context, 0) ZEND_END_ARG_INFO() -#define arginfo_Async_coroutineContext arginfo_Async_currentContext +#define arginfo_Async_coroutine_context arginfo_Async_current_context -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_Async_currentCoroutine, 0, 0, Async\\Coroutine, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_Async_current_coroutine, 0, 0, Async\\Coroutine, 0) ZEND_END_ARG_INFO() -#define arginfo_Async_rootContext arginfo_Async_currentContext +#define arginfo_Async_root_context arginfo_Async_current_context -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_getCoroutines, 0, 0, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_get_coroutines, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_gracefulShutdown, 0, 0, IS_VOID, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Async_graceful_shutdown, 0, 0, IS_VOID, 0) ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, cancellationError, Async\\CancellationError, 1, "null") ZEND_END_ARG_INFO() @@ -88,46 +88,46 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Async_Timeout___construct, 0, 0, 0) ZEND_END_ARG_INFO() ZEND_FUNCTION(Async_spawn); -ZEND_FUNCTION(Async_spawnWith); +ZEND_FUNCTION(Async_spawn_with); ZEND_FUNCTION(Async_suspend); ZEND_FUNCTION(Async_protect); ZEND_FUNCTION(Async_await); -ZEND_FUNCTION(Async_awaitAnyOrFail); -ZEND_FUNCTION(Async_awaitFirstSuccess); -ZEND_FUNCTION(Async_awaitAllOrFail); -ZEND_FUNCTION(Async_awaitAll); -ZEND_FUNCTION(Async_awaitAnyOfOrFail); -ZEND_FUNCTION(Async_awaitAnyOf); +ZEND_FUNCTION(Async_await_any_or_fail); +ZEND_FUNCTION(Async_await_first_success); +ZEND_FUNCTION(Async_await_all_or_fail); +ZEND_FUNCTION(Async_await_all); +ZEND_FUNCTION(Async_await_any_of_or_fail); +ZEND_FUNCTION(Async_await_any_of); ZEND_FUNCTION(Async_delay); ZEND_FUNCTION(Async_timeout); -ZEND_FUNCTION(Async_currentContext); -ZEND_FUNCTION(Async_coroutineContext); -ZEND_FUNCTION(Async_currentCoroutine); -ZEND_FUNCTION(Async_rootContext); -ZEND_FUNCTION(Async_getCoroutines); -ZEND_FUNCTION(Async_gracefulShutdown); +ZEND_FUNCTION(Async_current_context); +ZEND_FUNCTION(Async_coroutine_context); +ZEND_FUNCTION(Async_current_coroutine); +ZEND_FUNCTION(Async_root_context); +ZEND_FUNCTION(Async_get_coroutines); +ZEND_FUNCTION(Async_graceful_shutdown); ZEND_METHOD(Async_Timeout, __construct); static const zend_function_entry ext_functions[] = { ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "spawn"), zif_Async_spawn, arginfo_Async_spawn, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "spawnWith"), zif_Async_spawnWith, arginfo_Async_spawnWith, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "spawn_with"), zif_Async_spawn_with, arginfo_Async_spawn_with, 0, NULL, NULL) ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "suspend"), zif_Async_suspend, arginfo_Async_suspend, 0, NULL, NULL) ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "protect"), zif_Async_protect, arginfo_Async_protect, 0, NULL, NULL) ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "await"), zif_Async_await, arginfo_Async_await, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "awaitAnyOrFail"), zif_Async_awaitAnyOrFail, arginfo_Async_awaitAnyOrFail, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "awaitFirstSuccess"), zif_Async_awaitFirstSuccess, arginfo_Async_awaitFirstSuccess, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "awaitAllOrFail"), zif_Async_awaitAllOrFail, arginfo_Async_awaitAllOrFail, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "awaitAll"), zif_Async_awaitAll, arginfo_Async_awaitAll, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "awaitAnyOfOrFail"), zif_Async_awaitAnyOfOrFail, arginfo_Async_awaitAnyOfOrFail, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "awaitAnyOf"), zif_Async_awaitAnyOf, arginfo_Async_awaitAnyOf, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "await_any_or_fail"), zif_Async_await_any_or_fail, arginfo_Async_await_any_or_fail, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "await_first_success"), zif_Async_await_first_success, arginfo_Async_await_first_success, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "await_all_or_fail"), zif_Async_await_all_or_fail, arginfo_Async_await_all_or_fail, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "await_all"), zif_Async_await_all, arginfo_Async_await_all, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "await_any_of_or_fail"), zif_Async_await_any_of_or_fail, arginfo_Async_await_any_of_or_fail, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "await_any_of"), zif_Async_await_any_of, arginfo_Async_await_any_of, 0, NULL, NULL) ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "delay"), zif_Async_delay, arginfo_Async_delay, 0, NULL, NULL) ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "timeout"), zif_Async_timeout, arginfo_Async_timeout, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "currentContext"), zif_Async_currentContext, arginfo_Async_currentContext, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "coroutineContext"), zif_Async_coroutineContext, arginfo_Async_coroutineContext, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "currentCoroutine"), zif_Async_currentCoroutine, arginfo_Async_currentCoroutine, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "rootContext"), zif_Async_rootContext, arginfo_Async_rootContext, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "getCoroutines"), zif_Async_getCoroutines, arginfo_Async_getCoroutines, 0, NULL, NULL) - ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "gracefulShutdown"), zif_Async_gracefulShutdown, arginfo_Async_gracefulShutdown, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "current_context"), zif_Async_current_context, arginfo_Async_current_context, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "coroutine_context"), zif_Async_coroutine_context, arginfo_Async_coroutine_context, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "current_coroutine"), zif_Async_current_coroutine, arginfo_Async_current_coroutine, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "root_context"), zif_Async_root_context, arginfo_Async_root_context, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "get_coroutines"), zif_Async_get_coroutines, arginfo_Async_get_coroutines, 0, NULL, NULL) + ZEND_RAW_FENTRY(ZEND_NS_NAME("Async", "graceful_shutdown"), zif_Async_graceful_shutdown, arginfo_Async_graceful_shutdown, 0, NULL, NULL) ZEND_FE_END }; diff --git a/libuv_reactor.c b/libuv_reactor.c index 9cfd0b9..83a2864 100644 --- a/libuv_reactor.c +++ b/libuv_reactor.c @@ -860,7 +860,7 @@ zend_async_signal_event_t *libuv_new_signal_event(int signum, size_t extra_size) * * Thus, ASYNC_G(process_events) is a hash table with the key as ProcessId * and the value as an Event for process handling. -**/ + **/ /* {{{ libuv_signal_close_cb */ static void libuv_signal_close_cb(uv_handle_t *handle) @@ -1030,11 +1030,10 @@ static void libuv_handle_process_events(void) // Get PID to use as key for verification async_process_event_t *process = (async_process_event_t *) event; - uintptr_t pid_key = (uintptr_t)process->event.process; + uintptr_t pid_key = (uintptr_t) process->event.process; // Verify event is still in the HashTable (might have been removed) - if (ASYNC_G(process_events) == NULL || - zend_hash_index_find_ptr(ASYNC_G(process_events), pid_key) == NULL) { + if (ASYNC_G(process_events) == NULL || zend_hash_index_find_ptr(ASYNC_G(process_events), pid_key) == NULL) { continue; } @@ -1103,9 +1102,9 @@ static void libuv_remove_process_event(zend_async_event_t *event) } // Get process handle from event to use as key - async_process_event_t *process_event = (async_process_event_t *)event; + async_process_event_t *process_event = (async_process_event_t *) event; - zend_hash_index_del(ASYNC_G(process_events), (uintptr_t)process_event->event.process); + zend_hash_index_del(ASYNC_G(process_events), (uintptr_t) process_event->event.process); // Only remove SIGCHLD handler if no more process events AND no regular signal events for SIGCHLD if (zend_hash_num_elements(ASYNC_G(process_events)) == 0) { @@ -1574,7 +1573,7 @@ zend_async_process_event_t *libuv_new_process_event(zend_process_t process_handl START_REACTOR_OR_RETURN_NULL; // Use process handle as key for hash lookup - uintptr_t pid_key = (uintptr_t)process_handle; + uintptr_t pid_key = (uintptr_t) process_handle; // Initialize process_events if needed if (ASYNC_G(process_events) == NULL) { diff --git a/scheduler.c b/scheduler.c index 3a04678..caaeb86 100644 --- a/scheduler.c +++ b/scheduler.c @@ -533,12 +533,12 @@ static bool resolve_deadlocks(void) // zend_long fiber_coroutines_count = 0; - ZEND_HASH_FOREACH_VAL(&ASYNC_G(coroutines), value) { + ZEND_HASH_FOREACH_VAL(&ASYNC_G(coroutines), value) + { const zend_coroutine_t *coroutine = (zend_coroutine_t *) Z_PTR_P(value); - if (ZEND_COROUTINE_IS_FIBER(coroutine) - && ZEND_COROUTINE_IS_YIELD(coroutine) - && coroutine->extended_data != NULL) { + if (ZEND_COROUTINE_IS_FIBER(coroutine) && ZEND_COROUTINE_IS_YIELD(coroutine) && + coroutine->extended_data != NULL) { fiber_coroutines_count++; } } @@ -550,13 +550,13 @@ static bool resolve_deadlocks(void) // if (fiber_coroutines_count == real_coroutines) { - ZEND_HASH_FOREACH_VAL(&ASYNC_G(coroutines), value) { + ZEND_HASH_FOREACH_VAL(&ASYNC_G(coroutines), value) + { zend_coroutine_t *coroutine = (zend_coroutine_t *) Z_PTR_P(value); - if (ZEND_COROUTINE_IS_FIBER(coroutine) - && ZEND_COROUTINE_IS_YIELD(coroutine) - && coroutine->extended_data != NULL) { - ZEND_ASYNC_CANCEL(coroutine, zend_create_graceful_exit(), true); + if (ZEND_COROUTINE_IS_FIBER(coroutine) && ZEND_COROUTINE_IS_YIELD(coroutine) && + coroutine->extended_data != NULL) { + ZEND_ASYNC_CANCEL(coroutine, zend_create_graceful_exit(), true); if (UNEXPECTED(EG(exception) != NULL)) { return true; @@ -568,8 +568,10 @@ static bool resolve_deadlocks(void) } // Create deadlock exception to be set as exit_exception - zend_object *deadlock_exception = async_new_exception(async_ce_deadlock_error, - "Deadlock detected: no active coroutines, %u coroutines in waiting", real_coroutines); + zend_object *deadlock_exception = + async_new_exception(async_ce_deadlock_error, + "Deadlock detected: no active coroutines, %u coroutines in waiting", + real_coroutines); // Set as exit exception if there isn't one already if (ZEND_ASYNC_EXIT_EXCEPTION == NULL) { @@ -580,7 +582,8 @@ static bool resolve_deadlocks(void) ZEND_ASYNC_EXIT_EXCEPTION = deadlock_exception; } - ZEND_HASH_FOREACH_VAL(&ASYNC_G(coroutines), value) { + ZEND_HASH_FOREACH_VAL(&ASYNC_G(coroutines), value) + { async_coroutine_t *coroutine = (async_coroutine_t *) Z_PTR_P(value); ZEND_ASSERT(coroutine->coroutine.waker != NULL && "The Coroutine has no waker object"); @@ -1061,8 +1064,8 @@ bool async_scheduler_coroutine_enqueue(zend_coroutine_t *coroutine) // Behavior for a new coroutine // see: async_API.c spawn(zend_async_scope_t *scope, zend_object *scope_provider, int32_t priority) - if (false == ZEND_COROUTINE_IS_STARTED(coroutine) - && zend_hash_index_find(&ASYNC_G(coroutines), ((async_coroutine_t *)coroutine)->std.handle) == NULL) { + if (false == ZEND_COROUTINE_IS_STARTED(coroutine) && + zend_hash_index_find(&ASYNC_G(coroutines), ((async_coroutine_t *) coroutine)->std.handle) == NULL) { // save the filename and line number where the coroutine was created zend_apply_current_filename_and_line(&coroutine->filename, &coroutine->lineno); @@ -1076,7 +1079,9 @@ bool async_scheduler_coroutine_enqueue(zend_coroutine_t *coroutine) return false; } - if (UNEXPECTED(zend_hash_index_add_ptr(&ASYNC_G(coroutines), ((async_coroutine_t *)coroutine)->std.handle, coroutine) == NULL)) { + if (UNEXPECTED(zend_hash_index_add_ptr(&ASYNC_G(coroutines), + ((async_coroutine_t *) coroutine)->std.handle, + coroutine) == NULL)) { coroutine->waker->status = ZEND_ASYNC_WAKER_IGNORED; async_throw_error("Failed to add coroutine to the list"); return false; @@ -1144,7 +1149,8 @@ static zend_always_inline void scheduler_next_tick(void) // Fast return path without context switching... zend_coroutine_t *coroutine = ZEND_ASYNC_CURRENT_COROUTINE; - if (UNEXPECTED(coroutine != NULL && coroutine->waker != NULL && coroutine->waker->status == ZEND_ASYNC_WAKER_RESULT)) { + if (UNEXPECTED(coroutine != NULL && coroutine->waker != NULL && + coroutine->waker->status == ZEND_ASYNC_WAKER_RESULT)) { return; } diff --git a/tests/await/005-awaitAnyOrFail_basic.phpt b/tests/await/005-awaitAnyOrFail_basic.phpt index 8aead0f..a4ad4b0 100644 --- a/tests/await/005-awaitAnyOrFail_basic.phpt +++ b/tests/await/005-awaitAnyOrFail_basic.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAnyOrFail() - basic usage with multiple coroutines +await_any_or_fail() - basic usage with multiple coroutines --FILE-- getMessage() . "\n"; diff --git a/tests/await/008-awaitFirstSuccess_basic.phpt b/tests/await/008-awaitFirstSuccess_basic.phpt index 4d3219b..7b4d01f 100644 --- a/tests/await/008-awaitFirstSuccess_basic.phpt +++ b/tests/await/008-awaitFirstSuccess_basic.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitFirstSuccess() - basic usage with mixed success and error +await_first_success() - basic usage with mixed success and error --FILE-- diff --git a/tests/await/009-awaitFirstSuccess_all_errors.phpt b/tests/await/009-awaitFirstSuccess_all_errors.phpt index 8ed6a56..e4b38e3 100644 --- a/tests/await/009-awaitFirstSuccess_all_errors.phpt +++ b/tests/await/009-awaitFirstSuccess_all_errors.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitFirstSuccess() - all coroutines throw exceptions +await_first_success() - all coroutines throw exceptions --FILE-- getMessage() . "\n"; diff --git a/tests/await/012-awaitAll_basic.phpt b/tests/await/012-awaitAll_basic.phpt index 661a412..f510dea 100644 --- a/tests/await/012-awaitAll_basic.phpt +++ b/tests/await/012-awaitAll_basic.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAll() - basic usage with mixed success and error +await_all() - basic usage with mixed success and error --FILE-- = 2 ? "OK" : "FALSE: ".count($results); echo "Count of results: $countOfResults\n"; diff --git a/tests/await/015-awaitAnyOfOrFail_count_zero.phpt b/tests/await/015-awaitAnyOfOrFail_count_zero.phpt index f4ed891..ad71828 100644 --- a/tests/await/015-awaitAnyOfOrFail_count_zero.phpt +++ b/tests/await/015-awaitAnyOfOrFail_count_zero.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAnyOfOrFail() - count is zero +await_any_of_or_fail() - count is zero --FILE-- = 2 ? "OK" : "FALSE: ".count($result[0]); $countOfErrors = count($result[1]) == 1 ? "OK" : "FALSE: ".count($result[1]); diff --git a/tests/await/017-awaitAnyOf_all_success.phpt b/tests/await/017-awaitAnyOf_all_success.phpt index a092868..fb0fea2 100644 --- a/tests/await/017-awaitAnyOf_all_success.phpt +++ b/tests/await/017-awaitAnyOf_all_success.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAnyOf() - all coroutines succeed +await_any_of() - all coroutines succeed --FILE-- = 2 ? "OK" : "FALSE: ".count($result[0]); $countOfErrors = count($result[1]) == 0 ? "OK" : "FALSE: ".count($result[1]); diff --git a/tests/await/018-awaitAllOrFail_double_free.phpt b/tests/await/018-awaitAllOrFail_double_free.phpt index a87ddab..a1e2bf7 100644 --- a/tests/await/018-awaitAllOrFail_double_free.phpt +++ b/tests/await/018-awaitAllOrFail_double_free.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAllOrFail() - test for double free issue with many coroutines +await_all_or_fail() - test for double free issue with many coroutines --FILE-- = 2 ? "OK" : "FALSE: ".count($results); echo "Count of results: $countOfResults\n"; diff --git a/tests/await/024-awaitAnyOf_iterator.phpt b/tests/await/024-awaitAnyOf_iterator.phpt index d314104..b3d3ae7 100644 --- a/tests/await/024-awaitAnyOf_iterator.phpt +++ b/tests/await/024-awaitAnyOf_iterator.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAnyOf() - with Iterator +await_any_of() - with Iterator --FILE-- = 2 ? "OK" : "FALSE: ".count($result[0]); $countOfErrors = count($result[1]) == 1 ? "OK" : "FALSE: ".count($result[1]); diff --git a/tests/await/025-awaitAllOrFail_generator.phpt b/tests/await/025-awaitAllOrFail_generator.phpt index 0dd553b..c66bdad 100644 --- a/tests/await/025-awaitAllOrFail_generator.phpt +++ b/tests/await/025-awaitAllOrFail_generator.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAllOrFail() - with Generator +await_all_or_fail() - with Generator --FILE-- = 2 ? "OK" : "FALSE: ".count($results); echo "Count of results: $countOfResults\n"; diff --git a/tests/await/030-awaitAnyOf_generator.phpt b/tests/await/030-awaitAnyOf_generator.phpt index 0dd6cd8..d4959bf 100644 --- a/tests/await/030-awaitAnyOf_generator.phpt +++ b/tests/await/030-awaitAnyOf_generator.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAnyOf() - with Generator +await_any_of() - with Generator --FILE-- = 2 ? "OK" : "FALSE: ".count($result[0]); $countOfErrors = count($result[1]) == 1 ? "OK" : "FALSE: ".count($result[1]); diff --git a/tests/await/031-awaitAllOrFail_with_interruption.phpt b/tests/await/031-awaitAllOrFail_with_interruption.phpt index b3c07a9..51ba078 100644 --- a/tests/await/031-awaitAllOrFail_with_interruption.phpt +++ b/tests/await/031-awaitAllOrFail_with_interruption.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAllOrFail() - With an unexpected interruption of execution. +await_all_or_fail() - With an unexpected interruption of execution. --FILE-- throw new Exception("Unexpected interruption")); $iterator = new TestIterator($functions); -$results = awaitAllOrFail($iterator); +$results = await_all_or_fail($iterator); $countOfResults = count($results) == 3 ? "OK" : "FALSE: ".count($results); echo "Count of results: $countOfResults\n"; diff --git a/tests/await/032-awaitAnyOrFail_with_interruption.phpt b/tests/await/032-awaitAnyOrFail_with_interruption.phpt index ce844d0..47746da 100644 --- a/tests/await/032-awaitAnyOrFail_with_interruption.phpt +++ b/tests/await/032-awaitAnyOrFail_with_interruption.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAnyOrFail() - With an unexpected interruption of execution. +await_any_or_fail() - With an unexpected interruption of execution. --FILE-- throw new Exception("Unexpected interruption")); $iterator = new TestIterator($functions); -$result = awaitAnyOrFail($iterator); +$result = await_any_or_fail($iterator); echo "Result: $result\n"; echo "end\n"; diff --git a/tests/await/033-awaitFirstSuccess_with_interruption.phpt b/tests/await/033-awaitFirstSuccess_with_interruption.phpt index 11e41de..d1538c7 100644 --- a/tests/await/033-awaitFirstSuccess_with_interruption.phpt +++ b/tests/await/033-awaitFirstSuccess_with_interruption.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitFirstSuccess() - With an unexpected interruption of execution. +await_first_success() - With an unexpected interruption of execution. --FILE-- throw new Exception("Unexpected interruption")); $iterator = new TestIterator($functions); -$result = awaitFirstSuccess($iterator); +$result = await_first_success($iterator); echo "Result: {$result[0]}\n"; echo "end\n"; diff --git a/tests/await/034-awaitAllOrFail_preserve_key_order.phpt b/tests/await/034-awaitAllOrFail_preserve_key_order.phpt index 5aff864..d811c69 100644 --- a/tests/await/034-awaitAllOrFail_preserve_key_order.phpt +++ b/tests/await/034-awaitAllOrFail_preserve_key_order.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAllOrFail() - with fillNull parameter +await_all_or_fail() - with fillNull parameter --FILE-- getMessage() . "\n"; diff --git a/tests/await/052-awaitAnyOrFail_iterator_exception.phpt b/tests/await/052-awaitAnyOrFail_iterator_exception.phpt index 083a2b4..fc75240 100644 --- a/tests/await/052-awaitAnyOrFail_iterator_exception.phpt +++ b/tests/await/052-awaitAnyOrFail_iterator_exception.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAnyOrFail() - Exception in iterator current() should stop process immediately +await_any_or_fail() - Exception in iterator current() should stop process immediately --FILE-- getMessage() . "\n"; diff --git a/tests/await/053-awaitFirstSuccess_iterator_exception.phpt b/tests/await/053-awaitFirstSuccess_iterator_exception.phpt index f18bfbf..6498899 100644 --- a/tests/await/053-awaitFirstSuccess_iterator_exception.phpt +++ b/tests/await/053-awaitFirstSuccess_iterator_exception.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitFirstSuccess() - Exception in iterator current() should stop process immediately +await_first_success() - Exception in iterator current() should stop process immediately --FILE-- getMessage() . "\n"; diff --git a/tests/await/054-awaitAllOrFail_generator_exception.phpt b/tests/await/054-awaitAllOrFail_generator_exception.phpt index 79f3863..d1a5657 100644 --- a/tests/await/054-awaitAllOrFail_generator_exception.phpt +++ b/tests/await/054-awaitAllOrFail_generator_exception.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAllOrFail() - Exception in generator body should stop process immediately +await_all_or_fail() - Exception in generator body should stop process immediately --FILE-- getMessage() . "\n"; diff --git a/tests/await/055-awaitAnyOrFail_generator_exception.phpt b/tests/await/055-awaitAnyOrFail_generator_exception.phpt index 9c3d8b0..4748550 100644 --- a/tests/await/055-awaitAnyOrFail_generator_exception.phpt +++ b/tests/await/055-awaitAnyOrFail_generator_exception.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAnyOrFail() - Exception in generator body should stop process immediately +await_any_or_fail() - Exception in generator body should stop process immediately --FILE-- getMessage() . "\n"; diff --git a/tests/await/056-awaitFirstSuccess_generator_exception.phpt b/tests/await/056-awaitFirstSuccess_generator_exception.phpt index 4927929..2ff6197 100644 --- a/tests/await/056-awaitFirstSuccess_generator_exception.phpt +++ b/tests/await/056-awaitFirstSuccess_generator_exception.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitFirstSuccess() - Exception in generator body should stop process immediately +await_first_success() - Exception in generator body should stop process immediately --FILE-- getMessage() . "\n"; diff --git a/tests/await/057-awaitAllOrFail_iterator_next_exception.phpt b/tests/await/057-awaitAllOrFail_iterator_next_exception.phpt index d234826..a08b981 100644 --- a/tests/await/057-awaitAllOrFail_iterator_next_exception.phpt +++ b/tests/await/057-awaitAllOrFail_iterator_next_exception.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAllOrFail() - Exception in iterator next() should stop process immediately +await_all_or_fail() - Exception in iterator next() should stop process immediately --FILE-- getMessage() . "\n"; diff --git a/tests/await/058-awaitAnyOrFail_iterator_valid_exception.phpt b/tests/await/058-awaitAnyOrFail_iterator_valid_exception.phpt index 9fc44d7..b3eeb0e 100644 --- a/tests/await/058-awaitAnyOrFail_iterator_valid_exception.phpt +++ b/tests/await/058-awaitAnyOrFail_iterator_valid_exception.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAnyOrFail() - Exception in iterator valid() should stop process immediately +await_any_or_fail() - Exception in iterator valid() should stop process immediately --FILE-- getMessage() . "\n"; diff --git a/tests/await/059-awaitAllOrFail-with-duplicates.phpt b/tests/await/059-awaitAllOrFail-with-duplicates.phpt index 272b6b6..060d92d 100644 --- a/tests/await/059-awaitAllOrFail-with-duplicates.phpt +++ b/tests/await/059-awaitAllOrFail-with-duplicates.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAllOrFail() - with duplicates +await_all_or_fail() - with duplicates --FILE-- getMessage() . "\n"; } diff --git a/tests/await/060-await_empty_iterable_edge_cases.phpt b/tests/await/060-await_empty_iterable_edge_cases.phpt index 3fd9b9d..195de4c 100644 --- a/tests/await/060-await_empty_iterable_edge_cases.phpt +++ b/tests/await/060-await_empty_iterable_edge_cases.phpt @@ -1,21 +1,21 @@ --TEST-- -awaitAll() - empty iterators basic functionality +await_all() - empty iterators basic functionality --FILE-- getMessage() . "\n"; diff --git a/tests/await/062-await_iterator_exception_valid.phpt b/tests/await/062-await_iterator_exception_valid.phpt index 17590be..918bb04 100644 --- a/tests/await/062-await_iterator_exception_valid.phpt +++ b/tests/await/062-await_iterator_exception_valid.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAll() - iterator exception in valid() method +await_all() - iterator exception in valid() method --FILE-- getMessage() . "\n"; diff --git a/tests/await/063-await_iterator_exception_current.phpt b/tests/await/063-await_iterator_exception_current.phpt index 22e9ffc..d8d2882 100644 --- a/tests/await/063-await_iterator_exception_current.phpt +++ b/tests/await/063-await_iterator_exception_current.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAll() - iterator exception in current() method +await_all() - iterator exception in current() method --FILE-- getMessage() . "\n"; diff --git a/tests/await/064-await_object_key_error.phpt b/tests/await/064-await_object_key_error.phpt index ec0ecd0..6093c08 100644 --- a/tests/await/064-await_object_key_error.phpt +++ b/tests/await/064-await_object_key_error.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAll() - iterator with object keys error +await_all() - iterator with object keys error --FILE-- getMessage() . "\n"; diff --git a/tests/await/065-await_resource_key_error.phpt b/tests/await/065-await_resource_key_error.phpt index d78f26c..9dba7bb 100644 --- a/tests/await/065-await_resource_key_error.phpt +++ b/tests/await/065-await_resource_key_error.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAll() - iterator with resource keys error +await_all() - iterator with resource keys error --FILE-- getMessage() . "\n"; diff --git a/tests/await/071-awaitAll_with_cancellation_simultaneously.phpt b/tests/await/071-awaitAll_with_cancellation_simultaneously.phpt index 38849ee..4d0b9e3 100644 --- a/tests/await/071-awaitAll_with_cancellation_simultaneously.phpt +++ b/tests/await/071-awaitAll_with_cancellation_simultaneously.phpt @@ -1,10 +1,10 @@ --TEST-- -awaitAll() - The object used to cancel the wait is simultaneously the object being awaited. +await_all() - The object used to cancel the wait is simultaneously the object being awaited. --FILE-- diff --git a/tests/context/001-context_basic.phpt b/tests/context/001-context_basic.phpt index 1e778a5..bea6ce2 100644 --- a/tests/context/001-context_basic.phpt +++ b/tests/context/001-context_basic.phpt @@ -6,7 +6,7 @@ Context basic functionality use Async\{Context}; // Test basic context creation and storage -$context = Async\coroutineContext(); +$context = Async\coroutine_context(); // Test string key storage $context->set('user_id', 123); diff --git a/tests/context/002-context_inheritance.phpt b/tests/context/002-context_inheritance.phpt index a3a52b3..41b0b7d 100644 --- a/tests/context/002-context_inheritance.phpt +++ b/tests/context/002-context_inheritance.phpt @@ -4,7 +4,7 @@ Context inheritance through scope hierarchy spawn(function() { echo "parent coroutine started\n"; - $context = \Async\currentContext(); + $context = \Async\current_context(); // Set values in parent context $context->set('parent_key', 'parent_value'); @@ -35,7 +35,7 @@ $child_scope = \Async\Scope::inherit($parent_scope); $child_coroutine = $child_scope->spawn(function() { echo "child coroutine started\n"; - $context = \Async\currentContext(); + $context = \Async\current_context(); // Test find() - should find parent values echo "find parent_key: " . ($context->find('parent_key') ?: 'null') . "\n"; diff --git a/tests/context/003-coroutine_getContext.phpt b/tests/context/003-coroutine_getContext.phpt index 651adc6..7384bdc 100644 --- a/tests/context/003-coroutine_getContext.phpt +++ b/tests/context/003-coroutine_getContext.phpt @@ -7,11 +7,11 @@ use Async\{Context, Coroutine}; // Test coroutine with context $coroutine = Async\spawn(function() { - $context = Async\coroutineContext(); + $context = Async\coroutine_context(); $context->set('test_key', 'test_value'); // Get context from coroutine - $currentCoroutine = Async\currentCoroutine(); + $currentCoroutine = Async\current_coroutine(); $contextFromCoroutine = $currentCoroutine->getContext(); if ($contextFromCoroutine !== null) { diff --git a/tests/context/004-context_error_handling.phpt b/tests/context/004-context_error_handling.phpt index 1af81f6..101cd2d 100644 --- a/tests/context/004-context_error_handling.phpt +++ b/tests/context/004-context_error_handling.phpt @@ -5,7 +5,7 @@ Context error handling use Async\{Context}; -$context = Async\coroutineContext(); +$context = Async\coroutine_context(); // Test invalid key types try { diff --git a/tests/context/005-context_object_keys.phpt b/tests/context/005-context_object_keys.phpt index 223b5e2..9816c3a 100644 --- a/tests/context/005-context_object_keys.phpt +++ b/tests/context/005-context_object_keys.phpt @@ -5,7 +5,7 @@ Context with object keys use Async\{Context}; -$context = Async\coroutineContext(); +$context = Async\coroutine_context(); // Test different object types as keys $stdObj = new stdClass(); diff --git a/tests/coroutine/032-coroutine_composite_exception.phpt b/tests/coroutine/032-coroutine_composite_exception.phpt index 6b0ab19..db36463 100644 --- a/tests/coroutine/032-coroutine_composite_exception.phpt +++ b/tests/coroutine/032-coroutine_composite_exception.phpt @@ -5,7 +5,7 @@ CompositeException with multiple finally handlers use function Async\spawn; use function Async\suspend; -use function Async\currentCoroutine; +use function Async\current_coroutine; use function Async\await; echo "start\n"; @@ -27,7 +27,7 @@ $scope->setExceptionHandler(function($scope, $coroutine, $exception) { $composite_coroutine = $scope->spawn(function() { echo "composite coroutine started\n"; - $coroutine = \Async\currentCoroutine(); + $coroutine = \Async\current_coroutine(); // Add multiple finally handlers that throw $coroutine->onFinally(function() { diff --git a/tests/coroutine/033-coroutine_onFinally_invalid_callback.phpt b/tests/coroutine/033-coroutine_onFinally_invalid_callback.phpt index 8d55ff1..4b76032 100644 --- a/tests/coroutine/033-coroutine_onFinally_invalid_callback.phpt +++ b/tests/coroutine/033-coroutine_onFinally_invalid_callback.phpt @@ -5,14 +5,14 @@ Coroutine onFinally with invalid callback parameters use function Async\spawn; use function Async\suspend; -use function Async\currentCoroutine; +use function Async\current_coroutine; echo "start\n"; $invalid_finally_coroutine = spawn(function() { echo "invalid finally coroutine started\n"; - $coroutine = \Async\currentCoroutine(); + $coroutine = \Async\current_coroutine(); // Test invalid callback types try { diff --git a/tests/coroutine/036-coroutine_gc_circular_finally.phpt b/tests/coroutine/036-coroutine_gc_circular_finally.phpt index 66188ed..00b636f 100644 --- a/tests/coroutine/036-coroutine_gc_circular_finally.phpt +++ b/tests/coroutine/036-coroutine_gc_circular_finally.phpt @@ -5,7 +5,7 @@ Coroutine: Circular references between coroutines and finally handlers use function Async\spawn; use function Async\suspend; -use function Async\currentCoroutine; +use function Async\current_coroutine; use function Async\await; echo "start\n"; @@ -13,7 +13,7 @@ echo "start\n"; $circular_finally_coroutine = spawn(function() { echo "circular finally coroutine started\n"; - $coroutine = \Async\currentCoroutine(); + $coroutine = \Async\current_coroutine(); $data = new \stdClass(); $data->coroutine = $coroutine; diff --git a/tests/curl/001-curl_exec_basic.phpt b/tests/curl/001-curl_exec_basic.phpt index 5133ed9..d04b978 100644 --- a/tests/curl/001-curl_exec_basic.phpt +++ b/tests/curl/001-curl_exec_basic.phpt @@ -8,7 +8,7 @@ require_once __DIR__ . '/../common/http_server.php'; use function Async\spawn; use function Async\await; -use function Async\awaitAll; +use function Async\await_all; // Start our test server $server = async_test_server_start(); @@ -110,7 +110,7 @@ $coroutines = [ spawn(fn() => test_error_handling($server)) ]; -$results = awaitAll($coroutines); +$results = await_all($coroutines); echo "All tests completed successfully\n"; echo "Test end\n"; diff --git a/tests/curl/002-concurrent_requests.phpt b/tests/curl/002-concurrent_requests.phpt index 35601ad..d5cf80e 100644 --- a/tests/curl/002-concurrent_requests.phpt +++ b/tests/curl/002-concurrent_requests.phpt @@ -7,7 +7,7 @@ curl require_once __DIR__ . '/../common/http_server.php'; use function Async\spawn; -use function Async\awaitAll; +use function Async\await_all; $server = async_test_server_start(); @@ -40,7 +40,7 @@ $coroutines = [ spawn(fn() => make_request(3, $server)), ]; -[$results, $exceptions] = awaitAll($coroutines); +[$results, $exceptions] = await_all($coroutines); // Collect and sort messages $start_messages = []; diff --git a/tests/curl/005-error_handling.phpt b/tests/curl/005-error_handling.phpt index 5de9331..c2ae559 100644 --- a/tests/curl/005-error_handling.phpt +++ b/tests/curl/005-error_handling.phpt @@ -7,7 +7,7 @@ curl require_once __DIR__ . '/../common/http_server.php'; use function Async\spawn; -use function Async\awaitAll; +use function Async\await_all; $server = async_test_server_start(); @@ -78,7 +78,7 @@ $coroutines = [ spawn(fn() => test_not_found($server)), ]; -$results = awaitAll($coroutines); +$results = await_all($coroutines); echo "Test end\n"; diff --git a/tests/curl/009-curl_with_coroutines.phpt b/tests/curl/009-curl_with_coroutines.phpt index 784882e..7bc2d00 100644 --- a/tests/curl/009-curl_with_coroutines.phpt +++ b/tests/curl/009-curl_with_coroutines.phpt @@ -8,7 +8,7 @@ require_once __DIR__ . '/../common/http_server.php'; use function Async\spawn; use function Async\await; -use function Async\awaitAll; +use function Async\await_all; $server = async_test_server_start(); @@ -40,7 +40,7 @@ $coroutines = [ spawn(fn() => make_curl_request($server, 3)) ]; -[$results, $exceptions] = awaitAll($coroutines); +[$results, $exceptions] = await_all($coroutines); // Collect and sort messages $start_messages = []; diff --git a/tests/dns/004-concurrent_dns_lookups.phpt b/tests/dns/004-concurrent_dns_lookups.phpt index 4f5de50..7fa5ce8 100644 --- a/tests/dns/004-concurrent_dns_lookups.phpt +++ b/tests/dns/004-concurrent_dns_lookups.phpt @@ -4,7 +4,7 @@ Concurrent DNS lookups in async context getMessage() . "\n"; } diff --git a/tests/edge_cases/006-scheduler_graceful_shutdown_exceptions.phpt b/tests/edge_cases/006-scheduler_graceful_shutdown_exceptions.phpt index 87c7f82..9b7518c 100644 --- a/tests/edge_cases/006-scheduler_graceful_shutdown_exceptions.phpt +++ b/tests/edge_cases/006-scheduler_graceful_shutdown_exceptions.phpt @@ -4,9 +4,9 @@ Scheduler: graceful shutdown with exception handling getMessage() . "\n"; diff --git a/tests/exec/007-exec_vs_shell_exec_comparison.phpt b/tests/exec/007-exec_vs_shell_exec_comparison.phpt index febb112..96d9b7b 100644 --- a/tests/exec/007-exec_vs_shell_exec_comparison.phpt +++ b/tests/exec/007-exec_vs_shell_exec_comparison.phpt @@ -10,7 +10,7 @@ if (!function_exists("exec") || !function_exists("shell_exec")) { cancel(); suspend(); // Allow cancellation to propagate -$coroutines = getCoroutines(); +$coroutines = get_coroutines(); echo "After first cancel count: " . count($coroutines) . "\n"; $c2->cancel(); suspend(); // Allow cancellation to propagate -$coroutines = getCoroutines(); +$coroutines = get_coroutines(); echo "After second cancel count: " . count($coroutines) . "\n"; echo "end\n"; diff --git a/tests/info/002-info_getCoroutines_integration.phpt b/tests/info/002-info_getCoroutines_integration.phpt index 19259c2..bb59772 100644 --- a/tests/info/002-info_getCoroutines_integration.phpt +++ b/tests/info/002-info_getCoroutines_integration.phpt @@ -1,18 +1,18 @@ --TEST-- -getCoroutines() - integration with coroutine lifecycle management +get_coroutines() - integration with coroutine lifecycle management --FILE-- $coroutine) { if (!in_array($coroutine, $all_coroutines, true)) { - echo "ERROR: Coroutine $index not found in getCoroutines()\n"; + echo "ERROR: Coroutine $index not found in get_coroutines()\n"; } } if (!in_array($currentCoroutine, $all_coroutines, true)) { - echo "ERROR: Current coroutine not found in getCoroutines()\n"; + echo "ERROR: Current coroutine not found in get_coroutines()\n"; } foreach ($coroutines as $index => $coroutine) { @@ -55,14 +55,14 @@ foreach ($coroutines as $index => $coroutine) { echo "Coroutine {$index} is isCancellationRequested: " . ($coroutine->isCancellationRequested() ? "true" : "false") . "\n"; } -[$results, $exceptions] = awaitAll($coroutines); // Ensure we yield to allow cancellation to take effect +[$results, $exceptions] = await_all($coroutines); // Ensure we yield to allow cancellation to take effect -$after_partial_cancel = count(getCoroutines()) - $initial_count; +$after_partial_cancel = count(get_coroutines()) - $initial_count; echo "After cancelling 2: {$after_partial_cancel}\n"; echo "Completed results: " . count($results) . "\n"; -$final_count = count(getCoroutines()) - $initial_count; +$final_count = count(get_coroutines()) - $initial_count; echo "Final count: {$final_count}\n"; echo "end\n"; diff --git a/tests/mysqli/003-mysqli_concurrent_connections.phpt b/tests/mysqli/003-mysqli_concurrent_connections.phpt index 8162c2d..8be44f1 100644 --- a/tests/mysqli/003-mysqli_concurrent_connections.phpt +++ b/tests/mysqli/003-mysqli_concurrent_connections.phpt @@ -15,7 +15,7 @@ require_once __DIR__ . '/inc/async_mysqli_test.inc'; use function Async\spawn; use function Async\await; -use function Async\awaitAllOrFail; +use function Async\await_all_or_fail; echo "start\n"; @@ -61,7 +61,7 @@ $coroutines = [ }) ]; -$results = awaitAllOrFail($coroutines); +$results = await_all_or_fail($coroutines); // Display results in deterministic order usort($results, function($a, $b) { diff --git a/tests/mysqli/007-mysqli_error_scenarios.phpt b/tests/mysqli/007-mysqli_error_scenarios.phpt index c4930f8..be0aef2 100644 --- a/tests/mysqli/007-mysqli_error_scenarios.phpt +++ b/tests/mysqli/007-mysqli_error_scenarios.phpt @@ -15,7 +15,7 @@ require_once __DIR__ . '/inc/async_mysqli_test.inc'; use function Async\spawn; use function Async\await; -use function Async\awaitAllOrFail; +use function Async\await_all_or_fail; echo "start\n"; @@ -105,7 +105,7 @@ $error_test4 = spawn(function() { }); echo "waiting for all error tests\n"; -$results = awaitAllOrFail([$error_test1, $error_test2, $error_test3, $error_test4]); +$results = await_all_or_fail([$error_test1, $error_test2, $error_test3, $error_test4]); // Sort results by type for consistent output usort($results, function($a, $b) { diff --git a/tests/mysqli/010-mysqli_cleanup_async.phpt b/tests/mysqli/010-mysqli_cleanup_async.phpt index 7357688..4fcfac5 100644 --- a/tests/mysqli/010-mysqli_cleanup_async.phpt +++ b/tests/mysqli/010-mysqli_cleanup_async.phpt @@ -15,7 +15,7 @@ require_once __DIR__ . '/inc/async_mysqli_test.inc'; use function Async\spawn; use function Async\await; -use function Async\awaitAllOrFail; +use function Async\await_all_or_fail; echo "start\n"; @@ -147,7 +147,7 @@ $cleanup_coroutines[] = spawn(function() { }); echo "waiting for all cleanup tests\n"; -$results = awaitAllOrFail($cleanup_coroutines); +$results = await_all_or_fail($cleanup_coroutines); // Sort results by id for consistent output usort($results, function($a, $b) { diff --git a/tests/pdo_mysql/003-pdo_multiple_coroutines.phpt b/tests/pdo_mysql/003-pdo_multiple_coroutines.phpt index 820bd52..d0b0157 100644 --- a/tests/pdo_mysql/003-pdo_multiple_coroutines.phpt +++ b/tests/pdo_mysql/003-pdo_multiple_coroutines.phpt @@ -15,7 +15,7 @@ require_once __DIR__ . '/inc/async_pdo_mysql_test.inc'; use function Async\spawn; use function Async\await; -use function Async\awaitAllOrFail; +use function Async\await_all_or_fail; echo "start\n"; @@ -49,7 +49,7 @@ $coroutines = [ }) ]; -$connectionIds = awaitAllOrFail($coroutines); +$connectionIds = await_all_or_fail($coroutines); // Verify all connections are different $uniqueIds = array_unique($connectionIds); diff --git a/tests/pdo_mysql/005-pdo_concurrent_queries.phpt b/tests/pdo_mysql/005-pdo_concurrent_queries.phpt index 1edb173..d71212e 100644 --- a/tests/pdo_mysql/005-pdo_concurrent_queries.phpt +++ b/tests/pdo_mysql/005-pdo_concurrent_queries.phpt @@ -15,7 +15,7 @@ require_once __DIR__ . '/inc/async_pdo_mysql_test.inc'; use function Async\spawn; use function Async\await; -use function Async\awaitAllOrFail; +use function Async\await_all_or_fail; echo "start\n"; @@ -56,7 +56,7 @@ $coroutines = [ ]; echo "waiting for all queries\n"; -$results = awaitAllOrFail($coroutines); +$results = await_all_or_fail($coroutines); echo "all queries completed\n"; echo "results count: " . count($results) . "\n"; diff --git a/tests/pdo_mysql/006-pdo_connection_isolation.phpt b/tests/pdo_mysql/006-pdo_connection_isolation.phpt index 3e2f718..edab344 100644 --- a/tests/pdo_mysql/006-pdo_connection_isolation.phpt +++ b/tests/pdo_mysql/006-pdo_connection_isolation.phpt @@ -15,7 +15,7 @@ require_once __DIR__ . '/inc/async_pdo_mysql_test.inc'; use function Async\spawn; use function Async\await; -use function Async\awaitAllOrFail; +use function Async\await_all_or_fail; echo "start\n"; @@ -61,7 +61,7 @@ $coroutines = [ }) ]; -$results = awaitAllOrFail($coroutines); +$results = await_all_or_fail($coroutines); // Sort results by type for deterministic output usort($results, function($a, $b) { diff --git a/tests/pdo_mysql/007-pdo_error_handling_async.phpt b/tests/pdo_mysql/007-pdo_error_handling_async.phpt index 1958a31..91e9f59 100644 --- a/tests/pdo_mysql/007-pdo_error_handling_async.phpt +++ b/tests/pdo_mysql/007-pdo_error_handling_async.phpt @@ -15,7 +15,7 @@ require_once __DIR__ . '/inc/async_pdo_mysql_test.inc'; use function Async\spawn; use function Async\await; -use function Async\awaitAllOrFail; +use function Async\await_all_or_fail; echo "start\n"; @@ -90,7 +90,7 @@ $coroutine4 = spawn(function() { }); echo "waiting for all error handling tests\n"; -$results = awaitAllOrFail([$coroutine1, $coroutine2, $coroutine3, $coroutine4]); +$results = await_all_or_fail([$coroutine1, $coroutine2, $coroutine3, $coroutine4]); // Sort results by type for deterministic output usort($results, function($a, $b) { diff --git a/tests/pdo_mysql/010-pdo_resource_cleanup.phpt b/tests/pdo_mysql/010-pdo_resource_cleanup.phpt index fdbf7f5..0fd46d8 100644 --- a/tests/pdo_mysql/010-pdo_resource_cleanup.phpt +++ b/tests/pdo_mysql/010-pdo_resource_cleanup.phpt @@ -15,7 +15,7 @@ require_once __DIR__ . '/inc/async_pdo_mysql_test.inc'; use function Async\spawn; use function Async\await; -use function Async\awaitAllOrFail; +use function Async\await_all_or_fail; echo "start\n"; @@ -96,7 +96,7 @@ $coroutines[] = spawn(function() { }); echo "waiting for all coroutines to complete\n"; -$results = awaitAllOrFail($coroutines); +$results = await_all_or_fail($coroutines); // Sort results by coroutine_id for deterministic output usort($results, function($a, $b) { diff --git a/tests/pdo_mysql/011-concurrent_database_operations.phpt b/tests/pdo_mysql/011-concurrent_database_operations.phpt index 37f2b20..7dd3297 100644 --- a/tests/pdo_mysql/011-concurrent_database_operations.phpt +++ b/tests/pdo_mysql/011-concurrent_database_operations.phpt @@ -15,7 +15,7 @@ require_once __DIR__ . '/inc/async_pdo_mysql_test.inc'; use function Async\spawn; use function Async\await; -use function Async\awaitAllOrFail; +use function Async\await_all_or_fail; echo "start\n"; @@ -51,7 +51,7 @@ $result = AsyncPDOMySQLTest::runAsyncTest(function($pdo, $tableName) { }) ]; - $results = awaitAllOrFail($coroutines); + $results = await_all_or_fail($coroutines); // Check final state $stmt = $pdo->query("SELECT COUNT(*) as total FROM {$tableName}"); diff --git a/tests/pdo_mysql/012-transaction_isolation_test.phpt b/tests/pdo_mysql/012-transaction_isolation_test.phpt index b348c05..8ae98f7 100644 --- a/tests/pdo_mysql/012-transaction_isolation_test.phpt +++ b/tests/pdo_mysql/012-transaction_isolation_test.phpt @@ -15,7 +15,7 @@ require_once __DIR__ . '/inc/async_pdo_mysql_test.inc'; use function Async\spawn; use function Async\await; -use function Async\awaitAllOrFail; +use function Async\await_all_or_fail; echo "start\n"; diff --git a/tests/pdo_mysql/013-order_independent_concurrent_test.phpt b/tests/pdo_mysql/013-order_independent_concurrent_test.phpt index 4b0cfbf..c6c6be7 100644 --- a/tests/pdo_mysql/013-order_independent_concurrent_test.phpt +++ b/tests/pdo_mysql/013-order_independent_concurrent_test.phpt @@ -15,7 +15,7 @@ require_once __DIR__ . '/inc/async_pdo_mysql_test.inc'; use function Async\spawn; use function Async\await; -use function Async\awaitAllOrFail; +use function Async\await_all_or_fail; echo "start\n"; diff --git a/tests/scope/031-scope_concurrent_cancellation.phpt b/tests/scope/031-scope_concurrent_cancellation.phpt index bf1f178..4f1e7aa 100644 --- a/tests/scope/031-scope_concurrent_cancellation.phpt +++ b/tests/scope/031-scope_concurrent_cancellation.phpt @@ -6,7 +6,7 @@ Concurrent scope cancellation and race conditions use function Async\spawn; use function Async\suspend; use function Async\await; -use function Async\awaitAll; +use function Async\await_all; echo "start\n"; @@ -65,7 +65,7 @@ $canceller3 = spawn(function() use ($scope3) { echo "cancellers spawned\n"; -awaitAll([$canceller1, $canceller2, $canceller3]); +await_all([$canceller1, $canceller2, $canceller3]); echo "all cancellers completed\n"; diff --git a/tests/scope/033-scope_cancellation_finally_handlers.phpt b/tests/scope/033-scope_cancellation_finally_handlers.phpt index c46ce60..230c3ca 100644 --- a/tests/scope/033-scope_cancellation_finally_handlers.phpt +++ b/tests/scope/033-scope_cancellation_finally_handlers.phpt @@ -15,7 +15,7 @@ $scope = new \Async\Scope()->asNotSafely(); $coroutine_with_finally = $scope->spawn(function() { echo "coroutine with finally started\n"; - $coroutine = \Async\currentCoroutine(); + $coroutine = \Async\current_coroutine(); $coroutine->onFinally(function() { echo "finally handler 1 executed\n"; @@ -42,7 +42,7 @@ $child_scope = \Async\Scope::inherit($scope); $child_coroutine = $child_scope->spawn(function() { echo "child coroutine started\n"; - $coroutine = \Async\currentCoroutine(); + $coroutine = \Async\current_coroutine(); $coroutine->onFinally(function() { echo "child finally handler executed\n"; diff --git a/tests/scope/034-scope_cancellation_double_error.phpt b/tests/scope/034-scope_cancellation_double_error.phpt index b60dd6c..0452738 100644 --- a/tests/scope/034-scope_cancellation_double_error.phpt +++ b/tests/scope/034-scope_cancellation_double_error.phpt @@ -17,7 +17,7 @@ $scope = new \Async\Scope(); $coroutine_with_finally = $scope->spawn(function() { echo "coroutine with finally started\n"; - $coroutine = \Async\currentCoroutine(); + $coroutine = \Async\current_coroutine(); $coroutine->onFinally(function() { echo "finally handler 3 executed\n"; @@ -35,7 +35,7 @@ $child_scope = \Async\Scope::inherit($scope); $child_coroutine = $child_scope->spawn(function() { echo "child coroutine started\n"; - $coroutine = \Async\currentCoroutine(); + $coroutine = \Async\current_coroutine(); some_function(); }); diff --git a/tests/socket_ext/001-socket_read_async.phpt b/tests/socket_ext/001-socket_read_async.phpt index 04f756d..2cd2968 100644 --- a/tests/socket_ext/001-socket_read_async.phpt +++ b/tests/socket_ext/001-socket_read_async.phpt @@ -10,7 +10,7 @@ if (!extension_loaded('sockets')) { diff --git a/tests/socket_ext/004-socket_connect_async.phpt b/tests/socket_ext/004-socket_connect_async.phpt index 1b9f372..9855045 100644 --- a/tests/socket_ext/004-socket_connect_async.phpt +++ b/tests/socket_ext/004-socket_connect_async.phpt @@ -10,7 +10,7 @@ if (!extension_loaded('sockets')) { getMessage() . "\n"; } // Test with array try { - spawnWith([], function() {}); + spawn_with([], function() {}); } catch (TypeError $e) { echo "caught TypeError for array\n"; } // Test with stdClass try { - spawnWith(new stdClass(), function() {}); + spawn_with(new stdClass(), function() {}); } catch (TypeError $e) { echo "caught TypeError for stdClass\n"; } diff --git a/tests/spawnWith/011-spawnWith_missing_parameters.phpt b/tests/spawnWith/011-spawnWith_missing_parameters.phpt index 07c37ef..cfffcb2 100644 --- a/tests/spawnWith/011-spawnWith_missing_parameters.phpt +++ b/tests/spawnWith/011-spawnWith_missing_parameters.phpt @@ -3,20 +3,20 @@ Async\spawnWith: missing required parameters --FILE-- getMessage() . "\n"; } // Test with only provider try { - spawnWith(new Async\Scope()); + spawn_with(new Async\Scope()); } catch (ArgumentCountError $e) { echo "caught ArgumentCountError for missing callable\n"; } diff --git a/tests/spawnWith/012-spawnWith_invalid_callable.phpt b/tests/spawnWith/012-spawnWith_invalid_callable.phpt index 5faff3e..45ec724 100644 --- a/tests/spawnWith/012-spawnWith_invalid_callable.phpt +++ b/tests/spawnWith/012-spawnWith_invalid_callable.phpt @@ -3,7 +3,7 @@ Async\spawnWith: invalid callable parameter --FILE-- getMessage() . "\n"; } // Test with array (not callable) try { - spawnWith($scope, []); + spawn_with($scope, []); } catch (TypeError $e) { echo "caught TypeError for array\n"; } // Test with null try { - spawnWith($scope, null); + spawn_with($scope, null); } catch (TypeError $e) { echo "caught TypeError for null\n"; } diff --git a/tests/stream/001-fread_fwrite_simple.phpt b/tests/stream/001-fread_fwrite_simple.phpt index 865534e..d293d08 100644 --- a/tests/stream/001-fread_fwrite_simple.phpt +++ b/tests/stream/001-fread_fwrite_simple.phpt @@ -14,7 +14,7 @@ if (PHP_OS_FAMILY !== 'Windows') { require_once __DIR__ . '/stream_helper.php'; use function Async\spawn; -use function Async\awaitAll; +use function Async\await_all; echo "Start\n"; @@ -35,7 +35,7 @@ $reader = spawn(function() use ($sock2) { fclose($sock2); }); -awaitAll([$writer, $reader]); +await_all([$writer, $reader]); echo "End\n"; ?> diff --git a/tests/stream/002-fwrite_simple.phpt b/tests/stream/002-fwrite_simple.phpt index 4a8bf6b..6af86c7 100644 --- a/tests/stream/002-fwrite_simple.phpt +++ b/tests/stream/002-fwrite_simple.phpt @@ -14,7 +14,7 @@ if (PHP_OS_FAMILY !== 'Windows') { require_once __DIR__ . '/stream_helper.php'; use function Async\spawn; -use function Async\awaitAll; +use function Async\await_all; echo "Start\n"; @@ -33,7 +33,7 @@ $worker = spawn(function() { echo "Worker: finished work\n"; }); -awaitAll([$writer, $worker]); +await_all([$writer, $worker]); $data = fread($sock2, 1024); echo "Read: '$data'\n"; diff --git a/tests/stream/003-file_get_contents_http.phpt b/tests/stream/003-file_get_contents_http.phpt index b317f54..d96b0ae 100644 --- a/tests/stream/003-file_get_contents_http.phpt +++ b/tests/stream/003-file_get_contents_http.phpt @@ -12,7 +12,7 @@ if (!function_exists('php_cli_server_start')) { diff --git a/tests/stream/004-stream_socket_client_server.phpt b/tests/stream/004-stream_socket_client_server.phpt index 0d3c41b..b579356 100644 --- a/tests/stream/004-stream_socket_client_server.phpt +++ b/tests/stream/004-stream_socket_client_server.phpt @@ -4,7 +4,7 @@ stream_socket_client and stream_socket_server with coroutine switching diff --git a/tests/stream/006-multiple_socket_operations.phpt b/tests/stream/006-multiple_socket_operations.phpt index 125d792..4131c18 100644 --- a/tests/stream/006-multiple_socket_operations.phpt +++ b/tests/stream/006-multiple_socket_operations.phpt @@ -6,7 +6,7 @@ Multiple socket operations with coroutine switching require_once __DIR__ . '/stream_helper.php'; use function Async\spawn; -use function Async\awaitAll; +use function Async\await_all; echo "Start\n"; @@ -49,7 +49,7 @@ $worker3 = spawn(function() use (&$output) { $output[] = "Worker3: doing other work"; }); -awaitAll([$worker1, $worker2, $worker3]); +await_all([$worker1, $worker2, $worker3]); // Sort and output results sort($output); diff --git a/tests/stream/007-tcp_client_server_full.phpt b/tests/stream/007-tcp_client_server_full.phpt index 80d2ff1..668191c 100644 --- a/tests/stream/007-tcp_client_server_full.phpt +++ b/tests/stream/007-tcp_client_server_full.phpt @@ -4,7 +4,7 @@ Full TCP client-server test with coroutine switching $result) { diff --git a/true-async-logo.png b/true-async-logo.png index eaa3060..e7b02b4 100644 Binary files a/true-async-logo.png and b/true-async-logo.png differ