~/talk

Custom PHPStan Rules: Automate Standards and Save Time

Talkat phpday 2025 · 2025-05-15..05-16· [php, developer-experience]
slides:none on file

Creates three custom PHPStan rules that run on the AST using nikic/php-parser and PHPStan’s Rule interface, including a route validator (regex-based) that enforces kebab-case URLs and camelCase params, an alert-service upgrade rule that finds calls missing the new type argument, and an extension.neon checker that detects rule classes not registered in the extension file. Implements rules with RuleErrorBuilder, packages them as a PHPStan extension via composer, and reports concrete missing-argument and registration errors during analysis.

AI-written summary · about

  1. 0:00Introduction
  2. 1:46Enforcing coding standards
  3. 5:15Abstract Syntax Tree
  4. 8:10PHPStan custom rules
  5. 11:40First rule: URL validation
  6. 17:22Library upgrade assistance
  7. 21:20Alert service upgrade rule
  8. 24:54Sharing upgrade rules
  9. 28:26Automating rule registration
  10. 31:13Bug prevention with rules
  11. 32:19Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.