andersundsehr/phpstan-git-files
PHPStan extension that automatically feeds PHPStan all tracked .php files from your Git repository, so analysis always matches what’s in version control. Install via Composer and include the provided extension.neon/extension.php in your PHPStan config.
Pros:
getcwd() issues in CI, this backport mitigates the Technical Risk noted for multi-repo or non-standard working directories.excludePaths in phpstan.neon.Cons:
Laravel Compatibility:
phpstan/laravel).php artisan phpstan:git) remain viable for path resolution.Dependencies:
Illuminate/Foundation/Console or PHPStan’s extension system.getcwd() issues, CI/CD robustness improves. Validate in pipelines with:
# Test in GitHub Actions
- run: pwd && git rev-parse --show-toplevel
ln -s vendor/ app/vendor).git read-tree --partial).git submodule update --init).storage/framework/views) better? If not, how?PHPStan Ecosystem:
php artisan phpstan:git) can now rely on the backported fixes for path resolution.Laravel-Specific:
getcwd(), replace getcwd() with base_path() in custom commands for consistency.phpstan.neon:
excludePaths:
- storage/framework/views/
- bootstrap/cache/
Validation Phase:
10.2.8 and verify:
composer require andersundsehr/phpstan-git-files:10.2.8
pwd (e.g., GitHub Actions working-directory).git ls-files for missed files.Artisan Integration (Updated):
public function handle() {
$this->call('phpstan', [
'--config' => 'phpstan.neon',
'--include-extension' => base_path('vendor/andersundsehr/phpstan-git-files/extension.php'),
]);
}
Full Adoption:
includePaths with the extension in phpstan.neon.PHPStan Versions:
10.2.7 if issues arise.Git Environments:
working-directory).git read-tree --partial.git config --global core.symlinks true.Laravel-Specific:
spatie/laravel-package-tools.getcwd() aligns with base_path() (standard in Laravel Dockerfiles).Prerequisites:
composer require phpstan/phpstan:^1.0).git init).Installation:
composer require andersundsehr/phpstan-git-files:10.2.8
Configuration:
phpstan.neon:
includes:
- vendor/andersundsehr/phpstan-git-files/extension.php
excludePaths:
- storage/
- tests/
Post-Deployment:
10.2.8 and test edge cases:
- run: ./vendor/bin/phpstan analyse --include-extension=vendor/andersundsehr/phpstan-git-files/extension.php
git ls-files.excludePaths maintenance (e.g., for CI or submodules).10.2.7 is straightforward.phpstan analyse --generate-baseline with git ls-files.pwd and git rev-parse --show-toplevel in pipelines.storage/framework/views/ unless analyzing compiled code.vendor/guzzlehttp/psr7/src/) if needed.--parallel for multi-core analysis.node_modules/ and `vendorHow can I help you explore Laravel packages today?