Skip to content

Refactoring: PHPStan ignoreErrors を excludePaths に置き換え#32

Merged
wadakatu merged 1 commit intomainfrom
refactor/remove-phpstan-ignore-errors
Mar 16, 2026
Merged

Refactoring: PHPStan ignoreErrors を excludePaths に置き換え#32
wadakatu merged 1 commit intomainfrom
refactor/remove-phpstan-ignore-errors

Conversation

@wadakatu
Copy link
Collaborator

概要

phpstan.neon.distignoreErrors 全5件を削除し、excludePaths: [src/Laravel] に置き換えることで、PHPStan のエラー抑制を解消する。

変更内容

  • ignoreErrors セクション(5件)を全削除
    • Function (app|config) not found
    • Call to an undefined method TestResponse::
    • Access to an undefined property TestResponse::$headers
    • Function config_path not found
    • does not specify its types: TResponse
  • excludePaths: [src/Laravel] を追加

背景

src/Laravel/ 配下のファイルは Laravel ランタイムに依存する API(config(), app(), TestResponse マジックメソッド等)を使用しており、Larastan なしでは正しく型チェックできない。ignoreErrors でエラーを個別に抑制するのではなく、excludePaths でディレクトリごと除外するのが framework-agnostic ライブラリの標準的なアプローチ(spatie/laravel-data 等と同様)。

除外対象のファイルは専用のユニットテスト(namespace-level mock)で十分にカバーされている。

関連情報

  • PHPStan ドキュメント: stub files は "Function not found" の解決手段ではない
  • 参考: spatie/laravel-data も同様に Larastan なし + excludePaths 方式を採用

…vidual errors

Replace 5 ignoreErrors entries with excludePaths for src/Laravel.
Laravel integration files use framework APIs (app(), config(), TestResponse)
that cannot be properly type-checked without Larastan. Excluding the
directory is the standard approach for framework-agnostic libraries.
@wadakatu wadakatu merged commit 953abde into main Mar 16, 2026
8 checks passed
@wadakatu wadakatu deleted the refactor/remove-phpstan-ignore-errors branch March 16, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant