From a37a3d3d814e8ee06c0868649c6b522f6d681997 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 26 Sep 2024 20:19:46 +0300 Subject: [PATCH] Fix FFI prototypes (these functions can't return NULL) (#16075) --- ext/ffi/ffi.stub.php | 6 +++--- ext/ffi/ffi_arginfo.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ext/ffi/ffi.stub.php b/ext/ffi/ffi.stub.php index 0ed3cb32ac6ed..3fb9ceee3dfa5 100644 --- a/ext/ffi/ffi.stub.php +++ b/ext/ffi/ffi.stub.php @@ -15,7 +15,7 @@ public static function load(string $filename): ?FFI {} public static function scope(string $name): FFI {} - public static function new(FFI\CType|string $type, bool $owned = true, bool $persistent = false): ?FFI\CData {} + public static function new(FFI\CType|string $type, bool $owned = true, bool $persistent = false): FFI\CData {} /** @prefer-ref $ptr */ public static function free(FFI\CData $ptr): void {} @@ -24,9 +24,9 @@ public static function free(FFI\CData $ptr): void {} * @param FFI\CData|int|float|bool|null $ptr * @prefer-ref $ptr */ - public static function cast(FFI\CType|string $type, $ptr): ?FFI\CData {} + public static function cast(FFI\CType|string $type, $ptr): FFI\CData {} - public static function type(string $type): ?FFI\CType {} + public static function type(string $type): FFI\CType {} /** @prefer-ref $ptr */ public static function typeof(FFI\CData $ptr): FFI\CType {} diff --git a/ext/ffi/ffi_arginfo.h b/ext/ffi/ffi_arginfo.h index 968a0979fb543..563c9f8b8e8b1 100644 --- a/ext/ffi/ffi_arginfo.h +++ b/ext/ffi/ffi_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 1255ed4477be5b4361622aab54ebe37f42b1dada */ + * Stub hash: d3626f5d39317876fc7d4f240b0758f17f3472c8 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cdef, 0, 0, FFI, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, code, IS_STRING, 0, "\"\"") @@ -14,7 +14,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_scope, 0, 1, FFI, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_new, 0, 1, FFI\\CData, 1) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_new, 0, 1, FFI\\CData, 0) ZEND_ARG_OBJ_TYPE_MASK(0, type, FFI\\CType, MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, owned, _IS_BOOL, 0, "true") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent, _IS_BOOL, 0, "false") @@ -24,12 +24,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_free, 0, 1, IS_VOID, 0 ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cast, 0, 2, FFI\\CData, 1) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_cast, 0, 2, FFI\\CData, 0) ZEND_ARG_OBJ_TYPE_MASK(0, type, FFI\\CType, MAY_BE_STRING, NULL) ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_type, 0, 1, FFI\\CType, 1) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_type, 0, 1, FFI\\CType, 0) ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0) ZEND_END_ARG_INFO()