[doc-en] master: Fix deprecated static usage of FFI methods (#6122)

From: Date: Sat, 21 Nov 2026 10:16:46 +0000
Subject: [doc-en] master: Fix deprecated static usage of FFI methods (#6122)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23989@lists.php.net to get a copy of this message
Author: Barun (sudo-barun) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-11-21T11:16:42+01:00 Commit: https://github.com/php/doc-en/commit/57dbbfce905857e541f76ad1e981e41afc97da69 Raw diff: https://github.com/php/doc-en/commit/57dbbfce905857e541f76ad1e981e41afc97da69.diff Fix deprecated static usage of FFI methods (#6122) * fix deprecated static usage of FFI::new() * fix deprecated static usage of FFI::type() Changed paths: M reference/ffi/examples.xml M reference/ffi/ffi.cdata.xml M reference/ffi/ffi/arraytype.xml Diff: diff --git a/reference/ffi/examples.xml b/reference/ffi/examples.xml index a289fe4575c3..cede0b20f30c 100644 --- a/reference/ffi/examples.xml +++ b/reference/ffi/examples.xml @@ -116,7 +116,8 @@ int(0) <![CDATA[ <?php // create a new C int variable -$x = FFI::new("int"); +$ffi = FFI::cdef(); +$x = $ffi->new("int"); var_dump($x->cdata); // simple assignment @@ -145,7 +146,8 @@ int(7) <![CDATA[ <?php // create C data structure -$a = FFI::new("long[1024]"); +$ffi = FFI::cdef(); +$a = $ffi->new("long[1024]"); // work with it like with a regular PHP array for ($i = 0; $i < count($a); $i++) { $a[$i] = $i; diff --git a/reference/ffi/ffi.cdata.xml b/reference/ffi/ffi.cdata.xml index aeec0b3e3fbc..3efc074c877e 100644 --- a/reference/ffi/ffi.cdata.xml +++ b/reference/ffi/ffi.cdata.xml @@ -18,7 +18,7 @@ <listitem> <simpara> C data of scalar types can be read and assigned via the <property>$cdata</property> property, e.g. - <code>$x = FFI::new('int'); $x-&gt;cdata = 42;</code> + <code>$ffi = FFI::cdef(); $x = $ffi-&gt;new('int'); $x-&gt;cdata = 42;</code> </simpara> </listitem> <listitem> diff --git a/reference/ffi/ffi/arraytype.xml b/reference/ffi/ffi/arraytype.xml index 59156ccec124..99fdb0eaa664 100644 --- a/reference/ffi/ffi/arraytype.xml +++ b/reference/ffi/ffi/arraytype.xml @@ -21,8 +21,9 @@ <programlisting role="php"> <![CDATA[ <?php -$t1 = FFI::type("int[2][3]"); -$t2 = FFI::arrayType(FFI::type("int"), [2, 3]); +$ffi = FFI::cdef(); +$t1 = $ffi->type("int[2][3]"); +$t2 = FFI::arrayType($ffi->type("int"), [2, 3]); ?> ]]> </programlisting>

« previous php.doc.cvs (#23989) next »