承接 backdevs/coding-standard 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

backdevs/coding-standard

最新稳定版本:1.0.0

Composer 安装命令:

composer require backdevs/coding-standard

包简介

Backdevs PHP_CodeSniffer Coding Standard and other static analysis tools' configurations.

README 文档

README

A PHP_CodeSniffer coding standard and other static analysis tools configuration files for Backdevs' PHP projects.

Included default configurations

Installation

Composer:

composer require --dev backdevs/coding-standard

Usage

PHP_CodeSniffer:

In your project's phpcs.xml file add the following line:

<rule ref="BackdevsCodingStandard"/>

If you don't have a phpcs.xml file, here's an example for a Laravel project:

<?xml version="1.0"?>
<ruleset
        name="Backdevs Coding Standard"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd"
>
    <description>Backdevs Coding Standard.</description>
    
    <arg name="extensions" value="php"/>
    <arg name="colors" />

    <arg value="sp"/>

    <file>app</file>
    <file>bootstrap</file>
    <file>config</file>
    <file>database</file>
    <file>routes</file>
    <file>tests</file>

    <exclude-pattern>cache/*</exclude-pattern>

    <rule ref="BackdevsCodingStandard"/>
</ruleset>

Now you should be able to run:

vendor/bin/phpcs

PHP Mess Detector:

If you don't have the phpmd/phpmd package installed, you can install it by running:

composer require --dev phpmd/phpmd

Then, in your project's phpmd.xml file add the following line:

<rule ref="vendor/backdevs/coding-standard/phpmd/phpmd.xml"/>

If you don't have a phpmd.xml file, here's a simple example:

<?xml version="1.0"?>
<ruleset
    name="Backdevs Coding Standard"
    xmlns="http://pmd.sf.net/ruleset/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
    xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
>
    <description>Backdevs Coding Standard.</description>

    <rule ref="vendor/backdevs/coding-standard/phpmd/phpmd.xml"/>
</ruleset>

Now you can run:

vendor/bin/phpmd app,bootstrap,config,database,routes,tests text phpmd.xml

统计信息

  • 总下载量: 104
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-26