> 2020年7月23日 下午8:26,Nikita Popov <nikita....@gmail.com> 写道: > > Hi internals, > > PHP currently has an incorrect right-associative ternary operator. In > https://wiki.php.net/rfc/ternary_associativity the use of nested ternaries > was deprecated, and was supposed to become an error in PHP 8.0. > > Concurrently with that proposal > https://wiki.php.net/rfc/concatenation_precedence made a very similar > change to the concatenation operator precedence. The difference here is > that this throws a deprecation notice in PHP 7.4 (same), but changes the > behavior in PHP 8.0 (rather than making it an error). > > This is a pretty nonsensical outcome, in that the same type of change is > implemented in two different ways. I think it would be good to handle the > ternary change the same way as the concatenation change, i.e. make > ternaries use the correct left-associative behavior in PHP 8.0, rather than > throwing an error. > > Any thoughts on that? > > Regards, > Nikita
I would rather both of them become errors It is evil to use associativity instead of explicit parentheses The evaluation results of these two RFCs are that the impact of these changes should be minimal and it almost always is an error, so if we want to make them consistent, why not make them all become errors? Regards, Twosee -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php