<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.reflectionclass.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'reflectionclass.construct.php',
    1 => 'ReflectionClass::__construct',
    2 => 'Создаёт объект класса ReflectionClass',
  ),
  'up' => 
  array (
    0 => 'class.reflectionclass.php',
    1 => 'ReflectionClass',
  ),
  'prev' => 
  array (
    0 => 'class.reflectionclass.php',
    1 => 'ReflectionClass',
  ),
  'next' => 
  array (
    0 => 'reflectionclass.export.php',
    1 => 'ReflectionClass::export',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/reflection/reflectionclass/construct.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="reflectionclass.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ReflectionClass::__construct</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ReflectionClass::__construct</span> &mdash; <span class="dc-title">Создаёт объект класса ReflectionClass</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-reflectionclass.construct-description">
  <h3 class="title">Описание</h3>
  <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ReflectionClass::__construct</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.object.php" class="type object">object</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$objectOrClass</code></span>)</div>

  <p class="para rdfs-comment">
   Создаёт новый объект класса <span class="classname"><a href="class.reflectionclass.php" class="classname">ReflectionClass</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-reflectionclass.construct-parameters">
  <h3 class="title">Список параметров</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">objectOrClass</code></dt>
     <dd>
      <p class="para">
       В качестве аргумента может принимать строку (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>),
       содержащую имя исследуемого класса, либо объект (<span class="type"><a href="language.types.object.php" class="type object">object</a></span>).
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-reflectionclass.construct-errors">
  <h3 class="title">Ошибки</h3>
  <p class="para">
   Вызывает исключение <span class="classname"><a href="class.reflectionexception.php" class="classname">ReflectionException</a></span>, если заданный класс
   не существует.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-reflectionclass.construct-examples">
  <h3 class="title">Примеры</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Пример #1 Простой пример использования ReflectionClass</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$reflection </span><span style="color: #007700">= new </span><span style="color: #0000BB">ReflectionClass</span><span style="color: #007700">(</span><span style="color: #DD0000">'Exception'</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">$reflection</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    
<div class="example-contents"><p>
 Вывод приведённого примера будет похож на:
</p></div>

    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">Class [ &lt;internal:Core&gt; class Exception implements Stringable, Throwable ] {

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [7] {
    Property [ protected $message = &#039;&#039; ]
    Property [ private string $string = &#039;&#039; ]
    Property [ protected $code = 0 ]
    Property [ protected string $file = &#039;&#039; ]
    Property [ protected int $line = 0 ]
    Property [ private array $trace = [] ]
    Property [ private ?Throwable $previous = NULL ]
  }

  - Methods [11] {
    Method [ &lt;internal:Core&gt; private method __clone ] {

      - Parameters [0] {
      }
      - Return [ void ]
    }

    Method [ &lt;internal:Core, ctor&gt; public method __construct ] {

      - Parameters [3] {
        Parameter #0 [ &lt;optional&gt; string $message = &quot;&quot; ]
        Parameter #1 [ &lt;optional&gt; int $code = 0 ]
        Parameter #2 [ &lt;optional&gt; ?Throwable $previous = null ]
      }
    }

    Method [ &lt;internal:Core&gt; public method __wakeup ] {

      - Parameters [0] {
      }
      - Tentative return [ void ]
    }

    Method [ &lt;internal:Core, prototype Throwable&gt; final public method getMessage ] {

      - Parameters [0] {
      }
      - Return [ string ]
    }

    Method [ &lt;internal:Core, prototype Throwable&gt; final public method getCode ] {

      - Parameters [0] {
      }
    }

    Method [ &lt;internal:Core, prototype Throwable&gt; final public method getFile ] {

      - Parameters [0] {
      }
      - Return [ string ]
    }

    Method [ &lt;internal:Core, prototype Throwable&gt; final public method getLine ] {

      - Parameters [0] {
      }
      - Return [ int ]
    }

    Method [ &lt;internal:Core, prototype Throwable&gt; final public method getTrace ] {

      - Parameters [0] {
      }
      - Return [ array ]
    }

    Method [ &lt;internal:Core, prototype Throwable&gt; final public method getPrevious ] {

      - Parameters [0] {
      }
      - Return [ ?Throwable ]
    }

    Method [ &lt;internal:Core, prototype Throwable&gt; final public method getTraceAsString ] {

      - Parameters [0] {
      }
      - Return [ string ]
    }

    Method [ &lt;internal:Core, prototype Stringable&gt; public method __toString ] {

      - Parameters [0] {
      }
      - Return [ string ]
    }
  }
}</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-reflectionclass.construct-seealso">
  <h3 class="title">Смотрите также</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="reflectionobject.construct.php" class="methodname" rel="rdfs-seeAlso">ReflectionObject::__construct()</a> - Конструктор класса ReflectionObject</span></li>
    <li><a href="language.oop5.decon.php#language.oop5.decon.constructor" class="link">Конструкторы</a></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>