{"id":"cb4c9ebb-cc9e-47a1-adbb-d500a275f4ac","shortId":"xN37AQ","kind":"skill","title":"php-modernization","tagline":"Use when modernizing PHP code: PHP 8.1-8.5 features, PSR/PHP-FIG/PER-CS compliance, PHPStan/Rector/PHP-CS-Fixer/PHPat tooling, DTOs/enums/readonly/property hooks, type safety. Triggers: PHP modernization, type safety, PHPStan, Rector, PHP-CS-Fixer, enum, DTO, readonly, strict_typ","description":"# PHP Modernization\n\nModernize PHP to 8.1-8.5, PSR/PER-CS, PHPStan max, type safety.\n\n## Agent contract\n\n1. **Discover**: `uv run ${CLAUDE_SKILL_DIR}/scripts/introspect.py` (cheap), or `verify_php_project.py --summary` (full, with `agent_actions[]`).\n2. **Drill**: `... --check PM-XX` per finding. Full output when triaging >3.\n3. **Apply**: `uv run ${CLAUDE_SKILL_DIR}/scripts/modernize_loop.py --mode dry-run`. Review transcript before applying.\n4. **References**: load on demand; do not pre-load.\n\n## Reference routing\n\n| Need | Read |\n|---|---|\n| PHP 8.0-8.3 baseline | `references/php8-features.md` |\n| PHP 8.4 | `references/php-8.4.md` |\n| PHP 8.5 | `references/php-8.5.md` |\n| PSR / PER-CS | `references/psr-per-compliance.md` |\n| PHPStan config | `references/phpstan-compliance.md` |\n| Static analysis | `references/static-analysis-tools.md` |\n| PHP-CS-Fixer deprecations | `references/php-cs-fixer-deprecations.md` |\n| DTOs / VOs / inputs | `references/type-safety.md`, `references/request-dtos.md` |\n| Adapter / registry | `references/adapter-registry-pattern.md` |\n| Multi-version compat | `references/multi-version-adapters.md` |\n| Symfony patterns | `references/symfony-patterns.md` |\n| PSR-15 middleware | `references/psr15-middleware-architecture.md` |\n| Doctrine edges | `references/doctrine-modernization-edges.md` |\n| API Platform | `references/api-platform-edges.md` |\n| Immutability | `references/immutability-boundaries.md` |\n| Mutation testing | `references/mutation-testing.md` |\n| Migration planning | `references/migration-strategies.md` |\n| PHPUnit 12→13, mock vs stub | `references/phpunit-modernization.md` |\n| Multi-agent dispatch hazards | `references/multi-agent-pitfalls.md` |\n\n## Hard guardrails\n\n- Never apply `readonly` to Doctrine entities or mapped-superclasses (embeddables: see `references/doctrine-modernization-edges.md`).\n- Never run Rector without `--dry-run`. Invoke `vendor/bin/rector` directly — composer script aliases can drop `--`-forwarded flags depending on configuration.\n- Never raise PHPStan level without regenerating + committing the baseline. Shrink, never delete.\n- Never apply blanket `final` to mock targets or extension points without confirmation.\n- Never edit `@generated` files or files under `var/cache/`, `vendor/`, `node_modules/`, `.Build/`.\n- Never `git checkout --` files outside your scope in shared trees — use `git stash` / `git diff`.\n- Never trust a warm PHPStan cache after vendor change: `rm -rf /tmp/phpstan-* var/cache/phpstan` first.\n- Never mass-substitute `createMock` → `createStub` — promote to `expects(...)->method(...)->with(...)`.\n\n## Migration checklist\n\n- [ ] `declare(strict_types=1)` everywhere\n- [ ] `@PER-CS`, no deprecated aliases\n- [ ] PHPStan ≥9 (`treatPhpDocTypesAsCertain: false`); 10 for new\n- [ ] PHPat for layer boundaries\n- [ ] Return + parameter types on all methods\n- [ ] DTOs over arrays; backed enums over constants\n- [ ] PSR interfaces in type-hints\n- [ ] `#[Override]` (8.3+), `#[SensitiveParameter]` (8.2+), typed constants (8.3+)\n- [ ] readonly on DTOs/VOs/events only\n- [ ] Property hooks (8.4); `array_find/any/all` (8.4); pipe `|>` (8.5)\n- [ ] PHPUnit 12+: stubs use `createStub`, mocks `createMock` + `expects` (no `self::any()` in 13)\n- [ ] Rector `withComposerBased(symfony: true)` (per-version `SymfonySetList::SYMFONY_*` are `@deprecated`)","tags":["php","modernization","skill","netresearch","agent-skills","ai-agent","open-standard"],"capabilities":["skill","source-netresearch","skill-php-modernization","topic-agent-skills","topic-ai-agent","topic-open-standard"],"categories":["php-modernization-skill"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/netresearch/php-modernization-skill/php-modernization","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add netresearch/php-modernization-skill","source_repo":"https://github.com/netresearch/php-modernization-skill","install_from":"skills.sh"}},"qualityScore":"0.460","qualityRationale":"deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 21 github stars · SKILL.md body (3,358 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:05:37.691Z","embedding":null,"createdAt":"2026-04-19T00:40:37.952Z","updatedAt":"2026-05-18T19:05:37.691Z","lastSeenAt":"2026-05-18T19:05:37.691Z","tsv":"'-15':155 '-8.3':112 '-8.5':11,43 '/scripts/introspect.py':58 '/scripts/modernize_loop.py':87 '/tmp/phpstan-':282 '1':51,301 '10':313 '12':173,359 '13':174,370 '2':67 '3':79,80 '4':96 '8.0':111 '8.1':10,42 '8.2':342 '8.3':340,345 '8.4':116,352,355 '8.5':119,357 '9':310 'action':66 'adapt':143 'agent':49,65,181 'alias':212,308 'analysi':130 'api':161 'appli':81,95,188,233 'array':328,353 'back':329 'baselin':113,228 'blanket':234 'boundari':319 'build':255 'cach':276 'chang':279 'cheap':59 'check':69 'checklist':297 'checkout':258 'claud':55,84 'code':8 'commit':226 'compat':149 'complianc':14 'compos':210 'config':127 'configur':219 'confirm':243 'constant':332,344 'contract':50 'createmock':289,364 'createstub':290,362 'cs':30,124,134,305 'declar':298 'delet':231 'demand':100 'depend':217 'deprec':136,307,381 'diff':270 'dir':57,86 'direct':209 'discov':52 'dispatch':182 'doctrin':158,191 'dri':90,205 'drill':68 'drop':214 'dry-run':89,204 'dto':33 'dtos':138,326 'dtos/enums/readonly/property':17 'dtos/vos/events':348 'edg':159 'edit':245 'embedd':197 'entiti':192 'enum':32,330 'everywher':302 'expect':293,365 'extens':240 'fals':312 'featur':12 'file':247,249,259 'final':235 'find':74 'find/any/all':354 'first':284 'fixer':31,135 'flag':216 'forward':215 'full':63,75 'generat':246 'git':257,267,269 'guardrail':186 'hard':185 'hazard':183 'hint':338 'hook':18,351 'immut':164 'input':140 'interfac':334 'invok':207 'layer':318 'level':223 'load':98,105 'map':195 'mapped-superclass':194 'mass':287 'mass-substitut':286 'max':46 'method':294,325 'middlewar':156 'migrat':169,296 'mock':175,237,363 'mode':88 'modern':3,6,23,38,39 'modul':254 'multi':147,180 'multi-ag':179 'multi-vers':146 'mutat':166 'need':108 'never':187,200,220,230,232,244,256,271,285 'new':315 'node':253 'output':76 'outsid':260 'overrid':339 'paramet':321 'pattern':152 'per':73,123,304,376 'per-c':122,303 'per-vers':375 'php':2,7,9,22,29,37,40,110,115,118,133 'php-cs-fixer':28,132 'php-modern':1 'phpat':316 'phpstan':26,45,126,222,275,309 'phpstan/rector/php-cs-fixer/phpat':15 'phpunit':172,358 'pipe':356 'plan':170 'platform':162 'pm':71 'pm-xx':70 'point':241 'pre':104 'pre-load':103 'promot':291 'properti':350 'psr':121,154,333 'psr/per-cs':44 'psr/php-fig/per-cs':13 'rais':221 'read':109 'readon':34,189,346 'rector':27,202,371 'refer':97,106 'references/adapter-registry-pattern.md':145 'references/api-platform-edges.md':163 'references/doctrine-modernization-edges.md':160,199 'references/immutability-boundaries.md':165 'references/migration-strategies.md':171 'references/multi-agent-pitfalls.md':184 'references/multi-version-adapters.md':150 'references/mutation-testing.md':168 'references/php-8.4.md':117 'references/php-8.5.md':120 'references/php-cs-fixer-deprecations.md':137 'references/php8-features.md':114 'references/phpstan-compliance.md':128 'references/phpunit-modernization.md':178 'references/psr-per-compliance.md':125 'references/psr15-middleware-architecture.md':157 'references/request-dtos.md':142 'references/static-analysis-tools.md':131 'references/symfony-patterns.md':153 'references/type-safety.md':141 'regener':225 'registri':144 'return':320 'review':92 'rf':281 'rm':280 'rout':107 'run':54,83,91,201,206 'safeti':20,25,48 'scope':262 'script':211 'see':198 'self':367 'sensitiveparamet':341 'share':264 'shrink':229 'skill':56,85 'skill-php-modernization' 'source-netresearch' 'stash':268 'static':129 'strict':35,299 'stub':177,360 'substitut':288 'summari':62 'superclass':196 'symfoni':151,373,379 'symfonysetlist':378 'target':238 'test':167 'tool':16 'topic-agent-skills' 'topic-ai-agent' 'topic-open-standard' 'transcript':93 'treatphpdoctypesascertain':311 'tree':265 'triag':78 'trigger':21 'true':374 'trust':272 'typ':36 'type':19,24,47,300,322,337,343 'type-hint':336 'use':4,266,361 'uv':53,82 'var/cache':251 'var/cache/phpstan':283 'vendor':252,278 'vendor/bin/rector':208 'verify_php_project.py':61 'version':148,377 'vos':139 'vs':176 'warm':274 'withcomposerbas':372 'without':203,224,242 'xx':72","prices":[{"id":"cec55cb1-ded2-4445-b046-07473550217b","listingId":"cb4c9ebb-cc9e-47a1-adbb-d500a275f4ac","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"netresearch","category":"php-modernization-skill","install_from":"skills.sh"},"createdAt":"2026-04-19T00:40:37.952Z"}],"sources":[{"listingId":"cb4c9ebb-cc9e-47a1-adbb-d500a275f4ac","source":"github","sourceId":"netresearch/php-modernization-skill/php-modernization","sourceUrl":"https://github.com/netresearch/php-modernization-skill/tree/main/skills/php-modernization","isPrimary":false,"firstSeenAt":"2026-04-19T00:40:37.952Z","lastSeenAt":"2026-05-18T19:05:37.691Z"},{"listingId":"cb4c9ebb-cc9e-47a1-adbb-d500a275f4ac","source":"skills_sh","sourceId":"netresearch/php-modernization-skill/php-modernization","sourceUrl":"https://skills.sh/netresearch/php-modernization-skill/php-modernization","isPrimary":true,"firstSeenAt":"2026-05-07T20:43:45.581Z","lastSeenAt":"2026-05-07T22:42:24.118Z"}],"details":{"listingId":"cb4c9ebb-cc9e-47a1-adbb-d500a275f4ac","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"netresearch","slug":"php-modernization","github":{"repo":"netresearch/php-modernization-skill","stars":21,"topics":["agent-skills","ai-agent","open-standard"],"license":"other","html_url":"https://github.com/netresearch/php-modernization-skill","pushed_at":"2026-05-15T11:36:16Z","description":"Agent Skill: PHP 8.x modernization patterns - typing, attributes, PHPStan | Claude Code compatible","skill_md_sha":"51300f795158a5ad32e8ca0deb11d76a64c57fdc","skill_md_path":"skills/php-modernization/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/netresearch/php-modernization-skill/tree/main/skills/php-modernization"},"layout":"multi","source":"github","category":"php-modernization-skill","frontmatter":{"name":"php-modernization","license":"(MIT AND CC-BY-SA-4.0)","description":"Use when modernizing PHP code: PHP 8.1-8.5 features, PSR/PHP-FIG/PER-CS compliance, PHPStan/Rector/PHP-CS-Fixer/PHPat tooling, DTOs/enums/readonly/property hooks, type safety. Triggers: PHP modernization, type safety, PHPStan, Rector, PHP-CS-Fixer, enum, DTO, readonly, strict_types, property hooks, PHP 8.4, PHP 8.5.","compatibility":"Requires php 8.1+, composer."},"skills_sh_url":"https://skills.sh/netresearch/php-modernization-skill/php-modernization"},"updatedAt":"2026-05-18T19:05:37.691Z"}}