symplify/parameter-name-guard
PHPStan extension that guards parameter names in public APIs, helping prevent backward-compatibility breaks with PHP 8 named arguments. It flags risky renames so library maintainers can keep signatures stable and safe.
Before anything else: this package is archived and marked deprecated by its author. Treat any installation as a short-term stopgap, not a foundation. The deprecation note ("Use PHP configs with constants autocomplete instead") is the intended migration path — read it as the actual recommendation for new code.
If you still need it on an older Symfony/PHPStan stack:
composer require --dev symplify/parameter-name-guard on a project pinned to a PHPStan version the package supports (check composer.json constraints — this is the first thing to verify, not the README).phpstan.neon rather than relying on auto-discovery:
includes:
- vendor/symplify/parameter-name-guard/config/config.neon
(or register the rule class manually under services: — check the package's config/config.neon for the exact rule name in your installed version, since it differs across releases.)vendor/bin/phpstan analyse and confirm the rule actually fires by deliberately introducing a misspelled parameter name in a service definition.%parameter.name% string references fail the build instead of surfacing as a ParameterNotFoundException at container compile or, worse, at runtime.Where to look first inside the repo: the single rule class under src/ and its config/ directory. The package is small — the rule plus its config is the whole product.
phpstan analyse run developers already run locally and in CI, so a typo is caught in the same feedback loop as a type error.phpstan --generate-baseline, commit the baseline, and prevent new violations while paying down the old ones incrementally.bin/console lint:container and debug:container --parameters validate the compiled container; this static rule catches problems earlier and without a boot. Use both, but understand they overlap — the static rule is the fast gate, the console lint is the authoritative one.paths: in phpstan.neon, so it doesn't run against test fixtures or vendored code where parameter strings are intentionally fake.Class not found on a newer PHPStan, or — worst — a rule that loads but no longer resolves the nodes it inspects and therefore detects nothing. Verify the rule fires after any PHPStan upgrade; a green build is not proof it's working.composer.json for as long as you depend on this package. Floating ^1.x/^2.x constraints will eventually resolve to a version the archived rule doesn't support.includes: vs. manual services: registration produce different behaviour when only some rules are registered; check config/config.neon in the installed version rather than copying snippets from the README, which may not match your tag.ignoreErrors with path:/message: scoping for the handful of genuinely dynamic parameter references; a blanket reportUnmatchedIgnoredErrors: false or a wide ignore pattern hides real typos.lint:container, PHPStan's Symfony extension, and the PHP-config-plus-constants approach collectively cover most of what this package did. If any of them are already in your stack, you likely don't need this at all.composer audit won't flag it as insecure — archiving isn't a CVE. Track it manually in your dependency review so it doesn't sit in require-dev for years unnoticed.How can I help you explore Laravel packages today?