-
Notifications
You must be signed in to change notification settings - Fork 806
Document #[\Deprecated]
#3894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Document #[\Deprecated]
#3894
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
19e79e4
Bootstrap the Deprecated attribute with docgen
TimWolla e3f39e2
Fix Deprecated with gen_stub.php
TimWolla a3fc46e
Document `#[\Deprecated]`
TimWolla a2cdd7f
Try to satisfy the linter for `#[\Deprecated]`
TimWolla 4b8fb19
Fix some markup issues
Girgias 5ad63c5
Fix indendation
TimWolla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<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"> | ||
<title>The Deprecated attribute</title> | ||
<titleabbrev>Deprecated</titleabbrev> | ||
|
||
<partintro> | ||
|
||
<section xml:id="deprecated.intro"> | ||
&reftitle.intro; | ||
<simpara> | ||
This attribute is used to mark functionality as deprecated. | ||
Using deprecated functionality will cause an <constant>E_USER_DEPRECATED</constant> error to be emitted. | ||
</simpara> | ||
</section> | ||
|
||
<section xml:id="deprecated.synopsis"> | ||
&reftitle.classsynopsis; | ||
|
||
<classsynopsis class="class"> | ||
<ooclass> | ||
<modifier>final</modifier> | ||
<classname>Deprecated</classname> | ||
</ooclass> | ||
|
||
<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo> | ||
<fieldsynopsis> | ||
<modifier>public</modifier> | ||
<modifier>readonly</modifier> | ||
<type class="union"><type>string</type><type>null</type></type> | ||
<varname linkend="deprecated.props.message">message</varname> | ||
</fieldsynopsis> | ||
<fieldsynopsis> | ||
<modifier>public</modifier> | ||
<modifier>readonly</modifier> | ||
<type class="union"><type>string</type><type>null</type></type> | ||
<varname linkend="deprecated.props.since">since</varname> | ||
</fieldsynopsis> | ||
|
||
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo> | ||
<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'])"> | ||
<xi:fallback/> | ||
</xi:include> | ||
</classsynopsis> | ||
</section> | ||
|
||
<section xml:id="deprecated.props"> | ||
&reftitle.properties; | ||
<variablelist> | ||
<varlistentry xml:id="deprecated.props.message"> | ||
<term><varname>message</varname></term> | ||
<listitem> | ||
<para> | ||
An optional message explaining the reason for the deprecation and possible replacement functionality. | ||
Will be included in the emitted deprecation message. | ||
</para> | ||
</listitem> | ||
</varlistentry> | ||
<varlistentry xml:id="deprecated.props.since"> | ||
<term><varname>since</varname></term> | ||
<listitem> | ||
<para> | ||
An optional string indicating since when the functionality is deprecated. | ||
The contents are not validated by PHP and may contain a version number, | ||
a date or any other value that is considered appropriate. | ||
Will be included in the emitted deprecation message. | ||
</para> | ||
<para> | ||
Functionality that is part of PHP will use Major.Minor as the <varname>since</varname> value, | ||
for example <literal>'8.4'</literal>. | ||
</para> | ||
</listitem> | ||
</varlistentry> | ||
</variablelist> | ||
</section> | ||
|
||
<section> | ||
&reftitle.examples; | ||
<informalexample> | ||
<programlisting role="php"> | ||
<![CDATA[ | ||
<?php | ||
|
||
#[\Deprecated(message: "use safe_replacement() instead", since: "1.5")] | ||
function unsafe_function() | ||
{ | ||
echo "This is unsafe", PHP_EOL; | ||
} | ||
|
||
unsafe_function(); | ||
|
||
?> | ||
]]> | ||
</programlisting> | ||
&example.outputs.84.similar; | ||
<screen> | ||
<![CDATA[ | ||
Deprecated: Function unsafe_function() is deprecated since 1.5, use safe_replacement() instead in example.php on line 9 | ||
This is unsafe | ||
]]> | ||
</screen> | ||
</informalexample> | ||
</section> | ||
|
||
<section xml:id="deprecated.seealso"> | ||
&reftitle.seealso; | ||
<simplelist> | ||
<member><link linkend="language.attributes">Attributes overview</link></member> | ||
<member><methodname>ReflectionFunctionAbstract::isDeprecated</methodname></member> | ||
<member><methodname>ReflectionClassConstant::isDeprecated</methodname></member> | ||
<member><constant>E_USER_DEPRECATED</constant></member> | ||
</simplelist> | ||
</section> | ||
|
||
</partintro> | ||
|
||
&language.predefined.attributes.deprecated.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 | ||
--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<refentry xml:id="deprecated.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
<refnamediv> | ||
<refname>Deprecated::__construct</refname> | ||
<refpurpose>Construct a new Deprecated attribute instance</refpurpose> | ||
</refnamediv> | ||
|
||
<refsect1 role="description"> | ||
&reftitle.description; | ||
<constructorsynopsis role="Deprecated"> | ||
<modifier>public</modifier> <methodname>Deprecated::__construct</methodname> | ||
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>message</parameter><initializer>&null;</initializer></methodparam> | ||
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>since</parameter><initializer>&null;</initializer></methodparam> | ||
</constructorsynopsis> | ||
<simpara> | ||
Constructs a new <classname>Deprecated</classname> instance. | ||
</simpara> | ||
</refsect1> | ||
|
||
<refsect1 role="parameters"> | ||
&reftitle.parameters; | ||
<variablelist> | ||
<varlistentry> | ||
<term><parameter>message</parameter></term> | ||
<listitem> | ||
<para> | ||
The value of the <property linkend="deprecated.props.message">message</property> property. | ||
</para> | ||
</listitem> | ||
</varlistentry> | ||
<varlistentry> | ||
<term><parameter>since</parameter></term> | ||
<listitem> | ||
<para> | ||
The value of the <property linkend="deprecated.props.since">since</property> property. | ||
</para> | ||
</listitem> | ||
</varlistentry> | ||
</variablelist> | ||
</refsect1> | ||
</refentry> | ||
<!-- 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 | ||
--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.