Needs review
Project:
Drupal core
Version:
main
Component:
other
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
23 Jun 2026 at 01:06 UTC
Updated:
24 Jun 2026 at 03:56 UTC
Jump to comment: Most recent
My core development environment is running on PHP 8.5. When backporting an issue to 11.x or 11.4.x I try to run composer run phpstan-baseline, but it introduces new violations not applicable to PHP 8.3. To avoid this we can specify the php version in phpstan.neon.dist
Run phpstan on php8.5 against 11.4.x and get 50 new errors
phpVersion: 80500 to the parameters section of phpstan.neon.dist for mainphpVersion: 80300 for 11.x and 11.4.xStart within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
mstrelan commentedComment #5
mstrelan commentedInteresting to note that gitlab runs these jobs on PHP 8.5 and correct detects the php version:
Regardless, this still helps my (and likely others) local environments.
Comment #6
kim.pepperAccording to the docs this should work as intended: https://phpstan.org/config-reference#phpversion
RTBC (assuming 11.x random fail goes green).
Comment #7
mstrelan commentedFWIW the root cause in my local environment was because it's using a composer overlay (composer.local.json) so phpstan couldn't read the correct platform value. I've opened a PR at https://github.com/amateescu/ddev-drupal-dev/pull/24 to address that, but if other developers have different setups they could still benefit from this change in core.
Comment #8
longwaveCan we add a unit test to ensure this stays in sync with the version in composer.json and/or the minimum PHP version constant?
Comment #9
mstrelan commentedI added to an existing composer test, not sure if there is a better place.
Comment #10
dcam commentedI'm OK with the assertions staying in the Composer test, but we do have separate test directories in
Core/tests/Drupal/Testsfor CSpell and PHPCS. Maybe PHPStan ought to have one too.