<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.reflectionproperty.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'reflectionproperty.getsettabletype.php',
    1 => 'ReflectionProperty::getSettableType',
    2 => 'Renvoie le type de param&egrave;tre d\'un hook setter',
  ),
  'up' => 
  array (
    0 => 'class.reflectionproperty.php',
    1 => 'ReflectionProperty',
  ),
  'prev' => 
  array (
    0 => 'reflectionproperty.getrawvalue.php',
    1 => 'ReflectionProperty::getRawValue',
  ),
  'next' => 
  array (
    0 => 'reflectionproperty.gettype.php',
    1 => 'ReflectionProperty::getType',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/reflection/reflectionproperty/getsettabletype.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="reflectionproperty.getsettabletype" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ReflectionProperty::getSettableType</h1>
  <p class="verinfo">(PHP 8 &gt;= 8.4.0)</p><p class="refpurpose"><span class="refname">ReflectionProperty::getSettableType</span> &mdash; <span class="dc-title">Renvoie le type de paramètre d&#039;un hook setter</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-reflectionproperty.getsettabletype-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ReflectionProperty::getSettableType</strong></span>(): <span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="class.reflectiontype.php" class="type ReflectionType">ReflectionType</a></span></span></div>

  <p class="simpara">
   Renvoie le type de paramètre d&#039;un hook <code class="literal">set</code>.
   Si aucun hook <code class="literal">set</code> n&#039;est défini, se comporte de manière identique
   à <span class="methodname"><a href="reflectionproperty.gettype.php" class="methodname">ReflectionProperty::getType()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-reflectionproperty.getsettabletype-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">Cette fonction ne contient aucun paramètre.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-reflectionproperty.getsettabletype-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <ul class="simplelist">
   <li>
    Cette méthode renvoie une instance de <span class="classname"><a href="class.reflectiontype.php" class="classname">ReflectionType</a></span> qui correspond
    au type définissable pour la propriété.
   </li>
   <li>
    S'il existe un hook <code class="literal">set</code> qui définit un type explicite, celui-ci sera renvoyé.
   </li>
   <li>
    Si le hook ne spécifie pas de type, ou s'il n'existe pas, le type de la propriété sera
    renvoyé, de manière identique à <span class="methodname"><a href="reflectionproperty.gettype.php" class="methodname">ReflectionProperty::getType()</a></span>. Cette valeur peut être <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>
    si la propriété n'est pas typée.
   </li>
   <li>
    Si la propriété est virtuelle et n'a pas de hook <code class="literal">set</code>, une instance de <span class="classname"><a href="class.reflectiontype.php" class="classname">ReflectionType</a></span>
    pour <code class="literal">never</code> sera renvoyée.
   </li>
  </ul>
 </div>


 <div class="refsect1 examples" id="refsect1-reflectionproperty.getsettabletype-examples">
  <h3 class="title">Exemples</h3>
  <div class="example" id="reflectionproperty.getsettabletype.example.basic">
   <p><strong>Exemple #1 Exemple de <span class="methodname"><strong>ReflectionProperty::getSettableType()</strong></span></strong></p>
   <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">class </span><span style="color: #0000BB">Example<br /></span><span style="color: #007700">{<br />    public </span><span style="color: #0000BB">string $basic </span><span style="color: #007700">{<br />        </span><span style="color: #0000BB">set </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">strtolower</span><span style="color: #007700">(</span><span style="color: #0000BB">$value</span><span style="color: #007700">);<br />    }<br /><br />    public </span><span style="color: #0000BB">string $wider </span><span style="color: #007700">{<br />        </span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #0000BB">string</span><span style="color: #007700">|</span><span style="color: #0000BB">Stringable $value</span><span style="color: #007700">) =&gt; (string) </span><span style="color: #0000BB">$value</span><span style="color: #007700">;<br />    }<br /><br />    public </span><span style="color: #0000BB">string $virtual </span><span style="color: #007700">{<br />        </span><span style="color: #0000BB">get </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Do not change this'</span><span style="color: #007700">;<br />    }<br /><br />    public </span><span style="color: #0000BB">$untyped </span><span style="color: #007700">= </span><span style="color: #DD0000">'silly'</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">$rClass </span><span style="color: #007700">= new </span><span style="color: #0000BB">\ReflectionClass</span><span style="color: #007700">(</span><span style="color: #0000BB">Example</span><span style="color: #007700">::class);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$rClass</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getProperty</span><span style="color: #007700">(</span><span style="color: #DD0000">'basic'</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">getSettableType</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$rClass</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getProperty</span><span style="color: #007700">(</span><span style="color: #DD0000">'wider'</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">getSettableType</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$rClass</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getProperty</span><span style="color: #007700">(</span><span style="color: #DD0000">'virtual'</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">getSettableType</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$rClass</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getProperty</span><span style="color: #007700">(</span><span style="color: #DD0000">'untyped'</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">getSettableType</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>L&#039;exemple ci-dessus va afficher :</p></div>
   <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">object(ReflectionNamedType)#3 (0) {
}
object(ReflectionUnionType)#2 (0) {
}
object(ReflectionNamedType)#3 (0) {
}
NULL</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-reflectionproperty.getsettabletype-seealso">
  <h3 class="title">Voir aussi</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="reflectionproperty.gettype.php" class="methodname" rel="rdfs-seeAlso">ReflectionProperty::getType()</a> - R&eacute;cup&egrave;re le type d'une propri&eacute;t&eacute;</span></li>
  </ul>
 </div>


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