Raise PHPStan to level 5 and clear what it found [ignore_release] - #133
Merged
Merged
Conversation
Carried across from #104, which raised the level and dropped a duplicated is_null() check in VisitorDetails that min() on the line above has already ruled out. That pull request targeted 5.x-dev and predates the shared CI umbrella, so only these two pieces are still wanted. Level 5 then reported an always-true property_exists() on ViewDataTable\Config::$selectable_columns. Its sibling guard on Numeric::$byteSizeUnit goes with it: PHPStan does not flag that one, but the property has been in core since 2022 and is present at 6.0.0-b1, so the comment claiming it may be missing is no longer true of any supported Matomo.
AltamashShaikh
approved these changes
Sep 17, 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
Raises the plugin's base PHPStan level from 1 to 5, per PG-4897's ratchet step, and clears what that surfaced.
The level raise and the duplicated
is_null($this->minBandwidth)check inVisitorDetails::handleProfileAction()are carried across from #104, which targeted5.x-devand predates the shared Plugins CI umbrella. That check can never fire: themin()on the line above returns one of two arguments that are both already non-null.Level 5 then reported
property_exists($view->config, 'selectable_columns')inconfigureViewDataTable()as always true — core declares that property onViewDataTable\Configand every visualisation config extends it. Its sibling guard onNumeric::$byteSizeUnitgoes with it: PHPStan does not flag that one, but the property has been in core since 2022 and is present at the6.0.0-b1tag, so the comment saying it may be missing is not true of any Matomo this plugin supports.No behaviour changes on any supported version — all three removals are unreachable branches.
Issue No
Related to PG-4897. Replaces #104.
Steps to Replicate the Issue
Not applicable — this raises static analysis coverage rather than fixing a defect.
Checklist