PHPSTAN: validate against version 3,4 & 5 - #948
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Checks pass, which is great, but if we're getting things updated on PHPStan should we then ensure there's a check to ensure future updates adhere to that as well (maybe that's already part of the "Test / Lint PHP & PHP Compatibility checks." check though? Also, what's the "Aufgabenliste aktualisiert" bit in the PR description? |
|
Thanks @jeffpaul
Yeah thats definately the intention behind the many phpcs PRs over the last releases/months.
Thanks, updated it. No need for the german text, sorry! |
What?
Raise PHPStan baseline in this branch from level 4 to level 5 and fix all resulting level 5 findings so the full repository passes static analysis and lint checks.
Why?
The plugin already passed at level 2, but level 3,4 & 5 surfaced stricter type-safety issues (mostly scalar typing around escaping and auth-code handling). Fixing these now improves type correctness, keeps CI healthier as rules tighten, and reduces future refactor risk.
How?
This PR updates the PHPStan level and applies targeted, behavior-preserving type fixes
Use of AI Tools
AI assistance: Yes
Tool(s): GitHub Copilot
Model(s): GPT-5.3-Codex
Used for: Static analysis triage, proposing and applying type-safety fixes, and drafting PR documentation.
Human review: All generated changes were reviewed and validated through local lint/static-analysis runs.
Testing Instructions
Install dependencies:
npm install
Run full lint suite:
npm run lint
Run PHPStan directly with repo config:
vendor/bin/phpstan analyse -c phpstan.dist.neon --memory-limit=1G
Optional explicit level check:
vendor/bin/phpstan analyse -c phpstan.dist.neon --level=5 --memory-limit=1G
Expected result:
Screenshots or screencast
Not applicable (no UI behavior change).
Changelog Entry