Deprecated function in IndeterminateBundleException::getIterator()

Created on 30 October 2025, 5 days ago

Problem/Motivation

I am encountering a deprecation notice related to the

getIterator()

method in the

IndeterminateBundleException

class within the Lightning Media module:

Deprecated function: Return type of Drupal\lightning_media\Exception\IndeterminateBundleException::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 11 of modules/contrib/lightning_media/src/Exception/IndeterminateBundleException.php).

Steps to reproduce

  1. Use the Lightning Media module within a Drupal installation.
  2. Trigger the condition that invokes the
getIterator()

method

Proposed resolution

To resolve this issue, consider either updating the

getIterator()

method to return \Traversable

public function getIterator(): Traversable
{
    // Implementation here
}

Or, if compatibility is necessary for older versions, apply the

#[\\ReturnTypeWillChange] attribute

#[\ReturnTypeWillChange]
public function getIterator()
{
    // Implementation here
}

Additional Information

PHP Version: 8.3
Drupal Version: 10.5.2
Lightning Media Module Version: 4.10.0

🐛 Bug report
Status

Active

Version

4.10

Component

Code

Created by

🇮🇳India Nilesh Chhantbar

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024