Add Closure::fromCallable() documentation

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@341998 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jiří Pudil 2017-03-01 16:11:18 +00:00
parent 624b835678
commit caec2ae726
3 changed files with 71 additions and 0 deletions

View file

@ -61,6 +61,7 @@
&language.predefined.closure.bind;
&language.predefined.closure.bindto;
&language.predefined.closure.call;
&language.predefined.closure.fromcallable;
</phpdoc:classref>

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $:Revision: 299459 $ -->
<refentry xml:id="closure.fromcallable" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Closure::fromCallable</refname>
<refpurpose>Converts a callable into a closure.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <modifier>static</modifier> <type>Closure</type><methodname>Closure::fromCallable</methodname>
<methodparam><type>callable</type><parameter>callable</parameter></methodparam>
</methodsynopsis>
<para>
Create and return a new <link linkend="functions.anonymous">anonymous
function</link> from given <parameter>callable</parameter> using the
current scope. This method checks if the <parameter>callable</parameter> is
callable in the current scope and throws a <classname>TypeError</classname>
if it is not.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>callable</parameter></term>
<listitem>
<para>
The callable to convert.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the newly created <classname>Closure</classname> or throws a
<classname>TypeError</classname> if the <parameter>callable</parameter> is
not callable in the current scope.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -56,6 +56,7 @@
<function name="closure::bind" from="PHP 5 &gt;= 5.4.0, PHP 7"/>
<function name="closure::bindto" from="PHP 5 &gt;= 5.4.0, PHP 7"/>
<function name="closure::call" from="PHP 7"/>
<function name="closure::fromcallable" from="PHP 7 &gt;= 7.1.0"/>
<function name="namespaces" from="PHP 5 &gt;= 5.3.0, PHP 7"/>
<function name="generators" from="PHP 5 &gt;= 5.5.0, PHP 7"/>