rfc:ternary_associativity

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:ternary_associativity [2019/04/23 08:36] – vote nikicrfc:ternary_associativity [2019/05/13 15:51] (current) nikic
Line 2: Line 2:
   * Date: 2019-04-09   * Date: 2019-04-09
   * Author: Nikita Popov <nikic@php.net>   * Author: Nikita Popov <nikic@php.net>
-  * Status: Voting+  * Status: Implemented
   * Target Version: PHP 7.4 and PHP 8.0   * Target Version: PHP 7.4 and PHP 8.0
   * Implementation: https://github.com/php/php-src/pull/4017   * Implementation: https://github.com/php/php-src/pull/4017
Line 93: Line 93:
 Code exploiting left-associativity of the ternary operator will become a hard error in PHP 8. As Code exploiting left-associativity of the ternary operator will become a hard error in PHP 8. As
 left-associative ternaries are almost certainly bugs, the impact of this change should be minimal. left-associative ternaries are almost certainly bugs, the impact of this change should be minimal.
 +
 +An analysis of the top 1000 composer packages found 12 instances that will be affected by this RFC. 9 of them are bugs, where a right-associative meaning was intended, but a left-associative one will be used. 3 uses of the form ''$a ? $b : $c ?: $d'' are potentially okay, because the difference between the two interpretations is small and it's not obvious to me which one is actually intended. Detailed analysis results are available at https://gist.github.com/nikic/b6214f87b0e4a7c6fe26919ac849194f.
  
 ===== Future Scope ===== ===== Future Scope =====
Line 102: Line 104:
 Voting started 2019-04-23 and ends 2019-05-07. Voting started 2019-04-23 and ends 2019-05-07.
  
-<doodle title="Deprecate and remove left-associative ternary without explicit parentheses?" auth="nikic" voteType="single" closed="false">+<doodle title="Deprecate and remove left-associative ternary without explicit parentheses?" auth="nikic" voteType="single" closed="true">
    * Yes    * Yes
    * No    * No
 </doodle> </doodle>
  
rfc/ternary_associativity.1556008564.txt.gz · Last modified: 2019/04/23 08:36 by nikic