svn: /phpdoc/en/trunk/appendices/migration70/ other-changes.xml

From: Date: Wed, 16 Sep 2015 13:52:15 +0000
Subject: svn: /phpdoc/en/trunk/appendices/migration70/ other-changes.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-13732@lists.php.net to get a copy of this message
tpunt Wed, 16 Sep 2015 13:52:15 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=337840 Log: Document loosening reserved word restrictions Changed paths: U phpdoc/en/trunk/appendices/migration70/other-changes.xml Modified: phpdoc/en/trunk/appendices/migration70/other-changes.xml =================================================================== --- phpdoc/en/trunk/appendices/migration70/other-changes.xml 2015-09-16 13:14:28 UTC (rev 337839) +++ phpdoc/en/trunk/appendices/migration70/other-changes.xml 2015-09-16 13:52:15 UTC (rev 337840) @@ -4,12 +4,34 @@ <sect1 xml:id="migration70.other-changes" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Other Changes</title> - <sect2 xml:id="migration70.other-changes.div-by-zero"> - <title>Changes to Division By Zero</title> + <sect2 xml:id="migration70.other-changes.loosening-reserved-words"> + <title>Loosening Reserved Word Restrictions</title> <para> - ... + Globally reserved words as property, constant, and method names within classes, + interfaces, and traits are now allowed. This reduces the surface of BC breaks + when new keywords are introduced and avoids naming restrictions on APIs. </para> + + <para> + This is particularly useful when creating internal DSLs with fluent interfaces: + </para> + <informalexample> + <programlisting role="php"> +<![CDATA[ +<?php +// 'new', 'private', and 'for' were previously unusable +Project::new('Project Name')->private()->for('purpose here')->with('username here'); +?> +]]> + </programlisting> + </informalexample> + + <para> + The only limitation is that the <literal>class</literal> keyword still + cannot be used as a constant name, otherwise it would conflict with the + class name resolution syntax (<literal>ClassName::class</literal>). + </para> </sect2> </sect1>

« previous php.doc.cvs (#13732) next »