Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use php-cs-fixer

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "how to use php-cs-fixer". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

began

Recently, in the PHP Way, I saw php-cs-fixer in the code style guide chapter.

php-cs-fixer is able to automatically fix code styles for you, not just formatting.

If you only need code that is automatically formatted when saved, PhpStorm can turn this on:

Before looking at other people's projects, many of them are not formatted, at least the above PhpStorm save automatic formatting also did not open it.

Next, we'll start by turning on ways to save automatic php-cs-fixer fixes.

environment

PhpStorm

PHP 8

Install php-cs-fixer

Use global installation here

composer global require friendsofphp/php-cs-fixer

See https://cs.symfony.com/doc/installation.html

Under the root of the project, create a new file: .php-cs-fixer.php with the following content:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report