PHPStorm Tip - Conditional Breakpoints

Simple Condition:

After creating a breakpoint -> right click -> Edit. The conditions box lets you enter the conditions under which the breakpoint will suspend execution.

Break only if another breakpoint has been hit:

I’ve found this really handy for functions that get called a lot, but I only want it to suspend when it’s been called from a specific place. This is great, for example, if I want to only break on a line after it’s been called by a specific test. Here’s how:

  1. Set a breakpoint in the unit test. Right click -> Edit -> Uncheck ‘Suspend’ (because I don’t actually want it to stop here)
  2. Set a breakpoint on the line I actually want to suspend on. Right click -> Edit -> Uncheck ‘Suspend’, Select the breakpoint from step #1 in the “Disabled until selected breakpoint is hit”. If you have so many breakpoints that its hard to find the one you want, see the last tip below.

Bulk edit / delete breakpoints:

You can get to the bulk edit screen using any of these methods:

  • Ctrl + Shift + F8
  • Right Click on a Breakpoint and click “View Breakpoints”
  • Menu: Run -> View Breakpoints

Within the dialog, hitting Ctrl + A then Delete will remove all breakpoints.