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
- Change Drupal\migrate\Entity\MigrationInterface to Drupal\migrate\Plugin\MigrationInterface
- Change CckFieldPluginBase to FieldPluginBase per deprecation notice in docroot/core/modules/migrate_drupal/src/Plugin/migrate/cckfield/CckFieldPluginBase.php.
- 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.)
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | iframefield-3122069-2.patch | 1.31 KB | mikemadison |
Comments
Comment #2
mikemadison commentedHere is a patch to address the issues above!
Comment #3
mikemadison commentedComment #4
neffets commentedWhich check tool do you use?
Comment #7
neffets commentedpatch accepted
Comment #9
mikemadison commentedI found these using https://github.com/mglaman/drupal-check