Back to Vol 16, Issue 12

PHP Architect · Vol 16, Issue 12 · December 2017

Education Station: How to Write Your Own Code Sniffer

by Matthew Setter

Whether you’re new to PHP, or you’re more of a seasoned veteran, you’ve probably heard about PHP_CodeSniffer. The package, which has been around since September 2006, checks source code for coding standards violations. I’ll start off by showing you how to create a style which is a combination of other standards. I’ll then refactor it, so you learn how to pick and choose only the elements from those standards you need. Finally, I’ll step through the process of creating your own code sniff from scratch, one handling a specific use case.

The full article is in PHP Architect Vol 16, Issue 12. Subscribe to read it and every new issue.

Subscribe
Matthew Setter

About the author

Matthew Setter

Matthew Setter is a software developer, focusing on reliable, tested, and secure PHP code. He’s also the author of Mezzio Essentials  a comprehensive introduction to developing applications with the Mezzio Framework.

Our Partners

Collaborating with industry leaders to bring you the best PHP resources and expertise

Interested in partnering? Get in touch →