- Why is phpstan/phpstan-shim deprecated in Laravel projects?
- The package is obsolete since PHPStan 0.12.0, which now ships as a PHAR file directly via `phpstan/phpstan`. The shim’s dependency conflict resolution is redundant, and modern Laravel projects should use the official PHAR-based package for seamless integration.
- How do I migrate from phpstan/phpstan-shim to phpstan/phpstan in Laravel?
- Update your `composer.json` to use `phpstan/phpstan:^0.12`, delete `composer.lock`, remove the `vendor/phpstan` directory, and delete `vendor/bin/phpstan` and `vendor/bin/phpstan.phar`. Run `composer install` to reinstall with the PHAR-based version.
- Will phpstan/phpstan-shim work with Laravel 8/9/10?
- No, the shim is deprecated and incompatible with modern Laravel versions. Use `phpstan/phpstan:^1.0` or `^0.12` instead, which fully supports Laravel 8+ and integrates natively with PHAR files, avoiding dependency conflicts.
- Does phpstan/phpstan-shim support Laravel-specific static analysis like Eloquent or Blade?
- No, the shim lacks Laravel-specific rules. For Eloquent, Facades, or Blade support, pair `phpstan/phpstan` with extensions like `laravel-shift/phpstan-rules` or `nunomaduro/phpstan-laravel` for comprehensive static analysis.
- Can I still use phpstan/phpstan-shim for Laravel 5.x or 6.x?
- No, even legacy Laravel versions should avoid the shim. PHPStan 0.12.99 (PHAR-only) may work as a stopgap for Laravel 5.8+, but upgrading to Laravel 8+ with PHPStan 1.x is strongly recommended for long-term support.
- What risks does using phpstan/phpstan-shim introduce in production?
- Using the deprecated shim risks security vulnerabilities from unmaintained dependencies and breakage when PHPStan’s PHAR API evolves. It also misses Laravel-specific static analysis, leaving critical issues undetected.
- How do I update my CI/CD pipeline from phpstan-shim to phpstan/phpstan?
- Replace references to `phpstan-shim` with `phpstan/phpstan:^0.12` in your CI scripts. For GitHub Actions or GitLab CI, ensure the PHAR is installed by running `composer install` before static analysis steps.
- Are there alternatives to phpstan/phpstan-shim for dependency conflict resolution?
- No, PHPStan 0.12+ resolves conflicts natively via PHAR files. For Laravel, use `phpstan/phpstan` with extensions like `nunomaduro/phpstan-laravel` for conflict-free, optimized static analysis.
- Does phpstan/phpstan-shim work with PestPHP or Laravel Mix?
- No, the shim is incompatible with modern tooling. `phpstan/phpstan` integrates seamlessly with PestPHP and Laravel Mix/Vite via `composer.json` scripts, offering better performance and compatibility.
- How do I verify my migration to phpstan/phpstan is successful?
- Run `vendor/bin/phpstan --version` to confirm the PHAR is installed. Test static analysis on a Laravel project with `vendor/bin/phpstan analyse app`, and validate Laravel-specific rules using extensions like `laravel-shift/phpstan-rules`.