Phpinspectionsea: Ternary mixed with spaceships confuses the "suspicious ternary" inspection

Created on 6 Sep 2018  路  2Comments  路  Source: kalessil/phpinspectionsea

The following code raises the suspicious ternary operator warning.

$b['foo'] <=> $a['bar'] ?: $a['baz'] <=> $b['bat'];

This is a common and elegant way to express both a primary and secondary sort order. However, the inspection thinks this will not work as expected; yet it does work.

bug / false-positive fixed

All 2 comments

Thank you for reporting @Bilge, confirmed.

Fixed!

Was this page helpful?
0 / 5 - 0 ratings