lychee-org/phpstan-sensitive-parameter-values
A PHPStan rule that flags sensitive values like passwords, tokens, and API keys passed directly as literal arguments to functions and methods, helping you catch hardcoded secrets before they reach your codebase.
Security hardening roadmap — "secrets never reach logs." The package makes PHP 8.2+/8.4's #[\SensitiveParameter] redaction mechanism legible to PHPStan. That converts a policy ("don't log credentials") into a CI-enforceable check instead of a code-review convention. This is the core product decision it supports: do we enforce redaction mechanically or socially?
Whether an automated gate will actually be trusted. Release 1.2.0 is explicitly a false-positive reduction. That matters more than it sounds: analyser adoption dies by alert fatigue. A rule that cries wolf on correct code gets @phpstan-ignore comments and baseline entries, and the gate becomes theatre. This release is the package moving from "technically detects the thing" to "detectable findings are worth acting on" — which is the difference between a gate engineers respect and one they route around. The product decision: is this precise enough to be blocking, or only advisory?
Static analysis investment / ruleset scope. Adopting it is a decision about how far to push PHPStan beyond stock levels. It answers "is our analyser smart enough to reason about wrapped/redacted values, or will it silently type secrets as plain string and let them flow into loggers, exception messages, and telemetry?"
Build vs. buy for internal tooling. A PHPStan extension of this kind is roughly a rule plus one or two dynamic-return-type/type-specifying extensions — on the order of a day of senior engineer time to write and then forever to own. This is MIT-licensed and free. The decision is not cost, it's ownership: adopting means either trusting a low-star, single-vendor artifact or vendoring/forking a few hundred lines.
PHP 8.4 upgrade gating. SensitiveParameterValue is 8.4-only. If the upgrade is on the roadmap, this package is part of the "is our tooling ready?" checklist — and part of the argument for deferring if the tooling story is thin.
Dependency risk posture. Low stars, low dependents, single org (LycheeOrg, a photo-management project) — this reads as an internal utility extracted for convenience, not a supported product. 1.2.0 is a positive signal (maintainer merged an external-looking fix promptly, and 1.0.1 → 1.2.0 shows active iteration), but one maintainer fixing one thing is maintenance, not a community. The correct PM decision is still to classify it as vendored code, not a dependency: pin the version, plan to fork.
Definition of Done changes. Adding it to phpstan.neon changes the release gate for any code path handling auth tokens, API keys, payment data, or PII. That's a process decision, not a technical one — and 1.2.0 makes that gate meaningfully more defensible to the engineers who have to live with it.
Adopt when all of these hold:
SensitiveParameterValue (type preservation through the wrapper, or diagnostics when a sensitive value is passed where a plain one is expected). If you only need the attribute to be syntactically valid, stock PHPStan is likely enough.Look elsewhere — or skip — when:
SensitiveParameter has been landing upstream over time; run a spike on your pinned PHPStan version with the extension removed before committing.What changed with 1.2.0. The main practical objection to adopting this class of rule — first-run noise — is now partially addressed by the vendor rather than by you. Two consequences: the spike gets cheaper (a shorter baseline exercise, less triage of junk), and the first-run findings become more credible as a deliverable. It does not change the ownership calculus, and it does not close the upstream-coverage question. Also verify the version history: the changelog compares 1.0.1...1.2.0 with no 1.1.0 notes, so confirm whether an intermediate release exists before pinning, and read PR #3 to see exactly which false positives were removed — a fix aimed at their codebase's patterns may not cover yours.
The high opportunity score against low adoption remains the interesting signal: the problem is real and under-served, this artifact hasn't captured the market, but it is now visibly being maintained. Value the idea, discount the package a little less than before.
For executives (one paragraph). We can turn a security policy — "credentials must never appear in logs or exception traces" — into an automated check that runs on every pull request. The mechanism is a small, free, MIT-licensed plugin for the static analyser we already run; it never ships to production and adds no runtime cost or licensing cost. The latest release specifically reduces false alarms, which is the difference between a check engineers trust and one they learn to suppress. Effort is measured in hours, not sprints. The risk remains maintenance: the project has essentially one maintainer, so if we adopt it we pin the version and treat it as code we own, not a vendor relationship. Recommendation: approve a short spike to confirm our analyser version doesn't already do this, and adopt behind a pinned version if the spike shows a gap.
For engineering (the substance).
#[\SensitiveParameter] get redacted in stack traces, but static analysis loses the type once the value is wrapped in SensitiveParameterValue. That gap is where a secret silently becomes mixed and flows into a logger unnoticed.phpstan.neon plus a baseline pass. 1.2.0 cuts the false-positive surface, so expect a smaller and higher-quality first-run finding set — those findings are the deliverable.Bottom line for the decision meeting. Low cost, low technical risk, non-trivial maintenance risk, and a genuinely high-value failure mode addressed — now with better signal-to-noise than at first evaluation. The correct framing is not "should we add a dependency" but "should we own a small analyser rule" — and if the answer is yes, using this as the starting point is cheaper than writing it.
How can I help you explore Laravel packages today?