Skip to content

Update ext/ffi parameter names #6282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions ext/ffi/ffi.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static function cdef(string $code = "", ?string $lib = null): FFI {}

public static function load(string $filename): ?FFI {}

public static function scope(string $scope_name): ?FFI {}
public static function scope(string $name): ?FFI {}

public static function new(FFI\CType|string $type, bool $owned = true, bool $persistent = false): ?FFI\CData {}

Expand All @@ -28,7 +28,7 @@ public static function type(string $type): ?FFI\CType {}
/** @prefer-ref $ptr */
public static function typeof(FFI\CData $ptr): ?FFI\CType {}

public static function arrayType(FFI\CType $type, array $dims): ?FFI\CType {}
public static function arrayType(FFI\CType $type, array $dimensions): ?FFI\CType {}

/** @prefer-ref $ptr */
public static function addr(FFI\CData $ptr): FFI\CData {}
Expand All @@ -40,11 +40,11 @@ public static function sizeof(object $ptr): ?int {}
public static function alignof(object $ptr): ?int {}

/**
* @param FFI\CData|string $src
* @prefer-ref $dst
* @prefer-ref $src
* @param FFI\CData|string $from
* @prefer-ref $to
* @prefer-ref $from
*/
public static function memcpy(FFI\CData $dst, $src, int $size): void {}
public static function memcpy(FFI\CData $to, $from, int $size): void {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using $from/$to with memcpy feels a bit odd to me, but it's not too bad...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with either :)


/**
* @prefer-ref $ptr1
Expand All @@ -55,7 +55,7 @@ public static function memcpy(FFI\CData $dst, $src, int $size): void {}
public static function memcmp($ptr1, $ptr2, int $size): ?int {}

/** @prefer-ref $ptr */
public static function memset(FFI\CData $ptr, int $ch, int $size): void {}
public static function memset(FFI\CData $ptr, int $value, int $size): void {}

/** @prefer-ref $ptr */
public static function string(FFI\CData $ptr, ?int $size = null): ?string {}
Expand Down
12 changes: 6 additions & 6 deletions ext/ffi/ffi_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 63219df3f7ccf823350d288bf2dfeba5291a3e51 */
* Stub hash: abd3bc186ae3f71f2b7eb1d47f3b6bab84fb2bda */

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, "\"\"")
Expand All @@ -11,7 +11,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_load, 0, 1, FFI, 1)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_scope, 0, 1, FFI, 1)
ZEND_ARG_TYPE_INFO(0, scope_name, IS_STRING, 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)
Expand Down Expand Up @@ -39,7 +39,7 @@ ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_arrayType, 0, 2, FFI\\CType, 1)
ZEND_ARG_OBJ_INFO(0, type, FFI\\CType, 0)
ZEND_ARG_TYPE_INFO(0, dims, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, dimensions, IS_ARRAY, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_FFI_addr, 0, 1, FFI\\CData, 0)
Expand All @@ -53,8 +53,8 @@ ZEND_END_ARG_INFO()
#define arginfo_class_FFI_alignof arginfo_class_FFI_sizeof

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_memcpy, 0, 3, IS_VOID, 0)
ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, dst, FFI\\CData, 0)
ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, src)
ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, to, FFI\\CData, 0)
ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, from)
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
ZEND_END_ARG_INFO()

Expand All @@ -66,7 +66,7 @@ ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_FFI_memset, 0, 3, IS_VOID, 0)
ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0)
ZEND_ARG_TYPE_INFO(0, ch, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
ZEND_END_ARG_INFO()

Expand Down