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

Command icon 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

jurgenhaas created an issue. See original summary.

abhisekmazumdar made their first commit to this issue’s fork.

abhisekmazumdar’s picture

Status: Active » Needs review
jurgenhaas’s picture

Status: Needs review » Reviewed & tested by the community

Looks great.

abhisekmazumdar’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.