Problem/Motivation

Entity repository has following variable.

  /**
   * The bundles.
   *
   * @var array
   *   The bundles
   */
  protected $bundles;

And taxonomy term repository has

  /**
   * The taxonomy vocabularies to check.
   *
   * @var array
   *   The taxonomy vocabularies to check.
   */
  protected $vocabularies = [];

Proposed resolution

If we typehint those, we can also typehint in subclasses (and this is where phpstan otherwise complains about, hence this patch).

This is a breaking change however.

Command icon Show commands

Start 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

mallezie created an issue. See original summary.

mallezie’s picture

Status: Active » Needs review

JeroenT made their first commit to this issue’s fork.

jeroent’s picture

I guess this also means entity_repository will have a dependency on PHP 8+ ?

mallezie’s picture

Primitive types typehinting is supported since 7.4. So that would be the minimum required. (I'm running on php 7.4)

jeroent’s picture

Status: Needs review » Fixed

Merged to 2.0.x. Thanks!

  • JeroenT committed 3ba1f025 on 2.0.x authored by mallezie
    Issue #3239007 by mallezie, JeroenT: Add typehint to bundles and...

Status: Fixed » Closed (fixed)

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