Skip to content

Fix FFI prototypes (these functions can't return NULL) #16075

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

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions ext/ffi/ffi.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ final class FFI

public static function cdef(string $code = "", ?string $lib = null): FFI {}

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

Choose a reason for hiding this comment

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

I think it can return NULL during preloading?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right. Thanks for catching this.
Everything else is OK?


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 {}
Expand All @@ -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 {}
Expand Down
10 changes: 5 additions & 5 deletions ext/ffi/ffi_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.