承接 ashwoodslightfoot/lightfoot-coding-standards 相关项目开发

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

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

ashwoodslightfoot/lightfoot-coding-standards

最新稳定版本:v1.0.3

Composer 安装命令:

composer require ashwoodslightfoot/lightfoot-coding-standards

包简介

Custom PHPCS standard based on PSR-12

README 文档

README

Custom PHP CodeSniffer (PHPCS) standard based on PSR-12.

Installation

composer require ashwoods-lightfoot/lightfoot-coding-standard --dev

Usage

Command Line

vendor/bin/phpcs --standard=LightfootCodingStandard /path/to/your/code

PhpStorm Integration

  1. Go to Settings > Editor > Inspections
  2. Find "PHP_CodeSniffer validation" under "PHP"
  3. Check the box to enable it
  4. Click on the "..." button next to "Coding standard"
  5. Select "Custom" and provide the path to the ruleset.xml file in this package

Included Sniffs

ControlStructures

LogicalOperatorLinePositionSniff

Enforces logical operators (&&, ||) to appear at the start of a new line in multi-line conditions.

Valid:

if ($condition1
    && $condition2) {
    // Code
}

Invalid:

if ($condition1 &&
    $condition2) {
    // Code
}

Formatting

ChainedMethodSemicolonPositionSniff

Enforces that in multi-line chained method calls, the terminating semicolon must be on its own line, aligned with the start of the statement. This sniff is auto-fixable using phpcbf (for example: composer fix in this repo).

Valid:

$installationId = $this->deviceAssignment
                ->getInstallation()
                ?->getId()
;

$this->deviceAssignment
    ->getInstallation()
    ->getId()
;

Invalid:

$installationId = $this->deviceAssignment
                ->getInstallation()
                ?->getId();

$this->deviceAssignment
    ->getInstallation()
    ->getId();

Running Tests

To run the tests for this coding standard:

composer install
composer test

Testing your fixes

composer cs
composer fix

Those commands will run the tests and fix any issues found on the sniff-fixture.php file. Please ensure you do not commit any fixes to the file.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add or modify sniffs
  4. Add or update tests
  5. Submit a pull request

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-13