Skip to content

Upgrade phpstan to 2.x and regenerate the baseline - #351

Merged
Martin-1997 merged 2 commits into
masterfrom
build/330-phpstan-2
Nov 22, 2026
Merged

Martin-1997 merged 2 commits into
masterfrom
build/330-phpstan-2

Conversation

@Martin-1997

@Martin-1997 Martin-1997 commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #330

Builds on #350 (Nextcloud 33–35), so the baseline only covers the new stub versions. Please merge #350 first. I'll then retarget this PR to master myself.

Changes

  • phpstan/phpstan: 1.12.34 → 2.3.7 (dev dependency only; not part of the release).
  • phpstan-baseline.neon regenerated: 59 entries instead of 82.
    • Generated once with the Nextcloud 35 stubs (54 entries) and once with the 33 stubs (61), then merged: each entry is kept if either version needs it, with the higher count.
    • After rebasing on master, the two variable.undefined entries for getGoals() were removed (fixed in fix(goals): validate add-goal and mark invalid goals #357). All remaining entries still match on the Nextcloud 33 stubs.
    • Gone: the 21–28 stale entries that matched nothing anymore (cleanup PRs, Nextcloud 31 stubs).
    • Every entry now has phpstan 2's error identifier.
  • phpstan.neon: no changes needed. reportUnmatchedIgnoredErrors: false stays, since some entries only apply to one stub version.

No breaking changes

  • For users: none. phpstan is a development tool and isn't in the release archive.
  • At the same level (3), phpstan 2 reports no new findings with the existing configuration, against both stub versions.

What the baseline contains

Identifier Entries Mostly
method.notFound 38 magic entity setters and Doctrine Table methods in migrations
property.notFound 13 magic $this->request->x access
class.notFound 7 Doctrine DBAL classes not in the OCP stubs
nullCoalesce.variable 1 'test' => $cost ?? 't' in add-cost, a harmless debug leftover

Found along the way: the two variable.undefined entries were a bug in getGoals(): goals with an interval other than Weekly/Monthly (possible through the API) used the previous goal's figures. It was fixed separately in #357 (issue #356) with regression tests, and the entries are no longer in the baseline.

Testing

  • phpstan 2 against the stubs v35.0.3 and dev-stable33: no errors with the new baseline.
  • The static-analysis workflow runs both in this PR's CI.

🤖 Generated with Claude Code

@Martin-1997
Martin-1997 force-pushed the build/330-phpstan-2 branch 2 times, most recently from 05f1d4f to 05deeaa Compare November 21, 2026 18:49
@Martin-1997
Martin-1997 force-pushed the build/329-platform-support branch from aa41809 to a6ab9da Compare November 22, 2026 19:37
Martin-1997 and others added 2 commits November 22, 2026 14:37
phpstan 1.12 is end-of-life. 2.3 reports no new findings at level 3
with the existing configuration, against both the Nextcloud 33 and 35
stubs.

The baseline is regenerated for both stub versions and merged (each
entry kept if either needs it, with the higher count): 61 entries
instead of 82; the 21-28 stale ones are gone, and every entry now has
phpstan 2's error identifier. phpstan.neon needs no changes.

Fixes #330

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Martin-1997
Martin-1997 changed the base branch from build/329-platform-support to master November 22, 2026 19:47
@Martin-1997
Martin-1997 merged commit 86d9be3 into master Nov 22, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade phpstan to 2.x

1 participant