Bump PHPStan and family to latest versions

Created on 16 April 2025, 4 months ago

Problem/Motivation

Again,

composer update mglaman/phpstan-drupal phpstan/extension-installer phpstan/phpstan phpstan/phpstan-deprecation-rules phpstan/phpstan-phpunit

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component

base system

Created by

🇮🇹Italy mondrake 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mondrake
  • Merge request !11860Closes #3519602 → (Closed) created by mondrake
  • Pipeline finished with Failed
    4 months ago
    Total: 149s
    #475416
  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Failed
    4 months ago
    Total: 146s
    #475799
  • 🇮🇹Italy mondrake 🇮🇹

    Some code fixes driven by PHPStan findings.

  • Pipeline finished with Success
    4 months ago
    Total: 8423s
    #475816
  • 🇺🇸United States smustgrave

    So this appears to be doing more then upping the version, so think the summary needs to reflect that. Are we not losing deprecation coverage here? Does the CR need to be updated if we remove.

  • 🇮🇹Italy mondrake 🇮🇹

    Updated IS. Do not think we are losing anything:

    • isset.initializedProperty errors relate to code paths that can never be executed.
    • assign.readOnlyProperty error relates to a (rather opinionated) PHPStan rule that expects readonly properties are always only assigned in the constructor (see https://github.com/phpstan/phpstan/issues/6562). In this case with a private method being in the path, I think there's no harm in adjusting the code to ensure that.
  • 🇺🇸United States smustgrave
        if (!isset($this->fileSystem)) {
          @trigger_error(
            'Calling ' . __METHOD__ . '() without the file_system service already injected is deprecated in drupal:11.2.0 and throws an exception in drupal:12.0.0. See https://www.drupal.org/node/3494040',
            E_USER_DEPRECATED
          );
          $this->fileSystem = \Drupal::service(FileSystemInterface::class);
        }
        if (!isset($this->map)) {
          @trigger_error(
            'Calling ' . __METHOD__ . '() without the MimeTypeMapInterface service already injected is deprecated in drupal:11.2.0 and throws an exception in drupal:12.0.0. See https://www.drupal.org/node/3494040',
            E_USER_DEPRECATED
          );
          $this->map = \Drupal::service(MimeTypeMapInterface::class);
        }
    

    mainly referring to this btw.

  • 🇮🇹Italy mondrake 🇮🇹

    #7 sure - that will never execute because $this->fileSystem and $this->map are always set (see __construct). PHPStan rules the world :)

  • 🇺🇸United States smustgrave

    Going to trust you on that haha

    Not sure if the CR needs to be updated to mention? But will see what committers think.

  • Pipeline finished with Success
    4 months ago
    Total: 598s
    #487531
  • 🇬🇧United Kingdom longwave UK

    Don't think this needs a CR, there are no behaviour changes here, just fixing broken code that PHPStan has newly identified.

    Committed 3520cc8 and pushed to 11.x. Thanks!

    Onwards to 📌 Update PHPStan to 2.1.13 Active

    • longwave committed 3520cc8f on 11.x
      Issue #3519602 by mondrake, smustgrave: Bump PHPStan and family to...
  • 🇬🇧United Kingdom longwave UK
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024