Refactoring: PHPStan ignoreErrors を excludePaths に置き換え#32
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
phpstan.neon.distのignoreErrors全5件を削除し、excludePaths: [src/Laravel]に置き換えることで、PHPStan のエラー抑制を解消する。変更内容
ignoreErrorsセクション(5件)を全削除Function (app|config) not foundCall to an undefined method TestResponse::Access to an undefined property TestResponse::$headersFunction config_path not founddoes not specify its types: TResponseexcludePaths: [src/Laravel]を追加背景
src/Laravel/配下のファイルは Laravel ランタイムに依存する API(config(),app(),TestResponseマジックメソッド等)を使用しており、Larastan なしでは正しく型チェックできない。ignoreErrorsでエラーを個別に抑制するのではなく、excludePathsでディレクトリごと除外するのが framework-agnostic ライブラリの標準的なアプローチ(spatie/laravel-data 等と同様)。除外対象のファイルは専用のユニットテスト(namespace-level mock)で十分にカバーされている。
関連情報