Problem/Motivation

PHPStan released version 1.9.3 (See https://github.com/phpstan/phpstan/releases/tag/1.9.3)
Looking at https://www.drupal.org/node/3060/qa it removes some false positives on Level 1.

Steps to reproduce

See https://www.drupal.org/node/3060/qa and notice the failures on both updated deps jobs for 10.0.x and 10.1.x

Proposed resolution

- Upgrade PHPStan to 1.9.3
- Create a new baseline
- Bump version of PHPStan in composer.lock to 1.9.3, since the newly created baseline won't pass on 1.9.2

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#19 3327018-10.1.x-19.patch1.52 KBspokje
#2 3327018-2.patch7.76 KBspokje

Comments

Spokje created an issue. See original summary.

spokje’s picture

StatusFileSize
new7.76 KB
spokje’s picture

Issue summary: View changes
spokje’s picture

Status: Active » Needs review
longwave’s picture

Status: Needs review » Reviewed & tested by the community

Looks great; seems PHPStan has solved some false positives with "Variable might not be defined" (although seemingly added some new ones, given the $randX vars in StyleTest look OK to me).

longwave’s picture

Not sure this can be committed to 10.0.x; while updated PHPStan fails on core it doesn't technically affect anyone. But that means the "updated deps" CI job is a bit pointless on that branch...

spokje’s picture

Not sure this can be committed to 10.0.x;

Hmm, could you enlighten me with the rules on this?
If we can't commit it in 10.0.x this means we can never update a dependency in 10.0.x? Only when there's a SA out for it or something?

Can't remember the rules being that strict on 9.x branches, AFAIK, we updated dependencies (at least for patch-, maybe even for minor-level version updates) just before every new release?

longwave’s picture

This is the first release we have done with PHPStan in core-dev, so this is the first time we've had to consider changing the baseline in a patch release, and this update might also affect anyone else using core-dev?

https://www.drupal.org/about/core/policies/core-change-policies/allowed-...

Any change that risks disruption must be considered carefully and usually postponed to the next minor or major version.

The following types of changes are allowed for patch releases.

  • patch-level library updates (typically limited to security updates or important bugfixes)

This isn't a security update, does it count as an "important bug fix"?

spokje’s picture

Ah, thanks for the link, somehow I remembered we update all dependencies for every patch release, but it is indeed minor releases only.

> This isn't a security update, does it count as an "important bug fix"?

Hard to say, the world won't end when we don't do it in 10.0.x.

However if we _don't_ do it:
- We're going to have diverging PHPStan baselines, which doesn't make fixing our baseline errors easier, since we're going to need 2 patches (for 10.current and 10.current+1).
- As you correctly noticed, there's no use for the "updated deps" job on 10.current, that should always only be on 10.current+1

I'll return to the simpler things in life and leave the decision on that to Bigger Brains.

spokje’s picture

PHPStan released 1.9.4 (https://github.com/phpstan/phpstan/releases/tag/1.9.4), but that didn't change the baseline.
Meaning, we can commit the patch and are not forced to bump to 1.9.4 in composer.lock to make the updated deps test-runs pass.

xjm’s picture

I queued the updated deps job to confirm the issue is solved by the patch.

  • xjm committed 580555e0 on 10.0.x
    Issue #3327018 by Spokje, longwave, xjm: Update PHPStan to 1.9.3 and...
xjm’s picture

Status: Reviewed & tested by the community » Fixed

I accidentally committed this to 10.0.x first, but wasn't about redo an hour-long scan. So it's been cherry-picked forward to 10.1.x.

It also cherry-picked to 9.5.x with some auto-merging. I realize I forgot to queue a 9.5 job earlier. So we'll have to make sure HEAD doesn't fail as a result of me doing that.

Thanks everyone for keeping this updated!

xjm’s picture

Version: 10.1.x-dev » 9.5.x-dev
Issue tags: +10.0.1 release notes, +9.5.1 release notes
longwave’s picture

Status: Fixed » Reviewed & tested by the community

As far as I can see only the 10.0.x branch was pushed to git. We also don't run PHPStan on 9.5.x, not sure it needs backporting to there at all.

  • longwave committed 1e659b4a on 10.1.x
    Issue #3327018 by Spokje, longwave, xjm: Update PHPStan to 1.9.3 and...
longwave’s picture

Version: 9.5.x-dev » 10.0.x-dev
Status: Reviewed & tested by the community » Fixed
Issue tags: -9.5.1 release notes

Committed and pushed to 10.1.x.

Removing tag for 9.5.1 as I don't see how we can commit it there.

mondrake’s picture

Status: Fixed » Needs work

Since this changed the baseline, I think it should also have bumped the version in composer.json to ^1.9.3, otherwise someone running with 1.9.2 might incur in errors.

spokje’s picture

Version: 10.0.x-dev » 10.1.x-dev
StatusFileSize
new1.52 KB

I think I agree with @mondrake on this one, especially seeing that we currently have ^1.8.11 in the composer.json, which is a minor below what we're recommending currently.

Attached a patch that should up the version.

mondrake’s picture

Status: Needs work » Reviewed & tested by the community

Thanks

  • catch committed 4471d286 on 10.1.x
    Issue #3327018 by Spokje, longwave, xjm, mondrake: Update PHPStan to 1.9...
catch’s picture

Version: 10.1.x-dev » 10.0.x-dev
Status: Reviewed & tested by the community » Fixed

Makes sense to bring the constraint into line too. Committed/pushed to 10.1.x and cherry-picked to 10.0.x, thanks!

  • catch committed 61617df5 on 10.0.x
    Issue #3327018 by Spokje, longwave, xjm, mondrake: Update PHPStan to 1.9...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.