- Issue created by @megachriz
\Drupal\feeds\Plugin\Type\PluginBase::getConfiguration()
has an optional parameter with which a certain configuration item can be retrieved. However, this does not comply with the interface \Drupal\Component\Plugin\ConfigurableInterface
in which it is stated that the method getConfiguration()
always returns an array. When PluginBase::getConfiguration()
is called with the optional parameter set, an array won't always be returned. There will be even returned nothing if the requested configuration key does not exist.
This also causes the following warning in PHPStan:
Method Drupal\feeds\Plugin\Type\PluginBase::getConfiguration() should return array but return statement is missing.
The warning is ignored (or will be) in phpstan.neon.
Deprecate the optional parameter $key
of \Drupal\feeds\Plugin\Type\PluginBase::getConfiguration()
.
Update all calling code in the Feeds code base by no longer passing a parameter to that method.
$plugin->getConfiguration('foo')
would then be replaced with:
$plugin->getConfiguration()['foo']
Write a change record about this change, but keep supporting the method to be called with a parameter for now.
The deprecation message would be:
Calling PluginBase::getConfiguration() with the $key argument is deprecated in feeds:3.0.0-rc1 and will be removed from feeds:4.0.0. Use $plugin->getConfiguration()['foo'] instead. See https://www.drupal.org/node/xxx → '
Where 'xxx' will be the node ID of the change record.
Code:
if (isset($key)) {
@trigger_error('Calling ' . __METHOD__ . '() with the $key argument is deprecated in feeds:3.0.0-rc1 and will be removed from feeds:4.0.0. Use $plugin->getConfiguration()[\'foo\'] instead. See https://www.drupal.org/node/xxx', E_USER_DEPRECATED);
}
\Drupal\feeds\Plugin\Type\PluginBase::getConfiguration()
is called with a parameter.PluginBase::getConfiguration()
to no longer pass a parameter (but do ensure that the same data is retrieved).None.
The parameter $key
in \Drupal\feeds\Plugin\Type\PluginBase::getConfiguration()
is kept, but will trigger an error when used.
None.
Active
3.0
Code