Skip to content

W.I.P: PHP 8.4: Add ReflectionConstant stubs #4040

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 16 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions reference/reflection/book.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
&reference.reflection.reflection;
&reference.reflection.reflectionclass;
&reference.reflection.reflectionclassconstant;
&reference.reflection.reflectionconstant;
&reference.reflection.reflectionenum;
&reference.reflection.reflectionenumunitcase;
&reference.reflection.reflectionenumbackedcase;
Expand Down
93 changes: 93 additions & 0 deletions reference/reflection/reflectionconstant.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<reference xml:id="class.reflectionconstant" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The ReflectionConstant class</title>
<titleabbrev>ReflectionConstant</titleabbrev>

<partintro>
<section xml:id="reflectionconstant.intro">
&reftitle.intro;
<simpara>
The <classname>ReflectionConstant</classname> class reports
information about a global constant.
</simpara>
</section>

<section xml:id="reflectionconstant.synopsis">
&reftitle.classsynopsis;

<classsynopsis class="class">
<ooclass>
<modifier>final</modifier>
<classname>ReflectionConstant</classname>
</ooclass>

<oointerface>
<modifier>implements</modifier>
<interfacename>Reflector</interfacename>
</oointerface>

<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
<fieldsynopsis>
<modifier>public</modifier>
<type>string</type>
<varname linkend="reflectionconstant.props.name">name</varname>
</fieldsynopsis>

<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.reflectionconstant')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='ReflectionConstant'])">
<xi:fallback/>
</xi:include>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.reflectionconstant')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='ReflectionConstant'])">
<xi:fallback/>
</xi:include>
</classsynopsis>

</section>

<section xml:id="reflectionconstant.props">
&reftitle.properties;
<variablelist>
<varlistentry xml:id="reflectionconstant.props.name">
<term><varname>name</varname></term>
<listitem>
<simpara>
Name of the constant. Read-only, throws
<classname>ReflectionException</classname> in attempt to write.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</section>

<section role="seealso" xml:id="reflectionconstant.seealso">
&reftitle.seealso;
<simplelist>
<member><classname>ReflectionClassConstant</classname></member>
</simplelist>
</section>

</partintro>

&reference.reflection.entities.reflectionconstant;

</reference>
<!-- 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
-->
68 changes: 68 additions & 0 deletions reference/reflection/reflectionconstant/construct.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="reflectionconstant.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionConstant::__construct</refname>
<refpurpose>Constructs a ReflectionConstant</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<constructorsynopsis role="ReflectionConstant">
<modifier>public</modifier> <methodname>ReflectionConstant::__construct</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
</constructorsynopsis>
<simpara>
Constructs a new <classname>ReflectionConstant</classname> object.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<simpara>
The name of the constant.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<simpara>
Throws a <classname>ReflectionException</classname> in case the given
constant does not exist.
</simpara>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><link linkend="language.oop5.decon.constructor">Constructors</link></member>
</simplelist>
</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
-->
83 changes: 83 additions & 0 deletions reference/reflection/reflectionconstant/getextension.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="reflectionconstant.getextension" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionConstant::getExtension</refname>
<refpurpose>Gets <classname>ReflectionExtension</classname> of the defining extension</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="ReflectionConstant">
<modifier>public</modifier> <type class="union"><type>ReflectionExtension</type><type>null</type></type><methodname>ReflectionConstant::getExtension</methodname>
<void/>
</methodsynopsis>
<simpara>
Gets a <classname>ReflectionExtension</classname> object for the extension
which defined the constant.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
A <classname>ReflectionExtension</classname> object representing the
extension which defined the constant, or &null; for user-defined constants.
</simpara>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Basic usage of <methodname>ReflectionConstant::getExtension</methodname></title>
<programlisting role="php">
<![CDATA[
<?php
var_dump((new ReflectionConstant('SQLITE3_TEXT'))->getExtension());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
object(ReflectionExtension)#2 (1) {
["name"]=>
string(7) "sqlite3"
}
]]>
</screen>
</example>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>ReflectionConstant::getExtensionName</methodname></member>
</simplelist>
</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
-->
78 changes: 78 additions & 0 deletions reference/reflection/reflectionconstant/getextensionname.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="reflectionconstant.getextensionname" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionConstant::getExtensionName</refname>
<refpurpose>Gets name of the defining extension</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="ReflectionConstant">
<modifier>public</modifier> <type class="union"><type>string</type><type>false</type></type><methodname>ReflectionConstant::getExtensionName</methodname>
<void/>
</methodsynopsis>
<simpara>
Gets the name of the extension which defined the constant.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
The name of the extension which defined the constant, or &false; for user-defined constants.
</simpara>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Basic usage of <methodname>ReflectionConstant::getExtensionName</methodname></title>
<programlisting role="php">
<![CDATA[
<?php
var_dump((new ReflectionConstant('SQLITE3_TEXT'))->getExtensionName());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(7) "sqlite3"
]]>
</screen>
</example>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>ReflectionConstant::getExtension</methodname></member>
</simplelist>
</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
-->
54 changes: 54 additions & 0 deletions reference/reflection/reflectionconstant/getfilename.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="reflectionconstant.getfilename" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionConstant::getFileName</refname>
<refpurpose>Gets name of the defining file</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="ReflectionConstant">
<modifier>public</modifier> <type class="union"><type>string</type><type>false</type></type><methodname>ReflectionConstant::getFileName</methodname>
<void/>
</methodsynopsis>
<simpara>
Gets the filename of the file in which the constant has been defined.
</simpara>

</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Returns the filename of the file in which the constant has been defined.
If the constant is defined in the PHP core or in a PHP extension,
&false; is returned.
</simpara>
</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
-->
Loading
Loading