bypassflow/standards 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

bypassflow/standards

最新稳定版本:v0.0.0

Composer 安装命令:

composer require bypassflow/standards

包简介

共有コーディング規約、php-cs-fixer custom fixer、関連文書を提供する standards package。

README 文档

README

bypassflow/standards は、bypassflow の PHP コーディング規約を実装で支える package です。 php-cs-fixer 向け custom fixer と、改行スタイルを機械検査する checker を提供します。

概要

  • custom fixer: Bypassflow/leading_continuation_indent
  • checker: tools/php/check-line-break-style.php
  • 対象スタイル: 行頭継続演算子、method chain、ternary の改行インデント

Requirements

  • PHP 8.5+
  • friendsofphp/php-cs-fixer 3.68+

Installation

composer require --dev bypassflow/standards

Quick Start

LeadingContinuationIndentFixer は、行頭継続演算子、method chain、ternary の改行インデントを workspace 規約へ揃えます。 まず .php-cs-fixer.dist.php で fixer を有効化します。

<?php

declare(strict_types=1);

use bypassflow\Standards\PhpCsFixer\CustomFixer\LeadingContinuationIndentFixer;
use PhpCsFixer\Config;
use PhpCsFixer\Finder;

return (new Config())->setFinder((new Finder())->in([
    \sprintf('%s/src', __DIR__),
    \sprintf('%s/tests', __DIR__),
]))->registerCustomFixers([
    new LeadingContinuationIndentFixer(),
])->setRules([
    'Bypassflow/leading_continuation_indent' => true,
]);

適用後の形は次のようになります。

<?php

declare(strict_types=1);

function resolve_label(?string $display_name, string $fallback_name, bool $is_enabled): string
{
    $name = $display_name
     ?? $fallback_name;

    return $is_enabled
     ? $name
     : 'disabled';
}

if とメソッドチェーンを組み合わせた例:

<?php

declare(strict_types=1);

function resolve_schedule_label(\DateTimeImmutable $baseAt, bool $prefer_jst): string
{
    if ($prefer_jst && $baseAt
    ->setTimezone(new \DateTimeZone('Asia/Tokyo'))
    ->format('N') !== '7') {
        return $baseAt
        ->setTimezone(new \DateTimeZone('Asia/Tokyo'))
        ->setTime(9, 0)
        ->format(\DateTimeInterface::ATOM);
    }

    return $baseAt
    ->setTimezone(new \DateTimeZone('UTC'))
    ->setTime(0, 0)
    ->format(\DateTimeInterface::ATOM);
}

改行スタイル checker は次で実行できます。

php tools/php/check-line-break-style.php src tests

主要 API

  • bypassflow\Standards\PhpCsFixer\CustomFixer\LeadingContinuationIndentFixer
  • tools/php/check-line-break-style.php

functions/helper

  • package から公開している関数 helper はありません

補助文書

  • 詳細な利用例と CI への組み込み: USAGE.md

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固