Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
Using PHP CodeSniffer With WordPress: Understanding Code Smells
Jun 13, 2016 @ 17:37:54

On the TutsPlus.com site there's a tutorial posted about using PHP CodeSniffer with WordPress, a popular PHP coding standards tool that helps enforce common coding practices and style in your application.

Oftentimes, the way in which we write code depends on how we got started with programming. [...] In this article, we're going to take an introductory look at code smells. We're going to examine what they are, what they look like, and how they often manifest themselves in the work we do. We'll be using PHP for our examples.

They start with an introduction to the topic of "code smells" including a few examples along with matching code snippets:

  • Example 1: Clear Naming Conventions
  • Example 2: Stay DRY
  • Example 3: Long Parameter Lists

They also include some solutions that can help you avoid these "smells" in your code and refactor out ones that might already exist.

tagged: phpcodesniffer smells introduction examples style bestpractice

Link: http://code.tutsplus.com/tutorials/using-php-codesniffer-with-wordpress-understanding-code-smells--cms-26352


Trending Topics: