custom-php-running-static-analysis

Runs PHPStan static analysis on PHP files through Laravel Sail containers.

1|Updated Apr 3, 2021
One-click install
npx skills add https://github.com/NaoyaMiyagawa/dotfiles --skill custom-php-running-static-analysis-naoyamiyagawa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: custom-php-running-static-analysis
Source: https://github.com/NaoyaMiyagawa/dotfiles/tree/main/.ai/skills/custom-php-running-static-analysis
Command: npx skills add https://github.com/NaoyaMiyagawa/dotfiles --skill custom-php-running-static-analysis-naoyamiyagawa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It ensures PHP code changes are checked with PHPStan static analysis inside the project's Laravel Sail Docker environment, catching type errors and bugs before they reach production. ## Core Features & Use Cases - Single-File Analysis: Runs PHPStan on a specific changed PHP file via ./vendor/bin/sail exec app ./vendor/bin/phpstan analyze {filepath}. - Scoped Full-App Analysis: Runs PHPStan across the entire application only when the user explicitly requests it, since it takes a long time. - Use Case: After editing a Laravel controller, ask the assistant to run static analysis on that file to verify no PHPStan errors were introduced. ## Quick Start Run PHPStan static analysis on the PHP file I just modified using the Sail container.

Frequently Asked Questions about custom-php-running-static-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run PHPStan on a single PHP file in Laravel Sail?

Run `./vendor/bin/sail exec app ./vendor/bin/phpstan analyze {filepath}`, replacing {filepath} with the path of the changed file. This executes PHPStan inside the Sail app container so the analysis uses the project's exact environment.

How to run PHPStan static analysis on an entire Laravel application?

Run `./vendor/bin/sail exec app ./vendor/bin/phpstan` without a file argument to analyze the whole application. Because this takes a long time, it should only be triggered when the user explicitly requests app-wide analysis.

Does PHPStan analysis require Docker to be running?

Yes, the commands use Laravel Sail, which executes PHPStan inside the app's Docker container. The Sail environment must be up and the `app` service available for the analysis commands to work.

When should I avoid running full-app PHPStan analysis?

Avoid full-app analysis for routine single-file changes because it takes a long time to complete. Use per-file analysis after each code change and reserve app-wide runs for explicit requests, such as before a major release.