phpdocumentor/reflection
Static PHP code reflection library that parses one or more files (no execution) to build an object graph of your application's structure, including DocBlocks. Supports analyzing PHP versions from 5.2 up to your installed PHP version; useful for reflecting whole projects.
Reflection* classes are dynamic (runtime), this library provides static reflection, enabling analysis of unexecuted code (e.g., dead code detection, unused traits, or DocBlock validation). This is particularly useful for legacy codebases or large monoliths where runtime reflection is impractical.ProjectFactory pattern integrate seamlessly with Laravel’s service container and autoloading. No invasive changes are required to the Laravel core.ReflectionClass is recommended.~6.6 for stability or upgrade incrementally.eval(), create_function(), or magic methods like __call). Mitigation: Combine with runtime checks where needed.phpdocumentor/reflection-docblock; malformed DocBlocks could break analysis. Mitigation: Validate DocBlocks pre-analysis or use fallback parsers.Reflection* classes?php artisan for static analysis tasks (e.g., php artisan analyze:unused-code).Illuminate\Filesystem\Events\FileChanged).phpunit or pest with static assertions (e.g., "Class X must implement interface Y").Auth or Mail) to validate integration.ProjectFactory to analyze a subset of files and compare results with manual inspection.@method tags).app/ directory.phpdocumentor/reflection:^6.6 to avoid breaking changes.composer install or post-update-cmd.bootstrap/cache/) or use runtime fallback.macro() won’t appear in static analysis. Workaround: Document macros in DocBlocks or use runtime reflection for validation..blade.php files unless explicitly included. Workaround: Pre-process Blade to extract PHP code.vendor/, node_modules/, and generated files (e.g., bootstrap/cache/).app_path(), config_path(), etc., to resolve file locations.spatie/fork).bootstrap/cache/ to avoid reprocessing unchanged files.roave/security-advisories or php-cs-fixer to auto-correct issues.phpdocumentor/reflection for breaking changes (e.g., type resolver upgrades).phpdocumentor/type-resolver and php-parser, which may introduce indirect dependencies. Use composer why to audit.HasFactory trait").@method syntax.@throws for exceptions, @return for methods).App\Models\User has unused trait Illuminate\Foundation\Auth\User").git diff or stamp files).app/ but not config/).php-parser’s StreamingParser).How can I help you explore Laravel packages today?