d48cda4081
CI / Test (ubuntu-latest, Node 18.x, bun) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, npm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, pnpm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, yarn) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 20.x, bun) (push) Failing after 17m13s
CI / Test (ubuntu-latest, Node 20.x, npm) (push) Failing after 18m42s
CI / Test (ubuntu-latest, Node 20.x, pnpm) (push) Failing after 15m0s
CI / Test (ubuntu-latest, Node 20.x, yarn) (push) Failing after 49m44s
CI / Test (ubuntu-latest, Node 22.x, bun) (push) Failing after 51m55s
CI / Test (ubuntu-latest, Node 22.x, pnpm) (push) Failing after 21m57s
CI / Test (ubuntu-latest, Node 22.x, npm) (push) Failing after 37m39s
CI / Test (ubuntu-latest, Node 22.x, yarn) (push) Failing after 34m7s
CI / Validate Components (push) Failing after 37m15s
CI / Python Tests (push) Failing after 10m1s
CI / Security Scan (push) Failing after 10m1s
CI / Lint (push) Failing after 17m12s
CI / Coverage (push) Failing after 20m19s
CI / Test (macos-latest, Node 18.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, yarn) (push) Has been cancelled
41 lines
2.0 KiB
Markdown
41 lines
2.0 KiB
Markdown
---
|
|
paths:
|
|
- "**/*.php"
|
|
- "**/composer.json"
|
|
---
|
|
# PHP コーディングスタイル
|
|
|
|
> このファイルは [common/coding-style.md](../common/coding-style.md) を PHP 固有のコンテンツで拡張します。
|
|
|
|
## 標準
|
|
|
|
- **PSR-12** のフォーマットと命名規則に従う。
|
|
- アプリケーションコードでは `declare(strict_types=1);` を優先する。
|
|
- 新しいコードが許す限り、スカラー型ヒント、戻り値の型、型付きプロパティをあらゆる箇所で使用する。
|
|
|
|
## 不変性
|
|
|
|
- サービス境界を越えるデータには不変の DTO と値オブジェクトを優先する。
|
|
- 可能な場合はリクエスト/レスポンスペイロードに `readonly` プロパティまたは不変コンストラクタを使用する。
|
|
- 単純なマップには配列を使用する; ビジネスクリティカルな構造は明示的なクラスに昇格させる。
|
|
|
|
## フォーマット
|
|
|
|
- フォーマットには **PHP-CS-Fixer** または **Laravel Pint** を使用する。
|
|
- 静的解析には **PHPStan** または **Psalm** を使用する。
|
|
- Composer スクリプトをチェックインし、ローカルと CI で同じコマンドが実行されるようにする。
|
|
|
|
## インポート
|
|
|
|
- 参照されるすべてのクラス、インターフェース、トレイトに `use` 文を追加する。
|
|
- プロジェクトが明示的に完全修飾名を好む場合を除き、グローバル名前空間への依存を避ける。
|
|
|
|
## エラーハンドリング
|
|
|
|
- 例外的な状態には例外をスローする; 新しいコードでは隠れたエラーチャネルとして `false`/`null` を返すことを避ける。
|
|
- フレームワーク/リクエスト入力をドメインロジックに到達する前に検証済み DTO に変換する。
|
|
|
|
## リファレンス
|
|
|
|
スキル: `backend-patterns` でより広範なサービス/リポジトリの階層化ガイダンスを参照してください。
|