Problem/Motivation
The following code is not exactly doing what it appears to do, at least with later and stricter PHP versions:
/** @var \Drupal\mautic_api\Entity\MauticApiConnection $connection */
$connection = $this->entityTypeManager
->getStorage('mautic_api_connection')
->load($connectionId);
if (!$connection) {
$this->logger->error('Mautic connection with ID @id not found', [
'@id' => $connectionId,
]);
return;
}
According to the PHPDoc, $connection is always an object and NULL.
Proposed resolution
The PHPDoc needs to be updated to this:
/** @var \Drupal\mautic_api\Entity\MauticApiConnection|null $connection */
This indicates that $connection can either be an object or NULL.
PHPStan level 6 finds similar issues in all action plugins.
Issue fork mautic_eca-3554073
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
abhisekmazumdarComment #5
jurgenhaasLooks great.
Comment #7
abhisekmazumdar