[PHP-DEV] [RFC] [discussion] Deprecate FFI instance calls to non-static methods instead of static methods

I’ve added a new RFC to deprecate FFI instance calls to non-static method.

The PR Deprecate calling FFI::cast(), FFI::new(), and FFI::type() statically · php/php-src@4acf008 · GitHub
deprecation of static methods is not a good solution. Now that the FFI API is a mess, this PR will make a fix impossible

My RFC link
https://wiki.php.net/rfc/ffi-non-static-deprecated

···

Regards
Chopin Xiao

On Sat, Jun 22, 2024 at 6:21 AM chopins xiao <chopins.xiao@gmail.com> wrote:

I’ve added a new RFC to deprecate FFI instance calls to non-static method.

The PR https://github.com/php/php-src/commit/4acf0084dcd63ec369a610ec966db33f322694c8
deprecation of static methods is not a good solution. Now that the FFI API is a mess, this PR will make a fix impossible

My RFC link
https://wiki.php.net/rfc/ffi-non-static-deprecated

I think this is the right direction.
Deprecating static FFI::new() is a huge BC break, performance loss and limitation to static type inference.
Introducing FFI::CDef looks like a smaller BC break without other degradations.

I would think about using the name “FFI::Scope” instead of “FFI::CDef” (term scope already used in the API)

Thanks. Dmitry.

Regards
Chopin Xiao

This PR has been merged and will probably be released in PHP 8.4, so hopefully a result will come out soon.

Regards
Chopin Xiao