Skip to content
Snippets Groups Projects

Fix issues identified by PHPStan scan

Merged Patrick Kenny requested to merge issue/feeds_ex-3441604:phpstan into 8.x-1.x
Files
11
@@ -7,10 +7,10 @@ use Drupal\feeds\FeedInterface;
use Drupal\feeds\Result\FetcherResultInterface;
use Drupal\feeds\Result\ParserResultInterface;
use Drupal\feeds\StateInterface;
use Drupal\feeds_ex\JmesRuntimeFactory;
use Drupal\feeds_ex\JmesRuntimeFactoryInterface;
use Drupal\feeds_ex\Utility\JsonUtility;
use JmesPath\SyntaxErrorException;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Defines a JSON parser using JMESPath.
@@ -43,20 +43,40 @@ class JmesPathParser extends JsonParserBase {
protected $runtimeFactory;
/**
* {@inheritdoc}
* Constructs a JmesPathParser object.
*
* @param array $configuration
* The plugin configuration.
* @param string $plugin_id
* The plugin id.
* @param array $plugin_definition
* The plugin definition.
* @param \Drupal\feeds_ex\Utility\JsonUtility $utility
* The JSON helper class.
* @param \Drupal\feeds_ex\JmesRuntimeFactoryInterface $factory
* A factory to generate JMESPath runtime objects.
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, JsonUtility $utility) {
public function __construct(array $configuration, $plugin_id, array $plugin_definition, JsonUtility $utility, JmesRuntimeFactoryInterface $factory) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $utility);
$this->setRuntimeFactory($factory);
}
// Set default factory.
$this->runtimeFactory = new JmesRuntimeFactory();
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('feeds_ex.json_utility'),
$container->get('feeds_ex.jmes_runtime_factory')
);
}
/**
* Sets the factory to use for creating JMESPath Runtime objects.
*
* This is useful in unit tests.
*
* @param \Drupal\feeds_ex\JmesRuntimeFactoryInterface $factory
* The factory to use.
*/
Loading