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

- Thread: https://externals.io/message/123748
- Original archive: https://news-web.php.net/php.internals/123748
- Started by chopins xiao on 2024-06-22T03:19:17+00:00
- Messages: 3
- RFC: Deprecate FFI non-static methods (Inactive) — https://externals.io/rfc/ffi-non-static-deprecated.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #123748 — chopins xiao — 2024-06-22T03:19:17+00:00

URL: https://externals.io/message/123748#123748

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

Regards
Chopin Xiao

---

## #123806 — Dmitry Stogov — 2024-06-25T07:37:15+00:00

URL: https://externals.io/message/123748#123806 · In reply to: #123748

> 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
> <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

---

## #123853 — chopins xiao — 2024-06-26T01:31:22+00:00

URL: https://externals.io/message/123748#123853

https://github.com/php/php-src/commit/4acf0084dcd63ec369a610ec966db33f322694c8
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
