PHP Type Safety

PHP type safety patterns using webmozarts/assert for runtime validation combined with PHPDoc annotations for static analysis. Use this skill whenever writing or reviewing PHP code that needs to pass PHPStan or Psalm at strict levels, when adding type assertions to method/function parameters, when typing complex array structures (shapes, maps, lists), when defining reusable type aliases, or when annotating anonymous objects and key/value arrays. Trigger on phrases like "add type assertions", "type this array properly", "make this pass PHPStan", "annotate with PHPDoc", "use webmozarts assert", "type hints for static analysis", "psalm types", or any request to improve type safety in PHP code.

peterfox 4e61d64 4 files · 28.1 KB Updated

File contents

peterfox/agent-skills/tree/main/php-type-safety commit 4e61d64642

Frequently asked questions

npx skillmds@latest add peterfox/php-type-safety