Skip to content
Skills Library
Programming · Building & coding

php-modernization

/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.

Licence
MIT
Last repository change
27.07.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
32
Scripts
5
HTML comments
0
URLs in SKILL.md
3
Deprecation

No signals detected. Repository changed on 27.07.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 5 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/_common.py, scripts/introspect.py, scripts/modernize_loop.py, scripts/verify-php-project.sh, scripts/verify_php_project.py

What it does and when to use it

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.

Original author 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.

How it works

  1. Agent contract
  2. Reference routing
  3. Hard guardrails
  4. Migration checklist
  5. Credits & Attribution
Original SKILL.md headings · 75 lines, 481 words
SKILL.md preview
---
name: "php-modernization"
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."
---

# PHP Modernization

## Agent contract

1. **Discover**: `uv run ${CLAUDE_SKILL_DIR}/scripts/introspect.py` (cheap), or `verify_php_project.py --summary` (full, with `agent_actions[]`).
2. **Drill**: `... --check PM-XX` per finding. Full output when triaging >3.
3. **Apply**: `uv run ${CLAUDE_SKILL_DIR}/scripts/modernize_loop.py --mode dry-run`. Review transcript before applying.
4. **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 `readonly` to Doctrine entities or mapped-superclasses (embeddables: see `references/doctrine-modernization-edges.md`).
- Never run Rector without `--dry-run`. Invoke `vendor/bin/rector` directly — 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 `final` to mock targets or extension points without confirmation.
- Never edit `@generated` files or files under `var/cache/`, `vendor/`, `node_modules/`, `.Build/`.
- Never `git checkout --` files outside your scope in shared trees — use `git stash` / `git diff`.
- Never trust a warm PHPStan cache after vendor change: `rm -rf /tmp/phpstan-* var/cache/phpstan` first.
- Never mass-substitute `createMock` → `createStub` — promote to `expects(...)->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`, mocks `createMock` + `expects` (no `self::any()` in 13)
- [ ] Rector `withComposerBased(symfony: true)` (per-version `SymfonySetList::SYMFONY_*` are `@deprecated`)

---

## Credits & Attribution

This skill is based on the excellent work by
**[Netresearch DTT GmbH](https://www.netresearch.de/)**.

Original repository: https://github.com/netresearch/php-modernization-skill

**Copyright (c) Netresearch DTT GmbH** — Methodology and best practices (MIT / CC-BY-SA-4.0)

Special thanks to [Netresearch DTT GmbH](https://www.netresearch.de/) for their generous open-source contributions to the TYPO3 community, which helped shape this skill collection.
Adapted by webconsulting.at for this skill collection
Files in this package (32)
  • SKILL.md 4 KB
  • checkpoints.yaml 22 KB
  • references/adapter-registry-pattern.md 14 KB
  • references/api-platform-edges.md 11 KB
  • references/contracts-and-invariants.md 11 KB
  • references/core-rules.md 2 KB
  • references/doctrine-modernization-edges.md 10 KB
  • references/immutability-boundaries.md 10 KB
  • references/migration-strategies.md 8 KB
  • references/multi-agent-pitfalls.md 7 KB
  • references/multi-version-adapters.md 9 KB
  • references/mutation-testing.md 10 KB
  • references/php-8.4.md 18 KB
  • references/php-8.5.md 15 KB
  • references/php-cs-fixer-deprecations.md 4 KB
  • references/php8-features.md 14 KB
  • references/phpstan-compliance.md 17 KB
  • references/phpunit-modernization.md 8 KB
  • references/psr-per-compliance.md 13 KB
  • references/psr15-middleware-architecture.md 13 KB
  • references/request-dtos.md 14 KB
  • references/static-analysis-tools.md 17 KB
  • references/symfony-patterns.md 18 KB
  • references/type-safety.md 15 KB
  • scripts/_common.py 3 KB
  • scripts/introspect.py 6 KB
  • scripts/modernize_loop.py 15 KB
  • scripts/verify-php-project.sh 1 KB
  • scripts/verify_php_project.py 51 KB
  • templates/README.md 3 KB
  • templates/composer-scripts.json 1 KB
  • templates/github-actions/php-modernization.yml 5 KB

Versions

The database has no other skills named php-modernization.

Database snapshot: 13.11.2026 · package version d8ba77e40f72 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100php-quality
    PHP static analysis, code style and modern idioms for PHP 8.3 to 8.5. Use when setting up phpstan.neon or a baseline, choosing PHPStan or Psalm, PHP-CS-Fixer or PHP_CodeSniffer, PER-CS or PSR-12, configuring Rector quality sets, or reviewing PHP for readonly, enums, property…
  • 100php
    Use when writing, reviewing or modernizing PHP (8.3-8.5) outside Laravel — strict types, union and intersection types, readonly classes, backed enums, property hooks and asymmetric visibility, the pipe operator and clone-with, Composer with PSR-4, PER-CS style, PSR interop, and…
  • 100php-quality-tooling
    Use when setting up PHPStan, Rector, or PHP-CS-Fixer on a non-Laravel PHP project, incl. CI wiring. Do NOT use for Laravel (Pint/Larastan), tests, or syntax.
  • 100php
    Use when writing PHP 8.2+ or working in Laravel and Symfony codebases. Covers strict types, enums, readonly classes, attributes, PSR standards, and static analysis with PHPStan. Trigger on "add phpstan to this legacy project", "laravel eloquent is too slow", "upgrade this to php…
  • 100php-best-practices
    PHP modernization, refactoring, code review, and standards enforcement assistant for PHP 8.2+ projects. Use this skill whenever the user wants to modernize legacy PHP code, refactor messy classes or controllers, review code for smells and anti-patterns, enforce PSR-12 and strict…
  • 100php-language-modern
    Use when writing modern non-framework PHP 8.1-8.5 — property hooks, asymmetric visibility, pipe operator, attributes, enums, readonly. Do NOT use for style (php-standards) or Laravel.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.