Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
migration system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
11 Jan 2025 at 04:31 UTC
Updated:
3 Mar 2025 at 00:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
benjifisherI added a draft change record so that the deprecation messages can refer to it: https://www.drupal.org/node/3498916
Comment #3
benjifisherThere is a kernel test. We can just move that, right? Or do we need to lave behind a wrapper class and deprecate it?
Comment #5
benjifisherI moved four classes: the source plugin, its deriver, and two test classes. Maybe that is enough for this issue.
I updated the
phpstanbaseline file. Maybe, as part of this issue, I should fix those errors and remove the entries from the baseline, instead of updating those entries. I might also add return-type declarations and use constructor promotion ... or maybe that is scope creep.Let's see what the testbot thinks.
Comment #6
nicxvan commentedI reviewed this pretty closely, since we use the old classes as a wrapper we can't add return types since it's extending right?
Is there a way to do this so we can add those?
Also the CR is not public or attached to this issue so I could not review that, why is it restricted?
Comment #7
benjifisherThe CR was unpublished because I got confused by the base field and the regular boolean field, both of which (if you have access to them) are labeled "Published". I think you should be able to see it, now.
I suppose we do not have to make the old class a wrapper for the new one. We could just add the deprecation notice (in the class docblock and in the constructor) and remove the plugin annotations. Then we could add return-type declarations in the new class and it would have no effect on any code that extends the old class.
Comment #8
nicxvan commentedYeah when creating a cr you shouldn't have to change any publish settings, maybe because you are on the security team you have more permissions.
I'll tweak the cr in a bit.
I think the change so we can add return types is worth it because we can remove those lines from phpstan when it's removed otherwise we have to do another compatibility dance when we add them.
Setting to needs work just for that change.
Comment #9
benjifisher@nicxvan:
I did the following:
migrate_drupalmodule (but keep the deprecation notices).migratemodule), fix the errors from the phpstan baseline file.Was I right to restore the test class in the
migrate_drupalmodule? Maybe I should delete it again, along with the corresponding lines in the phpstan baseline file. I did not restore the test that refers to the source plugin by its plugin ID instead of by its class: that no longer tests the deprecated class in themigrate_drupalmodule.Since we are giving up on keeping the new classes as close as possible to the old ones, I made some further modernization:
I had some trouble with phpstan. It is tricky when tests implement methods without declaring return types, for example.
If the tests pass, then I will move this issue back to NR.
Comment #10
benjifisherComment #11
nicxvan commentedThis looks great, for baseline I run the following command to auto generate:
./vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --memory-limit=-1 --generate-baseline=core/.phpstan-baseline.phpTo be honest I'm not sure why you didn't have to add expect deprecation to the test marked with @legacy, I think class deprecations are different so I don't think you need to change anything.
I did compare the deprecation process docs for classes and confirmed you matched the documentation.
The only other thing I'm not sure of is the new unused parameter errors. I think since these are new classes now the preference is to ignore a single line. I'll ask for clarification on this in #core-development. Other than that looks great to me.
Comment #13
benjifisherI resolved the new "unused parameter" error after discussing on Slack with @nicxvan and @mstrlan.
@mondrake, thanks for the comments on the MR. I replied to all three, even though I only made the changes suggested in one of them. I am adding credit to you for the review.
I updated the Proposed resolution in the issue summary: we decided not to make the old classes wrappers for the new ones (because we are adding type declarations that could break BC).
I still wonder whether I should remove
core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityConstructorTest.php, which tests the now-deprecated class. The MR copies that test class tocore/modules/migrate/tests/src/Kernel/Plugin/source/ContentEntityConstructorTest.php.Comment #14
benjifisherFailing tests:
Drupal\Tests\jsonapi\Functional\JsonApiFunctionalTestDrupal\Tests\file\Functional\DownloadTestDrupal\Tests\package_manager\Build\PackageInstallTestDrupal\Tests\package_manager\Build\PackageInstallSubmoduleTestDrupal\Tests\package_manager\Build\PackageUpdateTesttabbingManagerTest.js(I think: certainly one of the Nightwatch tests)I am re-running the tests, and I will add a comment to #2829040: [meta] Known intermittent, random, and environment-specific test failures.
Comment #15
nicxvan commentedI think everything has been addressed. It's been moved instead of wrapping so we can add return types.
Look great!
Comment #16
ghost of drupal pastmy dream always was to stop using hook_update_N for content and write in place migrations exactly using this plugin
a followup, of course but still
Comment #17
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #18
benjifisherThere were merge conflicts in the PHPStan baseline file.
I rebased on the 11.x branch, skipping the commits that affected the baseline file. I also used the opportunity to simplify the git history. Then I manually removed the lines from the baseline for the removed test class and added an ignored error for the new version of that file with
Back to NR to make sure I did not mess it up with my rebase. It looks as though PHPStan has already approved of the changes.
Comment #19
nicxvan commentedRebase looks good
Comment #22
catchMade and applied one suggestion on the MR to add an additional type hint on a property.
Committed/pushed to 11.x, thanks!
Comment #24
nicxvan commented