Tighten up your Drupal code using PHPStan
summary
Static analysis with PHPStan plus the phpstan-drupal extension finds typos, undefined methods, deprecated APIs, wrong return types for entity storage and queries, render-array callable errors, and bad autoloading. Drupal core currently runs at level 1 and contributions run at level 0 on GitLab CI; the project is pushing to level 2 (and some maintainers use level 9 with bleeding edge and a Baseline). Setup is composer-based and you can auto-generate a Baseline with generate-baseline.
AI-written summary · about
chapters (13)
- 0:00Introduction to PHPStan
- 2:17Why use PHPStan
- 9:26Analyzing code with PHPStan
- 11:15PHPStan vs other tools
- 14:08PHPStan Drupal extension
- 19:25PHPStan Drupal autoloading
- 22:34Service container and deprecations
- 24:44Render arrays and callbacks
- 26:50Stub files and generics
- 30:41Miscellaneous features
- 33:07Adding PHPStan to your project
- 36:20Resources and community
- 38:50Q&A session
