Extending the PHP Language with Static Analysis- Dave Liddament
summary
Claims that you can prototype real language features using static analysis and attributes and demonstrates it end to end: uses PHPStan plus Nikita’s PHP parser to walk the AST, implements a custom rule that forbids calling TextMessageSender::sendMessage except from TextMessageQueueProcessor, then replaces hard‑coded config with a friend attribute and a small reflection check. Shows the PHP Language Extension library (friend, package, injectable, test_tag), notes type info is required, and that the implementation is a few dozen lines wired into CI.
AI-written summary · about
chapters (11)
- 0:00Extending PHP with static analysis
- 3:09Solving constraints with static analysis
- 6:39RFC process and static analysis
- 11:17Deep dive into AST
- 15:07Custom PHPStan rule step by step
- 21:25Implementing friend attribute
- 27:05Making rule generic and reusable
- 35:25PHP Extension Library
- 43:56Communicating intent with new features
- 47:49Benefits and future of static analysis
- 51:55Q&A
related talks
32mFrom Zero to Static Analysis Hero
38mWhy you should be using PHPStan in all your projects
25mTypes & static analysis are good in PHP
50mPractical Advanced Static Analysis
53mStatic Analysis Saved My Code Tonight
45mTesting Strategy with the Help of a Static Analyzer
33mCustom PHPStan Rules: Automate Standards and Save Time
54mCrafting Custom PHPStan Rules
