Reader small image

You're reading from  Clean Code in PHP

Product typeBook
Published inOct 2022
PublisherPackt
ISBN-139781804613870
Edition1st Edition
Tools
Right arrow
Authors (2):
Carsten Windler
Carsten Windler
author image
Carsten Windler

Carsten Windler is a Lead PHP engineer at Plan A.
Read more about Carsten Windler

Alexandre Daubois
Alexandre Daubois
author image
Alexandre Daubois

Alexandre Daubois is a Symfony Developer at SensioLabs, the company that created Symfony.
Read more about Alexandre Daubois

View More author details
Right arrow

Syntax checking and code styling

The first group of tools we want to discuss helps us keep our code syntactically correct (i.e., it can be executed correctly by PHP) and formatted in a structured way. It seems to be obvious that the code needs to be written without errors, but it is always good to double-check, as some tools can actively change your code. Having a simple and fast way to ensure this will be essential when we automate the whole code quality process later in this book.

Having your code formatted following a common style guide reduces the effort required to read and understand your code, as well as the code of others. Especially when you are working in a team, an accepted style guide saves you hours of discussions about how to correctly format the code.

We will learn about the following tools:

  • A PHP built-in linter
  • The PHP CS Fixer tool

The PHP built-in linter

The first tool we want to look at is actually not a code quality tool of its own but...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Clean Code in PHP
Published in: Oct 2022Publisher: PacktISBN-13: 9781804613870

Authors (2)

author image
Carsten Windler

Carsten Windler is a Lead PHP engineer at Plan A.
Read more about Carsten Windler

author image
Alexandre Daubois

Alexandre Daubois is a Symfony Developer at SensioLabs, the company that created Symfony.
Read more about Alexandre Daubois