A PHP_CodeSniffer custom rule (sniff) to detect obvious WCAG 2.0 accessibility violations.
There are many violations which are not caught but the ability to detect some is better than none.
Requires PHPCS 3.x.
Clone this repository:
git clone https://github.com/FreshConsulting/FreshConsulting-WCAG-Linter.git wcag
Add the repository path to the PHP_CodeSniffer configuration:
phpcs --config-set installed_paths /path/to/wcag
Add the sniff to your custom ruleset:
<rule ref="FreshConsulting.WCAG20.Violations"/>
Or run from the command line:
phpcs --sniffs=FreshConsulting.WCAG20.Violations /path/to/code
Run unit tests with phpunit Test/AllTests
or PHPCS_DIR=/path/to/PHP_CodeSniffer phpunit Test/AllTests
.