Problem/Motivation

While running Drupal Check on my codebase to look for Drupal 9 deprecation issues, I discovered that the iframe module has a couple of issues in src/Plugin/migrate/cckfield/IframeField.php.

PHP Warning:  Uncaught PHPStan\Broker\ClassAutoloadingException: Class Drupal\migrate\Entity\MigrationInterface not found and could not be autoloaded. in /vendor/phpstan/phpstan/src/Broker/Broker.php:360
Stack trace:
#0 [internal function]: PHPStan\Broker\Broker->PHPStan\Broker\{closure}('Drupal\\migrate\\...')
#1 /docroot/modules/contrib/iframe/src/Plugin/migrate/cckfield/IframeField.php(13): spl_autoload_call('Drupal\\migrate\\...')
#2 /vendor/composer/ClassLoader.php(444): include('/Users/mike.mad...')
#3 /vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/Users/mike.mad...')
#4 [internal function]: Composer\Autoload\ClassLoader->loadClass('Drupal\\iframe\\P...')
#5 [internal function]: spl_autoload_call('Drupal\\iframe\\P...')
#6 /vendor/phpstan/phpstan/src/Broker/Broker.php(365): class_exists('Drupal\\iframe\\P...')
# in /vendor/phpstan/phpstan/src/Broker/Broker.php on line 360

First, the use statement for Drupal\migrate\Entity\MigrationInterface throws an error (because that class does not exist).
Second, the class itself is throwing a deprecation warning since CckFieldPluginBase is deprecated.

Proposed resolution

  1. Change Drupal\migrate\Entity\MigrationInterface to Drupal\migrate\Plugin\MigrationInterface
  2. Change CckFieldPluginBase to FieldPluginBase per deprecation notice in docroot/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/CckFieldPluginBase.php.
  3. Fix spacing in processCckFieldValues function

Remaining tasks

(reviews needed, tests to be written or run, documentation to be written, etc.)

User interface changes

(New or changed features/functionality in the user interface, modules added or removed, changes to URL paths, changes to user interface text.)
none.

API changes

(API changes/additions that would affect module, install profile, and theme developers, including examples of before/after code if appropriate.)
none.

Data model changes

(Database or configuration data changes that would make stored data on an existing site incompatible with the site's updated codebase, including changes to hook_schema(), configuration schema or keys, or the expected format of stored data, etc.)
none.

Release notes snippet

(Major and critical issues should have a snippet that can be pulled into the release notes when a release is created that includes the fix)

Original report by [username]

(Text of the original report, for legacy issues whose initial post was not the issue summary. Use rarely.)

CommentFileSizeAuthor
#2 iframefield-3122069-2.patch1.31 KBmikemadison

Comments

mikemadison created an issue. See original summary.

mikemadison’s picture

Status: Active » Needs review
StatusFileSize
new1.31 KB

Here is a patch to address the issues above!

mikemadison’s picture

Issue summary: View changes
neffets’s picture

Which check tool do you use?

  • neffets committed d543882 on 8.x-1.x authored by mikemadison
    Issue #3122069 by mikemadison: Undefined Class and Deprecated Issue in...

  • neffets committed 089bdb6 on 8.x-2.x authored by mikemadison
    Issue #3122069 by mikemadison: Undefined Class and Deprecated Issue in...
neffets’s picture

Status: Needs review » Fixed

patch accepted

  • neffets committed f389815 on 8.x-1.x authored by mikemadison
    Issue #3122069 by mikemadison: Undefined Class and Deprecated Issue in...
mikemadison’s picture

Status: Fixed » Closed (fixed)

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