Book Image

PhpStorm Cookbook

By : Mukund Chaudhary
Book Image

PhpStorm Cookbook

By: Mukund Chaudhary

Overview of this book

Table of Contents (16 chapters)
PhpStorm Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Code sniffer and PhpStorm


Have you noticed why defense personnel keep sniffer dogs? No? The purpose of the sniffer dogs is to sniff items around and detect for any illegal items present in those items. You might wonder how a dog decides which one is illegal and which one is legal, and even if it does that, how can it inform the humans about the validity of the item. A dog just knows how to bark: it barks at both times, happy or sad. Everything said and done, the question still remains. How does a dog know about an illegal object?

The answer is straight, abrupt, and terse: a dog is configured or trained to do that.

You have PhpStorm, right? You have been using it for all your programming needs, right? You can similarly use PhpStorm to sniff your code and inform you if the code contains some coding standard violation. The system that provides this functionality to PhpStorm is PHPCS or PHP Code Sniffer.

PHP Code Sniffer is a PHP5 script that tokenizes PHP, JavaScript, and CSS files to detect violations...