diff --git a/src/swoole/Swoole/Async/Client.php b/src/swoole/Swoole/Async/Client.php index 93b1732..ded0473 100644 --- a/src/swoole/Swoole/Async/Client.php +++ b/src/swoole/Swoole/Async/Client.php @@ -5,7 +5,7 @@ namespace Swoole\Async; /** - * @since 6.0.0-rc1 + * @since 6.0.0 */ class Client extends \Swoole\Client { diff --git a/src/swoole/Swoole/Client.php b/src/swoole/Swoole/Client.php index f45ebaf..f1613ec 100644 --- a/src/swoole/Swoole/Client.php +++ b/src/swoole/Swoole/Client.php @@ -121,8 +121,7 @@ public function shutdown(int $how): bool * option "--enable-openssl" included). * * @param callable|null $onSslReady Callback function to be executed when SSL handshake is successful. - * Added in v6.0.0-rc1 for child class Swoole\Async\Client only. It has no effect - * on this class. + * Added in v6.0.0 for child class Swoole\Async\Client only. It has no effect on this class. * @return bool TRUE if SSL handshake is successful; otherwise FALSE. */ public function enableSSL(?callable $onSslReady = null): bool diff --git a/src/swoole/Swoole/Coroutine.php b/src/swoole/Swoole/Coroutine.php index d3f01ce..71e090f 100644 --- a/src/swoole/Swoole/Coroutine.php +++ b/src/swoole/Swoole/Coroutine.php @@ -480,7 +480,7 @@ public static function waitPid(int $pid, float $timeout = -1): array|false * Wait for given signal(s) with a timeout. * * @param int|array $signals An integer or an array of integers representing the signal number(s). - * Before Swoole v6.0.0-rc1, only integer is supported. + * Before Swoole v6.0.0, only integer is supported. * @param float $timeout The timeout value in seconds. Minimum value is 0.001. -1 means no timeout. * @return int|false Returns the signal number received on success, or false on failure. * @alias Alias of method \Swoole\Coroutine\System::waitSignal(). diff --git a/src/swoole/Swoole/Coroutine/Http/Server.php b/src/swoole/Swoole/Coroutine/Http/Server.php index 778e7f6..311a221 100644 --- a/src/swoole/Swoole/Coroutine/Http/Server.php +++ b/src/swoole/Swoole/Coroutine/Http/Server.php @@ -42,7 +42,7 @@ public function set(array $settings): bool * @param string $pattern The URL pattern to match, e.g., "/index". * @param callable $callback The callback function to handle the HTTP request. * @return bool Return true on success. Return false on failure. - * Before Swoole v6.0.0-rc1, it returns void. + * Before Swoole v6.0.0, it returns void. */ public function handle(string $pattern, callable $callback): bool { diff --git a/src/swoole/Swoole/Coroutine/System.php b/src/swoole/Swoole/Coroutine/System.php index 95c55b9..f8ddf18 100644 --- a/src/swoole/Swoole/Coroutine/System.php +++ b/src/swoole/Swoole/Coroutine/System.php @@ -105,7 +105,7 @@ public static function waitPid(int $pid, float $timeout = -1): array|false * Wait for given signal(s) with a timeout. * * @param int|array $signals An integer or an array of integers representing the signal number(s). - * Before Swoole v6.0.0-rc1, only integer is supported. + * Before Swoole v6.0.0, only integer is supported. * @param float $timeout The timeout value in seconds. Minimum value is 0.001. -1 means no timeout. * @return int|false Returns the signal number received on success, or false on failure. * @alias This method has an alias of \Swoole\Coroutine::waitSignal(). diff --git a/src/swoole/Swoole/Process.php b/src/swoole/Swoole/Process.php index f515242..4706ab3 100644 --- a/src/swoole/Swoole/Process.php +++ b/src/swoole/Swoole/Process.php @@ -55,7 +55,7 @@ class Process * * @param callable $callback The callback function of the process. */ - public function __construct(callable $callback, bool $redirect_stdin_and_stdout = false, int $pipe_type = 2, bool $enable_coroutine = false) + public function __construct(callable $callback, bool $redirect_stdin_and_stdout = false, int $pipe_type = SOCK_DGRAM, bool $enable_coroutine = false) { } diff --git a/src/swoole/Swoole/Thread/ArrayList.php b/src/swoole/Swoole/Thread/ArrayList.php index 55ed3fe..3a32562 100644 --- a/src/swoole/Swoole/Thread/ArrayList.php +++ b/src/swoole/Swoole/Thread/ArrayList.php @@ -20,18 +20,38 @@ public function __construct(?array $array = null) { } + /** + * @see \ArrayAccess::offsetGet() + * @see https://www.php.net/manual/en/arrayaccess.offsetget.php + * {@inheritDoc} + */ public function offsetGet(mixed $key): mixed { } + /** + * @see \ArrayAccess::offsetExists() + * @see https://www.php.net/manual/en/arrayaccess.offsetexists.php + * {@inheritDoc} + */ public function offsetExists(mixed $key): bool { } + /** + * @see \ArrayAccess::offsetSet() + * @see https://www.php.net/manual/en/arrayaccess.offsetset.php + * {@inheritDoc} + */ public function offsetSet(mixed $key, mixed $value): void { } + /** + * @see \ArrayAccess::offsetUnset() + * @see https://www.php.net/manual/en/arrayaccess.offsetunset.php + * {@inheritDoc} + */ public function offsetUnset(mixed $key): void { } @@ -52,6 +72,11 @@ public function clean(): void { } + /** + * @see \Countable::count() + * @see https://www.php.net/manual/en/countable.count.php + * {@inheritDoc} + */ public function count(): int { } diff --git a/src/swoole/Swoole/Thread/Barrier.php b/src/swoole/Swoole/Thread/Barrier.php index 0007665..eb4b963 100644 --- a/src/swoole/Swoole/Thread/Barrier.php +++ b/src/swoole/Swoole/Thread/Barrier.php @@ -5,7 +5,10 @@ namespace Swoole\Thread; /** - * Class \Swoole\Thread\Barrier. + * A synchronization mechanism that allows multiple threads to wait at a barrier point until the specified number of + * threads has reached the barrier. + * + * Once the required number of threads has arrived, all threads are released simultaneously. * * This class is available only when PHP is compiled with Zend Thread Safety (ZTS) enabled and Swoole is installed with * the "--enable-swoole-thread" configuration option. @@ -14,10 +17,22 @@ */ final class Barrier { + /** + * Initializes a new barrier with a specified thread count. + * + * @param int $count The number of threads required to meet at the barrier before they can proceed. + * This value must be greater than 0. + */ public function __construct(int $count) { } + /** + * Blocks the current thread until the specified number of threads (provided in the constructor) + * have invoked this method. + * + * Once all threads have called this method, the barrier is lifted, and all waiting threads proceed. + */ public function wait(): void { } diff --git a/src/swoole/Swoole/Thread/Lock.php b/src/swoole/Swoole/Thread/Lock.php index 36c2065..370ae90 100644 --- a/src/swoole/Swoole/Thread/Lock.php +++ b/src/swoole/Swoole/Thread/Lock.php @@ -18,19 +18,15 @@ */ final class Lock { - public const RWLOCK = 1; + public const RWLOCK = SWOOLE_RWLOCK; - public const MUTEX = 3; + public const MUTEX = SWOOLE_MUTEX; - public const SPINLOCK = 5; + public const SPINLOCK = SWOOLE_SPINLOCK; - public $errCode = 0; + public int $errCode = 0; - public function __construct(int $type = 3) - { - } - - public function __destruct() + public function __construct(int $type = self::MUTEX) { } diff --git a/src/swoole/Swoole/Thread/Map.php b/src/swoole/Swoole/Thread/Map.php index 74437ab..53c141a 100644 --- a/src/swoole/Swoole/Thread/Map.php +++ b/src/swoole/Swoole/Thread/Map.php @@ -18,18 +18,38 @@ public function __construct(?array $array = null) { } + /** + * @see \ArrayAccess::offsetGet() + * @see https://www.php.net/manual/en/arrayaccess.offsetget.php + * {@inheritDoc} + */ public function offsetGet(mixed $key): mixed { } + /** + * @see \ArrayAccess::offsetExists() + * @see https://www.php.net/manual/en/arrayaccess.offsetexists.php + * {@inheritDoc} + */ public function offsetExists(mixed $key): bool { } + /** + * @see \ArrayAccess::offsetSet() + * @see https://www.php.net/manual/en/arrayaccess.offsetset.php + * {@inheritDoc} + */ public function offsetSet(mixed $key, mixed $value): void { } + /** + * @see \ArrayAccess::offsetUnset() + * @see https://www.php.net/manual/en/arrayaccess.offsetunset.php + * {@inheritDoc} + */ public function offsetUnset(mixed $key): void { } @@ -38,6 +58,11 @@ public function find(mixed $value): mixed { } + /** + * @see \Countable::count() + * @see https://www.php.net/manual/en/countable.count.php + * {@inheritDoc} + */ public function count(): int { } diff --git a/src/swoole/Swoole/Thread/Queue.php b/src/swoole/Swoole/Thread/Queue.php index 595b317..0194db8 100644 --- a/src/swoole/Swoole/Thread/Queue.php +++ b/src/swoole/Swoole/Thread/Queue.php @@ -22,7 +22,7 @@ final class Queue implements \Countable public const NOTIFY_ONE = 1; /** - * Unblocks all threads currently waiting for this queue. + * Unblock all threads currently waiting for this queue. * * This constant is used by method Queue::push() only. */ @@ -32,7 +32,8 @@ final class Queue implements \Countable * Push a value into the queue. * * @param mixed $value The value to push into the queue. - * @param int $notify_which How to unblock threads that are waiting on the queue. Either NOTIFY_ONE, NOTIFY_ALL, or 0 (not to notify anyone). + * @param int $notify_which How to unblock threads that are waiting on the queue. Either Queue::NOTIFY_ONE, + * Queue::NOTIFY_ALL, or 0 (not to notify anyone). */ public function push(mixed $value, int $notify_which = 0): void { diff --git a/src/swoole/constants.php b/src/swoole/constants.php index 8ecec5c..e1e1dff 100644 --- a/src/swoole/constants.php +++ b/src/swoole/constants.php @@ -304,7 +304,7 @@ #ifdef HAVE_SPINLOCK define('SWOOLE_SPINLOCK', 5); # Supported only if the Spin Locks option is provided in the POSIX thread (pthread) libraries. #endif -define('SWOOLE_COROLOCK', 6); # @since v6.0.0-rc1 +define('SWOOLE_COROLOCK', 6); # @since v6.0.0 /* * Following SIG_* and PRIO_* constants are set only when PHP extension pcntl (to support Process Control) is not @@ -592,7 +592,7 @@ */ define('SOCKET_ECANCELED', 125); -define('TCP_INFO', 11); // @since v6.0.0-rc1 +define('TCP_INFO', 11); // @since v6.0.0 /* * Constants in this section are used in Swoole servers.