Files
archived-doc-pt-br/language/predefined/attributes/allowdynamicproperties.xml
Leonardo Lara Rodrigues 55bc81d567 sync with en rev
2026-01-06 15:08:57 -03:00

97 lines
2.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?><!-- EN-Revision: 05b314c2ae84456def6a56777b05d0645fb3e11e Maintainer: leonardolara Status: ready --><!-- CREDITS: adaiasmagdiel, leonardolara -->
<reference xml:id="class.allowdynamicproperties" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>O atributo AllowDynamicProperties</title>
<titleabbrev>AllowDynamicProperties</titleabbrev>
<partintro>
<section xml:id="allowdynamicproperties.intro">
&reftitle.intro;
<para>
Este atributo é usado para marcar classes que permitem
<link linkend="language.oop5.properties.dynamic-properties">propriedades dinâmicas</link>.
</para>
</section>
<section xml:id="allowdynamicproperties.synopsis">
&reftitle.classsynopsis;
<classsynopsis class="class">
<ooclass>
<modifier role="attribute">#[\Attribute]</modifier>
<modifier>final</modifier>
<classname>AllowDynamicProperties</classname>
</ooclass>
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.allowdynamicproperties')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='AllowDynamicProperties'])">
<xi:fallback/>
</xi:include>
</classsynopsis>
</section>
<section>
&reftitle.examples;
<para>
As propriedades dinâmicas foram descontinuadas a partir do PHP 8.2.0,
portanto, usá-las sem marcar a classe com este atributo emitirá
um aviso de descontinuação.
</para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
class DefaultBehaviour { }
#[\AllowDynamicProperties]
class ClassAllowsDynamicProperties { }
$o1 = new DefaultBehaviour();
$o2 = new ClassAllowsDynamicProperties();
$o1->nonExistingProp = true;
$o2->nonExistingProp = true;
?>
]]>
</programlisting>
&example.outputs.82;
<screen>
<![CDATA[
Deprecated: Creation of dynamic property DefaultBehaviour::$nonExistingProp is deprecated in file on line 10
]]>
</screen>
</informalexample>
</section>
<section xml:id="allowdynamicproperties.seealso">
&reftitle.seealso;
<para><link linkend="language.attributes">Visão geral dos atributos</link></para>
</section>
</partintro>
&language.predefined.allowdynamicproperties.construct;
</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
-->