定制 themosis/cs 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

themosis/cs

Composer 安装命令:

composer require themosis/cs

包简介

The Themosis coding standard.

README 文档

README

Themosis Coding Standard

Themosis CS is the coding standard used by Themosis in its projects and libraries.

The package provides a PHP Code Sniffer rules set that allows anyone to format their codebase using our coding standards.

The Themosis ruleset is following the PSR-12 ruleset with some refinements:

  • Force strict type declaration
  • Allow method names with underscore in test files

The list of rules may change over time...

Usage

First install the package using Composer, as well as the dealerdirect/phpcodesniffer-composer-installer plugin like so:

composer require --dev themosis/cs dealerdirect/phpcodesniffer-composer-installer

Composer may ask to "allow" the dealerdirect/phpcodesniffer-composer-installer plugin. Choose yes to allow.

The additional plugin will automatically make PHPCS rulesets available in your project. Upon installation, you should have the phpcs and phpcbf binary files installed, you can run php vendor/bin/phpcs -i to list the available rulesets from the command-line.

Add Themosis ruleset

Once the packages are installed in your project, create a phpcs.xml.dist file at the root of your project and add the following content:

<?xml version="1.0"?>
<ruleset name="My Application">
    <!-- Files -->
    <file>./src</file>
    <file>./tests</file>

    <!-- Code Rules -->
    <rule ref="Themosis"/>
</ruleset>

This is a basic ruleset for your project. The PHP Code Sniffer library is using an xml configuration file. When running the phpcs commands, it will automatically load the ruleset before execution.

The above files will apply the Themosis ruleset against files stored inside the src and tests directories.

Additional information

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2024-06-16