Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DefaultSingleLazyPluginCollection::setConfiguration() no longer accepts non-array arguments #933

Open
github-actions bot opened this issue Oct 20, 2024 · 0 comments
Labels

Comments

@github-actions
Copy link

https://www.drupal.org/node/3406191

Introduced in branch/version: 10.3.x / 10.3.0

Passing a non-array to \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection::setConfiguration() will trigger a deprecation error.

Starting with Drupal 11.0.0, the base implementation will get the array type hint. This does not break implementations without it.

The documentation for \Drupal\Component\Plugin\LazyPluginCollection::setConfiguration() has always said:

  /**
   * Sets the configuration for all plugins in this collection.
   *
   * @param array $configuration
   *   An array of up-to-date plugin configuration.
   *
   * @return $this
   */
  abstract public function setConfiguration($configuration);

i.e. $configuration MUST be an array. Back then, in 2013, enforcing this was not feasible. Today, in 2023, we have native typehints that PHP can enforce. Bugs have been observed in the real world due to incorrect handling of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants