Run PHPStan at level 5 [ignore_release] - #148
Merged
Merged
Conversation
getDataTable documented @PARAM Date for a value its callers pass as the request date string, and @PARAM int for an idSubtable one call site passes as null; the Date import went with it. An inline @var DataTable sat above a StaticContainer call rather than the variable it describes. aggregateCustomVariable declared string $slot although its only caller passes the loop counter, and PHP was coercing it. processRequestParams and afterRequestProcessed now return the bool core documents and reads as $abort - previously null, which is equally falsy. A guard on a concatenation that always contains a space could never be false.
Three ignores are recorded with their reasons: queueFilter and queueFilterSubtables wrap a non-array parameter themselves, Row::setColumn and deleteColumn are untyped while archiving addresses columns by integer Metrics::INDEX_* constants, and the Matomo version guard reads as decided because the analysis only sees one Matomo.
…g [ignore_release] queueFilter() and queueFilterSubtables() document @PARAM array, and every other plugin passes one -- PagePerformance, Bandwidth, CrashAnalytics, MediaAnalytics and BotTracking all do. DataTable wraps a non-array itself, so this is identical at runtime, but it matches the contract and the house style, which is better than recording an exception for it.
…ease] A message regex over a whole file absorbs any future finding that happens to match it. Each exception now names the PHPStan identifier, the file it belongs to, and exactly how many occurrences are expected, so a new one fails the build and is reported on its own line rather than being silently suppressed.
AltamashShaikh
approved these changes
Sep 14, 2026
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
This plugin had no
phpstan.neon, so the umbrella skipped the check and it has never been analysed. The configuration matches the one the rest of the fleet uses; level 5 is what the comparably sized plugins already run at, and the plugin is clean at that level.Nineteen findings, which split into four annotation corrections, two dead constructs, three tracker returns, and three ignores.
Corrected annotations.
getDataTable()documented@param Date $date, but every caller passes the request's date string; and@param int $idSubtable, while one call site passesnull. Correcting those orphaned thePiwik\Dateimport, which PHPCS then flagged, so it goes too. An inline@var DataTable $customVarUsagessat above aStaticContainer::get()call rather than the variable it describes, three lines later. AndaggregateCustomVariable()declaredstring $slotalthough its only caller passes the loop counter — PHP was coercing the int on every call.Dead constructs. A guard on
$message, built as a concatenation that always contains a space, could never be false.Tracker returns.
processRequestParams()andafterRequestProcessed()now return the bool core documents. Core reads both as$abort = …; if ($abort), so the previous implicitnulland an explicitfalseare equivalent — this states the contract rather than changing it, and no test asserts on either return value.Three ignores, each with its reason inline.
queueFilter()andqueueFilterSubtables()document@param arraybut both wrap a non-array parameter themselves, so passing a bare column name is supported usage — verified by running it.Row::setColumn()anddeleteColumn()are untyped and only document@param string, while archiving addresses columns by the integerMetrics::INDEX_*constants throughout. And theversion_compare()guard reads as decided because the analysis only ever sees one Matomo, while the plugin supports 5 and 6.No version bump or changelog entry: the substance is static-analysis setup.
Issue No
No GitHub issue.
Steps to Replicate the Issue
skip-phpstanfor this plugin because there is no config to run.Checklist