Php modernization
Skill netresearch/php-modernization-skill/skills/php-modernization
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.From its SKILL.md
npx -y skills add netresearch/php-modernization-skill --skill php-modernizationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its file declares
Copied from the file, not written here
The file declares its own license as (MIT AND CC-BY-SA-4.0). That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
4.0 KB, 931 tokens by cl100k_base, as published. Nobody here has run it
PHP Modernization
Agent contract
- Discover:
uv run ${CLAUDE_SKILL_DIR}/scripts/introspect.py(cheap), orverify_php_project.py --summary(full, withagent_actions[]). - Drill:
... --check PM-XXper finding. Full output when triaging >3. - Apply:
uv run ${CLAUDE_SKILL_DIR}/scripts/modernize_loop.py --mode dry-run. Review transcript before applying. - References: load on demand; do not pre-load.
Reference routing
| Need | Read |
|---|---|
| PHP 8.0-8.3 baseline | references/php8-features.md |
| PHP 8.4 | references/php-8.4.md |
| PHP 8.5 | references/php-8.5.md |
| PSR / PER-CS | references/psr-per-compliance.md |
| PHPStan config | references/phpstan-compliance.md |
| Static analysis | references/static-analysis-tools.md |
| PHP-CS-Fixer deprecations | references/php-cs-fixer-deprecations.md |
| DTOs / VOs / inputs | references/type-safety.md, references/request-dtos.md |
| Adapter / registry | references/adapter-registry-pattern.md |
| Multi-version compat | references/multi-version-adapters.md |
| Symfony patterns | references/symfony-patterns.md |
| PSR-15 middleware | references/psr15-middleware-architecture.md |
| Doctrine edges | references/doctrine-modernization-edges.md |
| API Platform | references/api-platform-edges.md |
| Immutability | references/immutability-boundaries.md |
| Contracts & invariants | references/contracts-and-invariants.md |
| Mutation testing | references/mutation-testing.md |
| Migration planning | references/migration-strategies.md |
| PHPUnit 12→13, mock vs stub | references/phpunit-modernization.md |
| Multi-agent dispatch hazards | references/multi-agent-pitfalls.md |
Hard guardrails
- Never apply
readonlyto Doctrine entities or mapped-superclasses (embeddables: seereferences/doctrine-modernization-edges.md). - Never run Rector without
--dry-run. Invokevendor/bin/rectordirectly — composer script aliases can drop---forwarded flags depending on configuration. - Never raise PHPStan level without regenerating + committing the baseline. Shrink, never delete.
- Never apply blanket
finalto mock targets or extension points without confirmation. - Never edit
@generatedfiles or files undervar/cache/,vendor/,node_modules/,.Build/. - Never
git checkout --files outside your scope in shared trees — usegit stash/git diff. - Never trust a warm PHPStan cache after vendor change:
rm -rf /tmp/phpstan-* var/cache/phpstanfirst. - Never mass-substitute
createMock→createStub— promote toexpects(...)->method(...)->with(...).
Migration checklist
-
declare(strict_types=1)everywhere -
@PER-CS, no deprecated aliases - PHPStan ≥9 (
treatPhpDocTypesAsCertain: false); 10 for new - PHPat for layer boundaries
- Return + parameter types on all methods
- DTOs over arrays; backed enums over constants
- PSR interfaces in type-hints
-
#[Override](8.3+),#[SensitiveParameter](8.2+), typed constants (8.3+) - readonly on DTOs/VOs/events only
- Property hooks (8.4);
array_find/any/all(8.4); pipe|>(8.5) - PHPUnit 12+: stubs use
createStub, mockscreateMock+expects(noself::any()in 13) - Rector
withComposerBased(symfony: true)(per-versionSymfonySetList::SYMFONY_*are@deprecated)
What ships with it: 31 files
374.3 KB alongside SKILL.md, 5 of them executable
references/
- adapter-registry-pattern.md13.9 KB
- api-platform-edges.md11.4 KB
- contracts-and-invariants.md10.6 KB
- core-rules.md1.6 KB
- doctrine-modernization-edges.md9.7 KB
- immutability-boundaries.md9.8 KB
- migration-strategies.md11.9 KB
- multi-agent-pitfalls.md8.9 KB
- multi-version-adapters.md8.8 KB
- mutation-testing.md9.8 KB
- php-8.4.md18.3 KB
- php-8.5.md15.3 KB
- php8-features.md13.8 KB
- php-cs-fixer-deprecations.md3.9 KB
- phpstan-compliance.md16.7 KB
- phpunit-modernization.md7.9 KB
- psr15-middleware-architecture.md13.2 KB
- psr-per-compliance.md12.9 KB
- request-dtos.md13.7 KB
- static-analysis-tools.md20.4 KB
- symfony-patterns.md18.3 KB
- type-safety.md14.6 KB
scripts/
- _common.pyruns3.5 KB
- introspect.pyruns5.8 KB
- modernize_loop.pyruns15.5 KB
- verify_php_project.pyruns51.0 KB
- verify-php-project.shruns1.2 KB
templates/
- composer-scripts.json648 B
- github-actions/php-modernization.yml5.0 KB
- README.md3.1 KB
- checkpoints.yaml22.9 KB