Files
php-doc-ru/language/predefined/attributes/allowdynamicproperties.xml
2023-08-31 22:42:11 +03:00

97 lines
3.0 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 14767af0f05dffa6fdb9b49e1a1f4e9ca7022a60 Maintainer: sergey Status: ready -->
<!-- Reviewed: no -->
<phpdoc:classref xml:id="class.allowdynamicproperties" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Класс AllowDynamicProperties</title>
<titleabbrev>AllowDynamicProperties</titleabbrev>
<partintro>
<section xml:id="allowdynamicproperties.intro">
&reftitle.intro;
<para>
Атрибут используется для маркировки классов, которые позволяют использовать
<link linkend="language.oop5.properties.dynamic-properties">динамические свойства</link>.
</para>
</section>
<section xml:id="allowdynamicproperties.synopsis">
&reftitle.classsynopsis;
<classsynopsis class="class">
<ooclass>
<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>
Динамические свойства устарели, начиная с PHP 8.2.0, поэтому их использование без маркировки
класса этим атрибутом приведёт к появлению уведомления об устаревании.
</para>
<example>
<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>
</example>
</section>
<section xml:id="allowdynamicproperties.seealso">
&reftitle.seealso;
<para><link linkend="language.attributes">Введение в атрибуты</link></para>
</section>
</partintro>
&language.predefined.allowdynamicproperties.construct;
</phpdoc:classref>
<!-- 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
-->