|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<reference xml:id="class.deprecated" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 3 | + <title>The Deprecated attribute</title> |
| 4 | + <titleabbrev>Deprecated</titleabbrev> |
| 5 | + |
| 6 | + <partintro> |
| 7 | + |
| 8 | + <section xml:id="deprecated.intro"> |
| 9 | + &reftitle.intro; |
| 10 | + <simpara> |
| 11 | + This attribute is used to mark functionality as deprecated. |
| 12 | + Using deprecated functionality will cause an <constant>E_USER_DEPRECATED</constant> error to be emitted. |
| 13 | + </simpara> |
| 14 | + </section> |
| 15 | + |
| 16 | + <section xml:id="deprecated.synopsis"> |
| 17 | + &reftitle.classsynopsis; |
| 18 | + |
| 19 | + <classsynopsis class="class"> |
| 20 | + <ooclass> |
| 21 | + <modifier>final</modifier> |
| 22 | + <classname>Deprecated</classname> |
| 23 | + </ooclass> |
| 24 | + |
| 25 | + <classsynopsisinfo role="comment">&Properties;</classsynopsisinfo> |
| 26 | + <fieldsynopsis> |
| 27 | + <modifier>public</modifier> |
| 28 | + <modifier>readonly</modifier> |
| 29 | + <type class="union"><type>string</type><type>null</type></type> |
| 30 | + <varname linkend="deprecated.props.message">message</varname> |
| 31 | + </fieldsynopsis> |
| 32 | + <fieldsynopsis> |
| 33 | + <modifier>public</modifier> |
| 34 | + <modifier>readonly</modifier> |
| 35 | + <type class="union"><type>string</type><type>null</type></type> |
| 36 | + <varname linkend="deprecated.props.since">since</varname> |
| 37 | + </fieldsynopsis> |
| 38 | + |
| 39 | + <classsynopsisinfo role="comment">&Methods;</classsynopsisinfo> |
| 40 | + <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.deprecated')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='Deprecated'])"> |
| 41 | + <xi:fallback/> |
| 42 | + </xi:include> |
| 43 | + </classsynopsis> |
| 44 | + </section> |
| 45 | + |
| 46 | + <section xml:id="deprecated.props"> |
| 47 | + &reftitle.properties; |
| 48 | + <variablelist> |
| 49 | + <varlistentry xml:id="deprecated.props.message"> |
| 50 | + <term><varname>message</varname></term> |
| 51 | + <listitem> |
| 52 | + <para> |
| 53 | + An optional message explaining the reason for the deprecation and possible replacement functionality. |
| 54 | + Will be included in the emitted deprecation message. |
| 55 | + </para> |
| 56 | + </listitem> |
| 57 | + </varlistentry> |
| 58 | + <varlistentry xml:id="deprecated.props.since"> |
| 59 | + <term><varname>since</varname></term> |
| 60 | + <listitem> |
| 61 | + <para> |
| 62 | + An optional string indicating since when the functionality is deprecated. |
| 63 | + The contents are not validated by PHP and may contain a version number, |
| 64 | + a date or any other value that is considered appropriate. |
| 65 | + Will be included in the emitted deprecation message. |
| 66 | + </para> |
| 67 | + <para> |
| 68 | + Functionality that is part of PHP will use Major.Minor as the <varname>since</varname> value, |
| 69 | + for example <literal>'8.4'</literal>. |
| 70 | + </para> |
| 71 | + </listitem> |
| 72 | + </varlistentry> |
| 73 | + </variablelist> |
| 74 | + </section> |
| 75 | + |
| 76 | + <section> |
| 77 | + &reftitle.examples; |
| 78 | + <informalexample> |
| 79 | + <programlisting role="php"> |
| 80 | +<![CDATA[ |
| 81 | +<?php |
| 82 | +
|
| 83 | +#[\Deprecated(message: "use safe_replacement() instead", since: "1.5")] |
| 84 | +function unsafe_function() |
| 85 | +{ |
| 86 | + echo "This is unsafe", PHP_EOL; |
| 87 | +} |
| 88 | +
|
| 89 | +unsafe_function(); |
| 90 | +
|
| 91 | +?> |
| 92 | +]]> |
| 93 | + </programlisting> |
| 94 | + &example.outputs.84.similar; |
| 95 | + <screen> |
| 96 | +<![CDATA[ |
| 97 | +Deprecated: Function unsafe_function() is deprecated since 1.5, use safe_replacement() instead in example.php on line 9 |
| 98 | +This is unsafe |
| 99 | +]]> |
| 100 | + </screen> |
| 101 | + </informalexample> |
| 102 | + </section> |
| 103 | + |
| 104 | + <section xml:id="deprecated.seealso"> |
| 105 | + &reftitle.seealso; |
| 106 | + <simplelist> |
| 107 | + <member><link linkend="language.attributes">Attributes overview</link></member> |
| 108 | + <member><methodname>ReflectionFunctionAbstract::isDeprecated</methodname></member> |
| 109 | + <member><methodname>ReflectionClassConstant::isDeprecated</methodname></member> |
| 110 | + <member><constant>E_USER_DEPRECATED</constant></member> |
| 111 | + </simplelist> |
| 112 | + </section> |
| 113 | + |
| 114 | + </partintro> |
| 115 | + |
| 116 | + &language.predefined.attributes.deprecated.construct; |
| 117 | + |
| 118 | +</reference> |
| 119 | +<!-- Keep this comment at the end of the file |
| 120 | +Local variables: |
| 121 | +mode: sgml |
| 122 | +sgml-omittag:t |
| 123 | +sgml-shorttag:t |
| 124 | +sgml-minimize-attributes:nil |
| 125 | +sgml-always-quote-attributes:t |
| 126 | +sgml-indent-step:1 |
| 127 | +sgml-indent-data:t |
| 128 | +indent-tabs-mode:nil |
| 129 | +sgml-parent-document:nil |
| 130 | +sgml-default-dtd-file:"~/.phpdoc/manual.ced" |
| 131 | +sgml-exposed-tags:nil |
| 132 | +sgml-local-catalogs:nil |
| 133 | +sgml-local-ecat-files:nil |
| 134 | +End: |
| 135 | +vim600: syn=xml fen fdm=syntax fdl=2 si |
| 136 | +vim: et tw=78 syn=sgml |
| 137 | +vi: ts=1 sw=1 |
| 138 | +--> |
0 commit comments