Skip to content

Raise PHPStan to level 5 and clear what it found [ignore_release] - #133

Merged
snake14 merged 1 commit into
6.x-devfrom
carry-phpstan-level-5
Sep 17, 2026
Merged

snake14 merged 1 commit into
6.x-devfrom
carry-phpstan-level-5

Conversation

@snake14

@snake14 snake14 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

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 in VisitorDetails::handleProfileAction() are carried across from #104, which targeted 5.x-dev and predates the shared Plugins CI umbrella. That check can never fire: the min() 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') in configureViewDataTable() as always true — core declares that property on ViewDataTable\Config and every visualisation config extends it. 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 the 6.0.0-b1 tag, 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

  • [✔] Tested locally or on demo2/demo3?
  • [NA] New test case added/updated?
  • [NA] Are all newly added texts included via translation?
  • [NA] Are text sanitized properly? (Eg use of v-text v/s v-html for vue)
  • [✖] Version bumped?
  • [✔] I have understood, reviewed, and tested all AI outputs before use
  • [✔] All AI instructions respect security, IP, and privacy rules
  • [NA] Documentation updated?

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.
@snake14 snake14 mentioned this pull request Sep 17, 2026
@snake14
snake14 requested a review from a team September 17, 2026 02:57
@snake14
snake14 enabled auto-merge (squash) September 17, 2026 02:57
@snake14
snake14 merged commit dae00d9 into 6.x-dev Sep 17, 2026
17 of 18 checks passed
@snake14
snake14 deleted the carry-phpstan-level-5 branch September 17, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants