Problem/Motivation

Hello project maintainers,

This is an automated issue to help make this module compatible with Drupal 10.

To read more about this effort by the Drupal Association, please read: The project update bot is being refreshed to support Drupal 10 readiness of contributed projects

Patches will periodically be added to this issue that remove Drupal 10 deprecated API uses. To stop further patches from being posted, change the status to anything other than Active, Needs review, Needs work or Reviewed and tested by the community. Alternatively, you can remove the "ProjectUpdateBotD10" tag from the issue to stop the bot from posting updates.

The patches will be posted by the Project Update Bot official user account. This account will not receive any issue credit contributions for itself or any company.

Proposed resolution

You have a few options for how to use this issue:

  1. Accept automated patches until this issue is closed

    If this issue is left open (status of Active, Needs review, Needs work or Reviewed and tested by the community) and the "ProjectUpdateBotD10" tag is left on this issue, new patches will be posted periodically if new deprecation fixes are needed.

    As the Drupal Rector project improves and is able to fix more deprecated API uses, the patches posted here will cover more of the deprecated API uses in the module.

    Patches and/or merge requests posted by others are ignored by the bot, and general human interactions in the issue do not stop the bot from posting updates, so feel free to use this issue to refine bot patches. The bot will still post new patches then if there is a change in the new generated patch compared to the patch that the bot posted last. Those changes are then up to humans to integrate.

  2. Leave open but stop new automated patches.

    If you want to use this issue as a starting point to remove deprecated API uses but then don't want new automated patches, remove the "ProjectUpdateBotD10" tag from the issue and use it like any other issue (the status does not matter then). If you want to receive automated patches again, add back the "ProjectUpdateBotD10" tag.

  3. Close it and don't use it

    If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review, Needs work and Reviewed and tested by the community) and no more automated patches will be posted here.

    If the issue is reopened, then new automated patches will be posted.

    If you are using another issue(s) to work on Drupal 10 compatibility it would be very useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the latest patch in the comments by Project Update Bot or human contributors that made it better.
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
  3. Provide feedback about how the testing went. If you can improve the patch, post an updated patch here.

Providing feedback

If there are problems with one of the patches posted by the Project Update Bot, such as it does not correctly replace a deprecation, you can file an issue in the Drupal Rector issue queue. For other issues with the bot, for instance if the issue summary created by the bot is unclear, use the Project analysis issue queue.

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

Project Update Bot created an issue. See original summary.

project update bot’s picture

Status: Active » Needs review
StatusFileSize
new778 bytes

This is an automated patch generated by Drupal Rector. Please see the issue summary for more details.

It is important that any automated tests available are run with this patch and that you manually test this patch.

Drupal 10 Compatibility

According to the Upgrade Status module this patch makes this module compatible with Drupal 10! 🎉
This patch updates the info.yml file for Drupal 10 compatibility.

Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.

Debug info

Bot run #127

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.9
  2. palantirnet/drupal-rector: 0.12.0
project update bot’s picture

Issue summary: View changes
project update bot’s picture

This is an automated patch generated by Drupal Rector. Please see the issue summary for more details.

It is important that any automated tests available are run with this patch and that you manually test this patch.

Drupal 10 Compatibility

According to the Upgrade Status module this patch makes this module compatible with Drupal 10! 🎉
Therefore this patch updates the info.yml file for Drupal 10 compatibility.

Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.

Debug info

Bot run #8662

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.25
  2. palantirnet/drupal-rector: 0.13.1

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

vladimiraus’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Patch works fine. Hiding files, so can concentrate on MR.
Also added contrib HAL module as dependency.

To test on Drupal 10

1. Add repository to composer.json before main drupal repository.

  "repositories": [
    {
      "type": "vcs",
      "url": "https://git.drupalcode.org/issue/better_normalizers-3286221.git"
    },
...

2. Run

composer require drupal/hal 
composer require drupal/better_normalizers:dev-3286221-8.x-1.x-automated-drupal-10
rajab natshah’s picture

Priority: Normal » Major
andypost’s picture

Is there a reason for the module in terms of D10?

I bet all normalizers already in core so no need in the module, even default content module v1 is not going to be compatible with D10

rajab natshah’s picture

You are right Andrey
#3331814: Remove the Better Normalizers module from Varbase Core 10.0.x branch

No further needs to use

  • A file normalizer that base64 encodes data, taken from file_entity.
  • A menu link content normalizer which embeds dependencies on target entity, by UUID, when applicable.

Varbase Default Content and demo and testing content modules had been switched from base64 data to physical file under the new Default Content YAML format. and dropped the use of JSON in Varbase Default Content modules

My actions are:

  • Remove the Better Normalizers module from Varbase Core 10.0.x branch
  • Not to be enabled when exporting default content ( No longer needed )

Having a working module ( with composer update) in an upgrade step from Drupal 9 to Drupal 10. Is just a stage to ease up the upgrade process with auto updater.

I worked on #3160146: Add a Normalizer and Denormalizer to support Layout Builder
If this is in Drupal 10 core that will be so nice too

rajab natshah’s picture

Hoping for a soft commit, and a soft release ( pre-release ), would speed up testing upgrades to Drupal 10

rajab natshah’s picture

Priority: Major » Critical
andypost’s picture

I think better to update project page with this notes (thank you)
Hal will need new major release 2.x branch

rajab natshah’s picture

rajab natshah’s picture

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

m4olivei’s picture

Status: Reviewed & tested by the community » Needs work

Is there a reason for the module in terms of D10?

I bet all normalizers already in core so no need in the module, even default content module v1 is not going to be compatible with D10

@andypost and/or other maintainers, could we get confirmation that this is the case? I don't understand the comment about default content module, it doesn't seem to depend on better_normalizers 🤔.

I think better to update project page with this notes (thank you). Hal will need new major release 2.x branch

It would be great to get the project page updated to the effect of whatever should be done for folks having this module as a dependency in Drupal 9 that are moving to Drupal 10. See also other issue recently opened related to Drupal 10 compatibility: #3354893: Deprecation warning 'Not marking service definitions as public is deprecated'.

Given all that, it doesn't seem like this is in actual fact RTBC, so updating the status.

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

murilohp’s picture

Status: Needs work » Needs review

Just added HAL as a dependency on composer and I brought the stuff from #3354893: Deprecation warning 'Not marking service definitions as public is deprecated' to the MR.

@andypost and/or other maintainers, could we get confirmation that this is the case? I don't understand the comment about default content module, it doesn't seem to depend on better_normalizers 🤔.

Great! I'm also have the same question and want to know it, I'm upgrading my project to D10 and I don't know if I can get rid off this module or not.

I'll move this back to NR to see what you guys think.

muskan_mahajan’s picture

I have checked MR1 and in drupal-check getting one error which is not ignorable. So, uploading a patch and drupal-check error file for the same.

joachim’s picture

StatusFileSize
new4.72 KB

This is patch #20 rerolled to apply to beta5.

murilohp’s picture

Thanks for sharing the report @muskan_mahajan, I've just updated the MR

abhinavk’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new7.09 KB
new4.07 KB
new6.28 KB

I have tested MR !1 in drupal 10.0.9. It is working fine for me.
Moving to RTBC.

rajab natshah’s picture

Hopping for a commit and a tag release

rajab natshah’s picture

Only for testing:
Having the issue fork in the composer.json file.
In the repositories

  "repositories": {
    "drupal": {
      "type": "composer",
      "url": "https://packages.drupal.org/8",
      "exclude": [
        "drupal/better_normalizers"
      ]
    },
    "drupal/better_normalizers": {
      "type": "git",
      "url": "https://git.drupalcode.org/issue/better_normalizers-3286221.git"
    },
  },

and in require

  "require": {
    "drupal/core": "~10.0",
    "drupal/better_normalizers": "dev-3286221-8.x-1.x-automated-drupal-10 as 1.0-beta5",
  },
andypost’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs issue summary update

Still not clear what to commit MR vs patch, as next beta6 is needed for upgrade I'm fine to commit and create release but then it need to fix tests...

So what is a plan?

murilohp’s picture

Hey @andypost I think you should go with the MR in this case. The MR have the test fixed(both for D9 and D10), and also incorporates the #3354893: Deprecation warning 'Not marking service definitions as public is deprecated'(which can be closed as duplicated since the deprecation notice reported is for D10 and we can address this here), what do you think?

murilohp’s picture

StatusFileSize
new12.05 KB

Posting the static patch because using the MR doesn't allow pinning to a specific commit.

pfrenssen’s picture

Status: Needs review » Reviewed & tested by the community

MR looks good to me.

smulvih2’s picture

+1 RTBC, can we get a new release?

joshf’s picture

StatusFileSize
new7.16 KB

Attached a patch that will apply cleanly to the d.o. packaged version of 8.x-1.0-beta5. This can be used to patch the module via composer. Be aware that if you want to update to D10 via composer you'll need to use one of several available workarounds to deal with the fact that composer cannot patch in a dependency change.

smulvih2’s picture

Works on D10 with the following in composer.json:

"require": {
  "drupaloverride/better_normalizers": "dev-master",
},
"repositories": [
  {
    "type": "package",
    "package": {
      "name": "drupaloverride/better_normalizers",
      "version": "dev-master",
      "type": "drupal-module",
      "dist": {
        "url": "https://git.drupalcode.org/api/v4/projects/project%2Fbetter_normalizers/repository/archive.zip?sha=312e16",
        "type": "zip"
      }
    }
  }
]
aurelianzaha’s picture

+1 to commit this

rajab natshah’s picture

Hoping for a commit and a release.
To have a smooth upgrade process for projects.

larowlan’s picture

+++ b/src/Normalizer/FileEntityNormalizer.php
@@ -38,7 +38,7 @@ class FileEntityNormalizer extends ContentEntityNormalizer {
-  public function normalize($entity, $format = NULL, array $context = array()) {
+  public function normalize($entity, $format = NULL, array $context = array()) : float|array|int|bool|\ArrayObject|string|null  {

I don't think this will be compatible with D9, so we will need a new major version here

larowlan’s picture

Status: Reviewed & tested by the community » Needs work

This doesn't apply to the HEAD of 8.x-1.x can we get a reroll?

Thanks

vladimiraus’s picture

Status: Needs work » Reviewed & tested by the community

MR is mergable.
If you are talking about the latest patch, it is for latest stable release, not for the dev.

joshf’s picture

Attached a new patch that will apply to HEAD.

Again to clarify:

#31 applies cleanly to the distributed version of 8.x-1.0-beta5, and is suitable for use in composer patches.

#38 applies to HEAD, and should be suitable to merge.

Thanks!

larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Cutting a 2.0.0-beta1

Please note that there will not be a version that works on D9 and D10, that's not possible because of the return type hint change for normalizers between Symfony 4 and 6.

larowlan’s picture

I'd also like to echo the sentiment of @andypost above - you should be moving away from this module towards normalizers in core and default content v2

vladimiraus’s picture

Thnaks 🍰

Status: Fixed » Closed (fixed)

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