1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-24 07:42:10 +01:00
Files
2023-07-31 14:21:47 +01:00

198 lines
4.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="reflectionclass.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionClass::__construct</refname>
<refpurpose>Constructs a ReflectionClass</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<constructorsynopsis role="ReflectionClass">
<modifier>public</modifier> <methodname>ReflectionClass::__construct</methodname>
<methodparam><type class="union"><type>object</type><type>string</type></type><parameter>objectOrClass</parameter></methodparam>
</constructorsynopsis>
<para>
Constructs a new <classname>ReflectionClass</classname> object.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>objectOrClass</parameter></term>
<listitem>
<para>
Either a <type>string</type> containing the name of the class to
reflect, or an <type>object</type>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Throws <classname>ReflectionException</classname> if the class to reflect does not exist.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Basic usage ReflectionClass</title>
<programlisting role="php">
<![CDATA[
<?php
$reflection = new ReflectionClass('Exception');
echo $reflection;
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Class [ <internal:Core> class Exception implements Stringable, Throwable ] {
- Constants [0] {
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [7] {
Property [ protected $message = '' ]
Property [ private string $string = '' ]
Property [ protected $code = 0 ]
Property [ protected string $file = '' ]
Property [ protected int $line = 0 ]
Property [ private array $trace = [] ]
Property [ private ?Throwable $previous = NULL ]
}
- Methods [11] {
Method [ <internal:Core> private method __clone ] {
- Parameters [0] {
}
- Return [ void ]
}
Method [ <internal:Core, ctor> public method __construct ] {
- Parameters [3] {
Parameter #0 [ <optional> string $message = "" ]
Parameter #1 [ <optional> int $code = 0 ]
Parameter #2 [ <optional> ?Throwable $previous = null ]
}
}
Method [ <internal:Core> public method __wakeup ] {
- Parameters [0] {
}
- Tentative return [ void ]
}
Method [ <internal:Core, prototype Throwable> final public method getMessage ] {
- Parameters [0] {
}
- Return [ string ]
}
Method [ <internal:Core, prototype Throwable> final public method getCode ] {
- Parameters [0] {
}
}
Method [ <internal:Core, prototype Throwable> final public method getFile ] {
- Parameters [0] {
}
- Return [ string ]
}
Method [ <internal:Core, prototype Throwable> final public method getLine ] {
- Parameters [0] {
}
- Return [ int ]
}
Method [ <internal:Core, prototype Throwable> final public method getTrace ] {
- Parameters [0] {
}
- Return [ array ]
}
Method [ <internal:Core, prototype Throwable> final public method getPrevious ] {
- Parameters [0] {
}
- Return [ ?Throwable ]
}
Method [ <internal:Core, prototype Throwable> final public method getTraceAsString ] {
- Parameters [0] {
}
- Return [ string ]
}
Method [ <internal:Core, prototype Stringable> public method __toString ] {
- Parameters [0] {
}
- Return [ string ]
}
}
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>ReflectionObject::__construct</methodname></member>
<member><link linkend="language.oop5.decon.constructor">Constructors</link></member>
</simplelist>
</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
-->