Add PHPStan CI check and pre-push hook, PG-4897 [no_release] - #457
Open
snake14 wants to merge 9 commits into
Open
Add PHPStan CI check and pre-push hook, PG-4897 [no_release]#457snake14 wants to merge 9 commits into
snake14 wants to merge 9 commits into
Conversation
The level-5 phpstan.neon already existed but nothing enforced it; includes the minor type and PHPDoc fixes needed for a clean run. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Released Updates/*.php are immutable history, so their two analysis findings are ignored via path-scoped config entries instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
phpVersion pins analysis to 7.2 where the class does not exist, so a scan-only stub makes the full connection union analyzable.
snake14
force-pushed
the
PG-4897-phpstan
branch
from
August 3, 2026 08:42
55e5f86 to
5f5c072
Compare
New files carry no pre-existing debt, so hold them to the strictest level.
Uncommitted local changes were analyzed and could block a push for files the push doesn't contain. Also corrects the hook's log label.
Pushing another local branch, or several refs at once, analysed the checked-out branch instead of what was actually pushed.
A plugin cloned outside a Matomo checkout cannot be checked, which is no reason to block its pushes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Enforces the PHPStan static analysis this plugin already had configured: the level-5
phpstan.neonexisted but no CI check or git hook ran it, so the codebase had drifted to 18 analysis errors. This adds the same setup used by other Matomo plugins (e.g. plugin-Slack, plugin-GoogleAnalyticsImporter): a GitHub Actions check on every pull request, plus an optional pre-push git hook that analyses changed files (enable it withgit config core.hooksPath .git-hooks-matomo).Includes the fixes needed for a clean level-5 run. Nearly all are documentation/type corrections with no behaviour change; the two call-site changes (
version_comparestring argument,Option::setstring value, and passingfalseinstead of a meaninglesstrueasupdateUser()'s unused password confirmation) are behaviour-neutral. Where the analysis error stems from a too-narrow docblock in Matomo core (AuthResult,Auth::setLogin,UserUpdater), a targeted inline@phpstan-ignorewith the reason is used instead of changing behaviour.Issue No
PG-4897
Steps to Replicate the Issue
composer run phpstan -- -c plugins/LoginLdap/phpstan.neon.Checklist