how do i activate "Flip Binary Expression"?

I have some code that looks like this:
$this->band_id  = $band_id;

and i want to flip it to:
$band_id  = $this->band_id;

Its far more work asking this question that just writing out the code by hand, but in the interests of learning.

when i normally dont know something, i user ctrl+shift+a  and go looking for what it might be.  I found:
"intentions -> PHP -> flip binary expression"
DESCRIPTION: Flip binary expression operands
BEFORE: <?php 1+2;
AFTER: <?php 2+1;

and it seams to be exactly what im after, but the ctrl+shift+a menu when clicked on takes me to the settings instead of doing the action.

in the settings there is no help as to what activates this action.

What activates this action?  (expecting a key combo, like alt+shift+l = reformat code.   ????? = flip binary expression?)



Hi michael,

It is called Intentions. The one you are referring to is Settings | Intentions | PHP | Flip binary expression

Intention is activated by Alt+Enter (or clicking on light bulb when visible).

This particular intention will not work for $this->band_id = $band_id;
but will work for $this->band_id = $band_id + 2;
to make $this->band_id = 2 + $band_id;

and i want to flip it to:
$band_id  = $this->band_id;

Check issue tracker for existing ticket and submit new one if not yet there -- I will definitely vote for this one.


Thanks Andriy,

Can't say ive yet found the need to swap 2+1 to 1+2  and even asking for what im asking for seams excessivly lazy. :)

here is the new feature request in the tracker

The closest one i could see was this one: "Add Intention flip key and value (foreach $key => $value to $value => $key)"

but that seamed different enough to warrant a new request.

Thanks for the help. :)


Please sign in to leave a comment.