diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..e0b6b02 --- /dev/null +++ b/_config.yml @@ -0,0 +1,12 @@ +plugins: + - jekyll-relative-links +relative_links: + enabled: true + collections: true +include: + - README.md + - LICENSE.md + - ISSUE_TEMPLATE.md + - PULL_REQUEST_TEMPLATE.md + +theme: jekyll-theme-dinky diff --git a/composer.json b/composer.json index 18627a2..3617e95 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "require": { "php": ">7.4", "ext-ffi": "*", - "symplely/zend-ffi": "~0.12.3" + "symplely/zend-ffi": "~0.12.5" }, "autoload": { "files": [ diff --git a/src/UVFunctions.php b/src/UVFunctions.php index 28b5817..ec53745 100644 --- a/src/UVFunctions.php +++ b/src/UVFunctions.php @@ -95,6 +95,7 @@ function uv_run(\UVLoop $loop = null, int $mode = \UV::RUN_DEFAULT): void * * @return void * @deprecated 1.0 + * @codeCoverageIgnore */ function uv_loop_delete(\UVLoop $loop): void { @@ -110,6 +111,7 @@ function uv_loop_delete(\UVLoop $loop): void * * @return void * @link http://docs.libuv.org/en/v1.x/misc.html?highlight=file%20to%20fd#c.uv_library_shutdown + * @codeCoverageIgnore */ function uv_library_shutdown(): void { @@ -245,6 +247,7 @@ function uv_async_send(\UVAsync $handle) * @param integer $write_flags * @return array|int * @link http://docs.libuv.org/en/v1.x/pipe.html?highlight=uv_pipe_bind#c.uv_pipe + * @codeCoverageIgnore */ function uv_pipe(int $read_flags = \UV::NONBLOCK_PIPE, int $write_flags = \UV::NONBLOCK_PIPE) { @@ -689,6 +692,7 @@ function uv_tcp_connect6(\UVTcp $handle, \UVSockAddrIPv6 $ipv6_addr, callable $c * @param string $filename * @return UVLib|int * @link http://docs.libuv.org/en/v1.x/dll.html?highlight=uv_lib_t#c.uv_dlopen + * @codeCoverageIgnore */ function uv_dlopen(string $filename) { @@ -701,6 +705,7 @@ function uv_dlopen(string $filename) * @param UVLib $lib * @return void * @link http://docs.libuv.org/en/v1.x/dll.html?highlight=uv_lib_t#c.uv_dlclose + * @codeCoverageIgnore */ function uv_dlclose(\UVLib $lib) { @@ -716,6 +721,7 @@ function uv_dlclose(\UVLib $lib) * @param string $symbol * @return object|int definition * @link http://docs.libuv.org/en/v1.x/dll.html?highlight=uv_lib_t#c.uv_dlsym + * @codeCoverageIgnore */ function uv_dlsym(\UVLib $lib, string $symbol) { @@ -728,6 +734,7 @@ function uv_dlsym(\UVLib $lib, string $symbol) * @param \UVLib $lib * @return string * @link http://docs.libuv.org/en/v1.x/dll.html?highlight=uv_lib_t#c.uv_dlerror + * @codeCoverageIgnore */ function uv_dlerror(\UVLib $lib) { diff --git a/src/UVHandles.php b/src/UVHandles.php index 735ffce..34ae932 100644 --- a/src/UVHandles.php +++ b/src/UVHandles.php @@ -108,6 +108,9 @@ public function stop(): void \zval_del_ref($this); } + /** + * @codeCoverageIgnore + */ public function delete(): void { \uv_destruct_set(); @@ -232,6 +235,9 @@ function (CData $stream, int $nRead, CData $data) use ($callback, $handle) { */ final class UVPipe extends \UVStream { + /** + * @codeCoverageIgnore + */ protected function emulated($io): void { $pipe = new static('struct _php_uv_s', 'pipe'); @@ -278,10 +284,12 @@ public function open($pipe, bool $emulated = true) if (\get_resource_type($io) === 'uv_pipe') { $io = \resource_get_fd((int)$pipe, false, true)[0]; } elseif (\IS_WINDOWS && $emulated) { + // @codeCoverageIgnoreStart $which = ($io === \STDOUT || $io === \STDERR) ? 1 : 0; $pipe = static::pair(\UV::NONBLOCK_PIPE, \UV::NONBLOCK_PIPE, false); $io = $pipe[$which]; $isPipeEmulated = true; + // @codeCoverageIgnoreEnd } else { $io = \get_fd_resource($pipe, 'uv_file'); } @@ -313,6 +321,7 @@ function (CData $connect, int $status) use ($callback, $req) { * @param int $write_flags * @param boolean $getResource * @return array|int + * @codeCoverageIgnore */ public static function pair( int $read_flags = \UV::NONBLOCK_PIPE, @@ -1041,8 +1050,6 @@ public function spawn( int $flags = \UV::PROCESS_WINDOWS_HIDE, array $uid_gid = [] ) { - $h = \zval_stack(2); - $process_options = \c_struct_type('uv_process_options_s', 'uv'); $process_options->memset(0, $process_options->sizeof()); @@ -1071,19 +1078,8 @@ public function spawn( } $this->streams = $streams; - /* process args */ - $n = 0; - $hash_len = $h->macro(\ZE::ARRVAL_P)->nNumOfElements; - $commands = \ffi_char($command); - $command_args = \FFI::new('char*[' . ($hash_len + 2) . ']', false); - $command_args[$n] = $commands; - - $n++; - foreach ($args as $value) { - $command_args[$n] = \ffi_char($value); - $n++; - } - $command_args[$n] = NULL; + \array_unshift($args, $command); + $command_args = \ffi_char_variadic(...$args); /* process env */ $i = 0; @@ -1100,7 +1096,7 @@ public function spawn( $gid = \IS_LINUX && \array_key_exists('gid', $uid_gid) ? $uid_gid['gid'] : null; $options = $process_options(); - $options->file = $commands; + $options->file = $command_args[0]; $options->stdio = \uv_cast('uv_stdio_container_t*', $container); $options->exit_cb = function (CData $process, int $exit_status, int $term_signal) use ($callback, $process_options) { if (!\is_null($callback)) { @@ -1116,7 +1112,7 @@ public function spawn( $options->stdio_count = $stdio_count; $options->env = \FFI::cast('char**', $zenv); - $options->args = \FFI::cast('char**', $command_args); + $options->args = $command_args; if (\is_null($cwd)) { $cwd = \uv_cwd(); @@ -2327,6 +2323,7 @@ public static function cpu_info() * Provides cross platform way of loading shared libraries and retrieving a `symbol` from them. * * @return symbol _definition_ **pointer** by invoking `$UVLib()` + * @codeCoverageIgnore */ final class UVLib extends \UVTypes { diff --git a/src/ext_uv.php b/src/ext_uv.php index 0752bfd..5a88feb 100644 --- a/src/ext_uv.php +++ b/src/ext_uv.php @@ -90,7 +90,7 @@ public function module_clear(): void public function module_shutdown(int $type, int $module_number): int { - if (!$this->module_destructor_linked) { + if (!$this->destructor_linked) { $this->module_clear(); }