|
| 1 | +# CLAUDE.MD - Instructions for AI Assistant |
| 2 | + |
| 3 | +This file contains important instructions for working on the phpdoc-parser project. |
| 4 | + |
| 5 | +## Testing and Quality Checks |
| 6 | + |
| 7 | +### Running Tests |
| 8 | + |
| 9 | +Tests are run using PHPUnit: |
| 10 | +```bash |
| 11 | +make tests |
| 12 | +``` |
| 13 | + |
| 14 | +Or directly: |
| 15 | +```bash |
| 16 | +php vendor/bin/phpunit |
| 17 | +``` |
| 18 | + |
| 19 | +### Running PHPStan |
| 20 | + |
| 21 | +PHPStan static analysis is run with: |
| 22 | +```bash |
| 23 | +make phpstan |
| 24 | +``` |
| 25 | + |
| 26 | +Or directly: |
| 27 | +```bash |
| 28 | +php vendor/bin/phpstan |
| 29 | +``` |
| 30 | + |
| 31 | +### Running All Checks |
| 32 | + |
| 33 | +To run all quality checks (lint, code style, tests, and PHPStan): |
| 34 | +```bash |
| 35 | +make check |
| 36 | +``` |
| 37 | + |
| 38 | +This runs: |
| 39 | +- `lint` - PHP syntax checking with parallel-lint |
| 40 | +- `cs` - Code style checking with phpcs |
| 41 | +- `tests` - PHPUnit test suite |
| 42 | +- `phpstan` - Static analysis |
| 43 | + |
| 44 | +## CRITICAL RULES |
| 45 | + |
| 46 | +### ⚠️ MANDATORY: Run After Every Change |
| 47 | + |
| 48 | +**You MUST run both tests and PHPStan after every code change:** |
| 49 | + |
| 50 | +```bash |
| 51 | +make tests && make phpstan |
| 52 | +``` |
| 53 | + |
| 54 | +Or use the comprehensive check: |
| 55 | +```bash |
| 56 | +make check |
| 57 | +``` |
| 58 | + |
| 59 | +**DO NOT** commit or consider work complete until both tests and PHPStan pass successfully. |
| 60 | + |
| 61 | +### ⚠️ NEVER Delete Tests |
| 62 | + |
| 63 | +**NEVER delete any tests.** Tests are critical to the project's quality and regression prevention. If tests are failing: |
| 64 | +- Fix the implementation to make tests pass |
| 65 | +- Only modify tests if they contain actual bugs or if requirements have legitimately changed |
| 66 | +- When in doubt, ask before modifying any test |
| 67 | + |
| 68 | +## Other Available Commands |
| 69 | + |
| 70 | +- `make cs-fix` - Automatically fix code style issues |
| 71 | +- `make lint` - Check PHP syntax only |
| 72 | +- `make cs` - Check code style only |
| 73 | +- `make phpstan-generate-baseline` - Generate PHPStan baseline (use sparingly) |
| 74 | + |
| 75 | +## Workflow Summary |
| 76 | + |
| 77 | +1. Make code changes |
| 78 | +2. Run `make tests` - ensure all tests pass |
| 79 | +3. Run `make phpstan` - ensure static analysis passes |
| 80 | +4. Fix any issues found |
| 81 | +5. Commit only when both pass |
| 82 | +6. Repeat as needed |
| 83 | + |
| 84 | +**Remember: Tests and PHPStan MUST pass before any commit.** |
0 commit comments