Commit dcc5f94d authored by catch's avatar catch
Browse files

Issue #3317243 by mondrake: Fix PluginManagerBase PHPStan-0 issues

(cherry picked from commit c2a6c765)
parent dd6725cc
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -94,12 +94,40 @@ public function createInstance($plugin_id, array $configuration = []) {
   *
   * @return object
   *   A fallback plugin instance.
   *
   * @throws \BadMethodCallException
   *   When ::getFallbackPluginId() is not implemented in the concrete plugin
   *   manager class.
   */
  protected function handlePluginNotFound($plugin_id, array $configuration) {
    $fallback_id = $this->getFallbackPluginId($plugin_id, $configuration);
    return $this->getFactory()->createInstance($fallback_id, $configuration);
  }

  /**
   * Gets a fallback id for a missing plugin.
   *
   * This method should be implemented in extending classes that also implement
   * FallbackPluginManagerInterface. It is called by
   * PluginManagerBase::handlePluginNotFound on the abstract class, and
   * therefore should be defined as well on the abstract class to prevent static
   * analysis errors.
   *
   * @param string $plugin_id
   *   The ID of the missing requested plugin.
   * @param array $configuration
   *   An array of configuration relevant to the plugin instance.
   *
   * @return string
   *   The id of an existing plugin to use when the plugin does not exist.
   *
   * @throws \BadMethodCallException
   *   If the method is not implemented in the concrete plugin manager class.
   */
  protected function getFallbackPluginId($plugin_id, array $configuration = []) {
    throw new \BadMethodCallException(get_class() . '::getFallbackPluginId() not implemented.');
  }

  /**
   * {@inheritdoc}
   */
+0 −5
Original line number Diff line number Diff line
@@ -70,11 +70,6 @@ parameters:
			count: 1
			path: lib/Drupal/Component/Gettext/PoMemoryWriter.php

		-
			message: "#^Call to an undefined method Drupal\\\\Component\\\\Plugin\\\\PluginManagerBase\\:\\:getFallbackPluginId\\(\\)\\.$#"
			count: 1
			path: lib/Drupal/Component/Plugin/PluginManagerBase.php

		-
			message: "#^Method Drupal\\\\Core\\\\Access\\\\CsrfRequestHeaderAccessCheck\\:\\:applies\\(\\) should return bool but return statement is missing\\.$#"
			count: 1