CLAUDE.md
CLAUDE.mdCLAUDE.mdroot
Quality
82/100
Scores the file, not the repository.Length
726 words
16 headings · 1 code blocksRepository
14k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# PHPStan - PHP Static Analysis Tool23## Project Overview45PHPStan finds errors in PHP code without running it. It catches bugs before tests are written, moving PHP closer to compiled languages. This is the **distribution repository** — the compiled PHAR and supporting infrastructure. The actual source code lives at [phpstan/phpstan-src](https://github.com/phpstan/phpstan-src).67- **Website:** https://phpstan.org/8- **Documentation:** https://phpstan.org/user-guide/getting-started9- **API Reference:** https://apiref.phpstan.org/1011## Repository Structure1213```14├── phpstan # CLI entry point (shell script loading the PHAR)15├── phpstan.phar # Compiled PHAR archive (~26 MB)16├── phpstan.phar.asc # GPG signature for the PHAR17├── bootstrap.php # PHAR autoloader with PHP version polyfills18├── composer.json # Package definition (requires PHP ^7.4|^8.0)19├── .phar-checksum # MD5 + SHA1 checksums for reproducible builds20├── conf/21│ └── bleedingEdge.neon # Bleeding edge configuration profile22├── e2e/ # End-to-end tests (~67 test scenarios)23├── docker/ # Dockerfiles for PHP 8.0–8.424├── identifier-extractor/ # Tool to extract error identifiers from rule source code25├── playground-api/ # AWS Lambda API for the online playground (TypeScript)26├── playground-runner/ # AWS Lambda runner for the playground (PHP/Bref)27├── website/ # phpstan.org static site (Eleventy + Vite + TailwindCSS)28└── .github/workflows/ # CI/CD workflows29```3031## Key Concepts3233### Distribution Model3435This repository distributes a pre-built PHAR archive. The source code is in [phpstan/phpstan-src](https://github.com/phpstan/phpstan-src), which is on PHP 8.1+ internally but the PHAR build is downgraded to support PHP 7.4+. The `phpstan` script loads the PHAR and delegates to the bundled binary.3637### PHP Version Support3839- **This distribution package:** PHP ^7.4|^8.0 (defined in composer.json)40- **phpstan-src internally:** PHP 8.1+ (downgraded during PHAR build)41- **Other extension repositories** (phpstan-strict-rules, phpstan-doctrine, phpstan-symfony, etc.): still support PHP 7.4+42- **E2E tests run on:** PHP 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5 (Linux + Windows)4344### Bleeding Edge4546The `conf/bleedingEdge.neon` configuration enables experimental/strict checks before they become defaults. Users opt in by including this config.4748### Error Identifiers4950Every PHPStan error has a unique identifier (e.g., `argument.type`, `deadCode.unreachable`). The `identifier-extractor/` tool scans all PHPStan repositories to extract these identifiers, producing JSON used to generate documentation on the website.5152## Development535455### CI Workflows5657Key workflows in `.github/workflows/`:5859- **`tests.yml`** — Runs e2e tests on PHP 7.4–8.5, Linux + Windows. Triggered on changes to `e2e/**`, `phpstan`, `.phar-checksum`, `bootstrap.php`.60- **`other-tests.yml`** — Additional integration tests (PHP-Parser, React Promise, etc.)61- **`integration-tests.yml`** — Tests against major projects (Rector, Larastan, Carbon, etc.)62- **`extension-tests.yml`** — Tests 1st-party PHPStan extensions (PHPUnit, Doctrine, Symfony, etc.)63- **`release.yml`** — Creates GitHub release on tag push, uploads `phpstan.phar` and signature64- **`docker-stable.yml`** / **`docker-nightly.yml`** — Builds multi-arch Docker images (arm64 + amd64) pushed to ghcr.io65- **`extract-identifiers.yml`** — Extracts error identifiers from all PHPStan repos66- **`website.yml`** — Builds and deploys phpstan.org67- **`generate-error-docs.lock.yml`** — Generates error documentation using Claude6869### Current Branch7071The main development branch for this repository is `2.2.x`.7273## Website7475The website (phpstan.org) lives in `website/` and has its own `website/CLAUDE.md` with detailed instructions. Key points:7677- Built with Eleventy (11ty) + Vite + TailwindCSS78- Two-stage build: `npm run build:11ty` then `npm run build:vite`79- Deployed to AWS S3 + CloudFront80- Error documentation in `website/errors/` is auto-generated (see `website/errors/CLAUDE.md`)8182## Playground8384The online playground at https://phpstan.org/try consists of two AWS Lambda services:8586- **playground-api/** — TypeScript API that orchestrates analysis across multiple PHP versions87- **playground-runner/** — PHP Lambda (via Bref) that executes PHPStan against submitted code8889Both are deployed via the Serverless Framework to eu-west-1.9091## Docker9293Dockerfiles in `docker/` build images for PHP 8.0–8.4, based on `php:*-cli-alpine`. Images are published to `ghcr.io` as multi-architecture (arm64 + amd64). The images install PHPStan via Composer and use `phpstan` as the entrypoint.9495## Related Repositories9697- [phpstan/phpstan-src](https://github.com/phpstan/phpstan-src) — Main source code (PHP 8.1+, downgraded for PHAR)98- [phpstan/phpstan-strict-rules](https://github.com/phpstan/phpstan-strict-rules) — Additional strict rules99- [phpstan/phpstan-deprecation-rules](https://github.com/phpstan/phpstan-deprecation-rules) — Deprecation detection100- [phpstan/phpstan-doctrine](https://github.com/phpstan/phpstan-doctrine) — Doctrine integration101- [phpstan/phpstan-symfony](https://github.com/phpstan/phpstan-symfony) — Symfony integration102- [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) — PHPUnit integration103- [phpstan/phpstan-nette](https://github.com/phpstan/phpstan-nette) — Nette integration104- [phpstan/phpstan-webmozart-assert](https://github.com/phpstan/phpstan-webmozart-assert) — Webmozart Assert integration105- [phpstan/phpdoc-parser](https://github.com/phpstan/phpdoc-parser) — PHPDoc parser library106107Extension repositories support PHP 7.4+ and some support multiple versions of the libraries they analyse.108109## Making Changes110111- **Source code changes** belong in [phpstan/phpstan-src](https://github.com/phpstan/phpstan-src), not here112- **E2E tests** can be added or modified in `e2e/`113- **Website content** is in `website/src/` (see `website/CLAUDE.md`)114- **Error documentation** is in `website/errors/` (see `website/errors/CLAUDE.md`)115- Configuration uses NEON format (Nette Object Notation), similar to YAML116
Also in phpstan/phpstan
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| phpstan/phpstanwebsite/CLAUDE.md · 14k | CLAUDE.md | buildtestlint-formatarch+2 | 89/100 | 3 days ago | |
| phpstan/phpstanwebsite/errors/CLAUDE.md · 14k | CLAUDE.md | lint-formatstyledo-notdocs | 77/100 | 3 days ago | |
| phpstan/phpstanwebsite/infra/CLAUDE.md · 14k | CLAUDE.md | teststylearchdeployment | 94/100 | 3 days ago | |
| phpstan/phpstanwebsite/src/_posts/CLAUDE.md · 14k | CLAUDE.md | lint-formatstylearchtypes+1 | 74/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| Adit-Jain-srm/NightmareNetCLAUDE.md · 45 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 3 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.4k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 3 days ago | |
| stacklok/toolhiveCLAUDE.md · 2.0k | CLAUDE.md | buildteststylearch+4 | 100/100 | 3 days ago | |
| dotCMS/corecore-web/CLAUDE.md · 949 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 3 days ago | |
| microsoft/playwrightCLAUDE.md · 94k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| filamentphp/filamentCLAUDE.md · 32k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| livewire/livewireCLAUDE.md · 24k | CLAUDE.md | setupbuildteststyle+4 | 100/100 | 3 days ago | |
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 3 days ago |
