PHPackages                             matthiasnoback/code-sniffer-sniff-dsl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. matthiasnoback/code-sniffer-sniff-dsl

ActiveLibrary[Testing &amp; Quality](/categories/testing)

matthiasnoback/code-sniffer-sniff-dsl
=====================================

DSL for writing sniffs for PHP\_CodeSniffer

v0.3.0(12y ago)103.0k11MITPHP

Since Mar 19Pushed 10y ago5 watchersCompare

[ Source](https://github.com/matthiasnoback/code-sniffer-sniff-dsl)[ Packagist](https://packagist.org/packages/matthiasnoback/code-sniffer-sniff-dsl)[ Docs](http://github.com/matthiasnoback/code-sniffer-sniff-dsl)[ RSS](/packages/matthiasnoback-code-sniffer-sniff-dsl/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (4)Used By (1)

DSL for writing PHP\_CodeSniffer sniffs
=======================================

[](#dsl-for-writing-php_codesniffer-sniffs)

[![Build Status](https://camo.githubusercontent.com/4c6e68b5b8cd6d822e5ea6e0484786430dae6a83ccdc5224bedb897263a57db9/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6d617474686961736e6f6261636b2f636f64652d736e69666665722d736e6966662d64736c2e706e67)](http://travis-ci.org/matthiasnoback/code-sniffer-sniff-dsl)

Using this library you can easily write code sniffs for [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer). When you don't use this DSL you will find yourself writing lots of specific, never reusable code.

Example
-------

[](#example)

Say you want to create a code sniff that triggers an error if a PHP file contains an (auto-generated) doc comment at the top (this is called a "file comment"). You should first create a "matcher" for this specific situation:

```
