PHP Quality Tools – magic number detector

Got magic numbers in your PHP? Find ’em fast with PHP Magic Number Detector tool.

if ($locationId === 8) {
  // do something awesome
}

probably seems OK to start with, but the next person (including yourself!) coming at this later will wonder what the heck ‘8’ is. And… if you want to search for any other reference to this ‘magic’ location ID… good luck searching your code for the number 8…

Collapsed output in the image below, just to fit it in the picture.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *