Think Build Implement Repeat
London, UK +44 7367 067226
WhatsApp FOLLOW f in X
  1. Home
  2. Blog
  3. What to Enforce and What to Leave Alone
PHP Development

What to Enforce and What to Leave Alone

Keeping a PHP codebase healthy with automated formatting, static analysis and dependency audits, so code reviews focus on design instead of style arguments.

Updated 2 min readBy SpiderHunts Technologies

Free estimateNo obligation

Get a free estimate

Tell us what you need. A senior engineer reads every enquiry.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →

Quick answer — TL;DR

Automate the mechanical checks — formatting, static analysis, dependency auditing — so reviews can be about design rather than style. Enforce consistency, not preference.

Automate the arguments away

Formatting and style are not worth human attention. A formatter applied automatically ends the discussion permanently and frees code review for the things that actually matter.

Any review comment that a tool could have made is a review comment that should have been made by a tool.

The checks worth having

  1. Automatic formatting on commit or in the pipeline
  2. Static analysis at a level the codebase can actually pass
  3. Dependency vulnerability auditing on every build
  4. Tests, run automatically, blocking on failure
  5. Type coverage increasing over time rather than all at once

Static analysis catches real bugs

Type errors, impossible conditions, undefined properties and unreachable code are all found before running anything. On a legacy codebase the first run is usually alarming and usually correct.

  • Start at a level the codebase passes
  • Increase the level gradually, fixing as you go
  • Never suppress a warning without a comment explaining why
  • Run it in the pipeline, not just locally

Review for design, not style

Worth a review commentNot worth it
Is this the right approach?Bracket placement
What happens when this fails?Variable naming preference
Is this tested?Line length
Will the next person understand it?Quote style
Does it handle the edge case?Import ordering

Consistency beats correctness of style

There is no single right way to format PHP. There is enormous value in a codebase where everything looks the same, because it makes unfamiliar code readable.

Pick a standard, automate it, and stop discussing it.

FAQ

Frequently asked questions

The questions readers ask us after this guide.

Still have a question?

Ask us directly — a senior engineer will get back to you.

Ask about your project

Which coding standard?

One of the established ones. Which matters far less than applying it consistently and automatically.

Should static analysis block deployment?

Yes, once the codebase passes at your chosen level. A check that can be ignored will be ignored.

How do we introduce this to legacy code?

Start at a permissive level, apply to changed files first, and raise the bar gradually. All at once is unworkable.

Is code review necessary for a solo developer?

Automated checks certainly. An occasional external review is worth it, because a second perspective finds things the author cannot see.

Keep reading

More on PHP Development

PHP Development

Why PHP Is Still a Sensible Choice

Is PHP still a good choice for business applications? Where modern, typed PHP fits, where another language is better, and the hosting and hiring arguments.

PHP Development

Improving Old Code Without a Rewrite

Modernising a legacy PHP application without a rewrite: move to a supported PHP version, add tests around what matters, then strangle rather than replace.

Start here

Code reviews spent on formatting?

Automate that and the reviews become about design. A day of setup, permanently.

  1. You tell us what you needTwo minutes on the form, or a message on WhatsApp.
  2. A senior engineer reviews itAnd comes back with questions, a realistic range and an honest view on fit.
  3. Free 30-minute scoping callWe talk through scope, options and a realistic estimate — with no obligation.
Free estimateNo obligation

Talk to someone who builds this

Send a short brief and we will come back with an honest view and a realistic range.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →