Fix PHPStan missingType.generics for FieldItemListInterface not specifying its type

Created on 29 December 2024, 23 days ago

Problem/Motivation

Fix

i$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Core\\\\Entity\\\\ContentEntityBase\\:\\:getTranslatedField\\(\\) return type with generic interface Drupal\\\\Core\\\\Field\\\\FieldItemListInterface does not specify its types\\: T$#',
	'identifier' => 'missingType.generics',
	'count' => 1,
	'path' => __DIR__ . '/lib/Drupal/Core/Entity/ContentEntityBase.php',
];

and similar.

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
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
  • 🇮🇹Italy mondrake 🇮🇹
  • Merge request !10730Closes #3496417 → (Open) created by mondrake
  • Pipeline finished with Failed
    23 days ago
    Total: 114s
    #381042
  • Pipeline finished with Failed
    23 days ago
    Total: 122s
    #381066
  • Pipeline finished with Failed
    23 days ago
    Total: 115s
    #381067
  • 🇮🇹Italy mondrake 🇮🇹

    phpstan-drupal has a stub that defines FieldItemListInterface as a generic, so we need to pass the type in the PHPDocs here.

    See https://github.com/mglaman/phpstan-drupal/blob/main/stubs/Drupal/Core/Fi...

  • 🇮🇹Italy mondrake 🇮🇹
  • 🇮🇹Italy mondrake 🇮🇹

    TBH I think it’s nonsense to have core lacking appropriate PHPDoc, for drupal-phpstan to write a stub gapfill, and then that gapfill to force back core implementations’ PHPDocs to be adjusted…

    I would suggest to move the definitions in the stub from drupal-php to core as part of this issue.

  • Pipeline finished with Success
    22 days ago
    Total: 10281s
    #381241
  • 🇺🇸United States mglaman WI, USA

    phpstan-drupal uses a stub provider, so we can fix here and back port anything to phpstan-drupal and use a version check on Drupal to decide if the phpstan-drupal stub should be loaded or not

  • Pipeline finished with Failed
    22 days ago
    Total: 463s
    #381314
  • Pipeline finished with Failed
    22 days ago
    Total: 424s
    #381323
  • 🇮🇹Italy mondrake 🇮🇹

    Done #7 for the Drupal core part (I think).

  • Pipeline finished with Success
    22 days ago
    Total: 628s
    #381340
  • Pipeline finished with Success
    22 days ago
    Total: 819s
    #381799
  • Pipeline finished with Failed
    22 days ago
    Total: 498s
    #381820
  • 🇺🇸United States smustgrave

    Left a comment on the MR but leaving in review for someone more familiar

  • 🇺🇸United States smustgrave

    Thanks for the response @mglaman. Moving to NW for rebase.

    If you are another contributor eager to jump in, please allow the original poster @mglaman or @mondrake at least 48 hours to respond to feedback first, so they have the opportunity to finish what they started!

  • 🇮🇹Italy mondrake 🇮🇹

    Rebased, only merge conflicts resolved.

  • Pipeline finished with Success
    13 days ago
    Total: 893s
    #388905
  • 🇺🇸United States smustgrave

    Rebase seems good.

Production build 0.71.5 2024