LogoLogo
  • 🧙‍♂️Dude Coding Standards
  • HTML
    • Accessible HTML Guidelines
      • Blocks
      • Upper title/Prefix
      • Global links
      • Search form
    • HTML elements
      • Lists
      • Headings
  • PHP
    • PHP Guidelines
    • Linting PHP with PHP_CodeSniffer
  • CSS
    • CSS and SCSS Guidelines
      • Naming Conventions
        • Custom properties and variables
        • Naming classes
      • Defining font families
      • Nesting
    • Stylelint
  • SVGs
    • Importing SVG files into a project
    • SVGs and accessibility
    • Styling SVGs
Powered by GitBook
On this page
  • Disabling rules
  • PHP Code Beautifier and Fixer (phpcbf)
  • General linting and coding rules

Was this helpful?

Edit on GitHub
Export as PDF
  1. PHP

Linting PHP with PHP_CodeSniffer

Last updated 3 years ago

Was this helpful?

Please also see the installation in or on . Your editors should lint automatically after installing these tools.

Disabling rules

If for some reason you need to use something that has been disallowed in phpcs.xml you should have good arguments in favor to it. You should comment the change accordingly:

<?php
// This rule is disabled in this file because...
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash

PHP Code Beautifier and Fixer (phpcbf)

With phpcbf it's quick to fix the most common errors that are not right accoring to your project phpcs.xml.

phpcbf --standard=phpcs.xml page.php

General linting and coding rules

You should always comment your code as thorough as possible. For indentation we use to char space. Always use the latest .editorconfig:

Air-light Debuggers
devpackages/.editorconfig at master · digitoimistodude/devpackagesGitHub
Page cover image
Logo
Internal Development Docs