PHP Code Beautifier and Fixer (phpcbf)

Authored by

All of us PHP developers should be very well familiar with WordPress Coding Standards for PHP_CodeSniffer (phpcs). It automatically finds problems in WordPress code, both in terms of code style but also in terms of performance and security. It should be configured in your IDE and called in your repos’ pre-commit hooks.

Did you also know that PHP_CodeSniffer includes a tool called phpcbf (PHP Code Beautifier and Fixer) that can automatically fix a lot of the issues that PHPCS discovers?

So to do an initial pass to fix a plugin’s PHP code, you can just run:

phpcbf --standard=WordPress-Core php/*.php

This is great for automating the accommodation for WordPress’s affection for whitespace 🙂

Check out Using the PHP Code Beautifier and Fixer.

#cli #phpcs

6 thoughts on “PHP Code Beautifier and Fixer (phpcbf)”

  1. Your web page has given myself a lot of very helpful guidance, and
    for which I thank you very much. This post is the best I have
    read so far on your website, and so I felt I had to take time to post a comment.
    You’ve provided myself a few tips that could aid me down the road.

  2. So as to keep your office and devices in check, electronic
    medical data software program could conserve you time, cash and room.
    Electronic medical report software program moreover has the option of CPT
    codes lookup. The CPT indicates current procedural terminology.
    Most of the electronic medical document packages routinely make the most of the CPT lookup.
    As in all other spot of existence, the medical records location is being
    modified and challenged by the at any time shifting electronic entire world.

    Furthermore the overhead associated with maintaining an assembly operation operating can poorly affect
    a company’s backside line-particularly when their merchandise are low quantity, and high combine which may lead to numerous idle time for his or her in-house assembly operation. The time it takes to smoke a cigarette and the time chosen to smoke can be deep seeded to thoughts as an emotional crutch, a de-stressor, a artistic affiliation or
    something to do for fidgety hands throughout considering or conversing.
    You don’t have to create or stock a product, you don’t must deal with sophisticated payment processors,
    you don’t must spend extra time on assist or processing refunds and you continue to get to be
    taught the basics of web advertising. Secondly, it is going to allow them to
    get one of the best product and the very best service provider by reading opinions and
    rankings, and eventually additionally they get various reductions affords,
    free shipping and cash back guarantee for their purchases.

  3. The dish is eaten with a stage wood stick which slides below the cake making it easy to
    ladle out from the bowl. Within the Vietnamese, folks known as it like Saigon Nho, as
    a result of it represents massive Saigon in Vietnam.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.