- Can I use PhanExtensions with Laravel 10+ and PHP 8.2?
- The package supports PHP 7.1+, but Laravel 10+ requires PHP 8.2. While technically compatible, the unmaintained status means no guarantees for PHP 8.x features like attributes or named arguments. Test thoroughly in a non-production environment.
- How do I add PhanExtensions to my Laravel project?
- Install via Composer: `composer require drenso/phan-extensions`. Configure Phan’s `plugins` array in your `phan.config.php` to include paths like `vendor/drenso/phan-extensions/Plugin/Annotation/SymfonyAnnotationPlugin.php`. Add stubs to `directory_list` and exclude them from analysis.
- Does PhanExtensions work with Symfony annotations in Laravel?
- Yes, the `SymfonyAnnotationPlugin` checks for imported annotations (e.g., `@Route`, `@Middleware`). It ignores `Annotation`, `Target`, and `SuppressWarnings` by default. Useful for Laravel apps leveraging Symfony components like `HttpKernel` or `HttpFoundation`.
- Are the docblock plugins (`@method`, `@throws`) still useful?
- The `@method` plugin remains relevant for marking classes as used. The `@throws` plugin is obsolete in Phan 0.12.3+, so skip it. Phan now handles `@throws` natively, reducing dependency on this package for that feature.
- Will PhanExtensions break if I upgrade Phan to v5.x?
- Likely. The package targets Phan 3.x and is unmaintained. Test compatibility by running Phan with `--debug` after upgrading. If broken, consider forking or replacing obsolete plugins (e.g., `@throws`) with Phan’s built-in features.
- How do I integrate Phan with Laravel’s CI/CD (GitHub Actions)?
- Add Phan to your workflow as a step: `composer require --dev phan/drenso/phan-extensions && vendor/bin/phan`. Fail the build on warnings/errors by checking exit codes. Example: `if [ $? -ne 0 ]; then exit 1; fi`. Pair with `php-cs-fixer` for style checks.
- Are there alternatives to PhanExtensions for Laravel?
- Yes. For Symfony annotations, PHPStan’s `symfony` extension or Psalm’s built-in support may suffice. For stubs, Phan’s core includes some (e.g., `curl`). For docblock parsing, PHPStan/Psalm handle `@method`/`@throws` natively. Evaluate trade-offs before adopting.
- Can I use PhanExtensions stubs (curl, intl, pdo) in production?
- Yes, but benchmark first. Stubbing adds analysis overhead. Test with a large Laravel app (e.g., 50K+ LOC) to measure runtime impact. Disable stubs in CI if performance is critical, then re-enable for critical paths.
- How do I handle false positives from SymfonyAnnotationPlugin?
- False positives often occur with custom annotations. Suppress warnings in Phan’s config: `'suppress_issue_types' => ['PhanUnreferencedClass']`. Test against Laravel’s framework/src to validate accuracy. Report issues to Phan’s GitHub if misclassifications persist.
- Should I fork PhanExtensions for Laravel-specific needs?
- Consider forking if you need Laravel-specific plugins (e.g., `@Route`, `@Middleware` support). Replace obsolete plugins (like `@throws`) with Phan’s native features. Document changes clearly for maintainability. Alternatively, contribute fixes upstream to Phan.