Automated Drupal 11 compatibility fixes for jsonapi_extras

Created on 2 June 2024, 24 days ago
Updated 26 June 2024, about 8 hours ago

Problem/Motivation

Hello project maintainers,

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

Changes will periodically be added to this issue that remove deprecated API uses. To stop further changes 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 "ProjectUpdateBotD11" tag from the issue to stop the bot from posting updates.

The changes 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 changes 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 "ProjectUpdateBotD11" tag is left on this issue, new changes 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 changes 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 changes. The bot will still post new changes then if there is a change in the new generated patch compared to the changes that the bot posted last. Those changes are then up to humans to integrate.

  2. Leave open but stop new automated changes.

    If you want to use this issue as a starting point to remove deprecated API uses but then don't want new automated changes, remove the "ProjectUpdateBotD11" tag from the issue and use it like any other issue (the status does not matter then). If you want to receive automated changes again, add back the "ProjectUpdateBotD11" 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 changes will be posted here.

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

    If you are using another issue(s) to work on Drupal 11 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.

Using the merge request

  1. Review the merge request and test it.
  2. Thoroughly test the changes. These changes 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 merge request, create a new branch and merge request and work from there.

Warning: The 'project-update-bot-only' branch will always be overwritten. Do not work in that branch!

Providing feedback

If there are problems with one of the changes 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 → .

📌 Task
Status

Needs work

Version

3.0

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Pipeline finished with Success
    26 days ago
    Total: 468s
    #186837
  • Pipeline finished with Success
    26 days ago
    Total: 338s
    #186855
  • Issue created by @Project Update Bot
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 24 days ago
    20 pass
  • This is an automated patch generated using Upgrade Status and Drupal Rector. Please see the issue summary for more details. A merge request (MR) is also openend and updated.

    It is important that any automated tests available are run and that you manually test the changes.

    Drupal 11 Compatibility

    According to the Upgrade Status module → these changes make this module compatible with Drupal 11! 🎉
    Therefore these changes update the info.yml file for Drupal 11 compatibility.

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

    Debug information

    Bot run #11-188815

    These packages were used to generate the fixes:

    1. drupal/upgrade_status: 4.3.2
    2. mglaman/phpstan-drupal: 1.2.11
    3. palantirnet/drupal-rector: 0.20.2
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 24 days ago
    20 pass
  • Pipeline finished with Success
    24 days ago
    Total: 347s
    #188996
  • Pipeline finished with Skipped
    23 days ago
    #189761
  • 🇯🇵Japan ptmkenny

    Should the next version require 10.1+ or 9+?

    If 10.1+, we should use DI and remove the watchdog function completely, no need for backwards compatibility (since at least 10.1 is needed).

  • Pipeline finished with Success
    17 days ago
    Total: 169s
    #194632
  • Pipeline finished with Success
    16 days ago
    Total: 171s
    #195246
  • 🇳🇱Netherlands bbrala Netherlands

    I think we should do the following:

    Release 9/10/11 compatible version
    Then start cleaning up for 4.x

    But i'm not entirely sure we can do that with these changes:

    public function normalize($object, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject
    

    In principle i don't mind we move to a ^10.1 || ^11 requirement. But i think that would also mean we need to rework some of the ways we change resources. Since we need less custom code for that. I don't have the scope of that ready mentally unfortunately.

  • 🇯🇵Japan ptmkenny

    Ok, let's see how the tests run when we add Drupal 9 to the GitLab CI mix.

    I added the UpdateBot changes to the 3451984-automated-drupal-11 branch and then enabled Drupal 9 and Drupal 11 testing on GitLab CI.

  • Merge request !52Resolve #3451984 "Automated drupal 11" → (Open) created by ptmkenny
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 16 days ago
    20 pass
  • Pipeline finished with Failed
    16 days ago
    Total: 209s
    #195569
  • 🇳🇱Netherlands bbrala Netherlands

    Hmm, think a trailing comma in a function broke 9.x

  • First commit to issue fork.
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 15 days ago
    20 pass
  • Pipeline finished with Success
    15 days ago
    Total: 252s
    #196018
  • 🇮🇳India ankitv18

    @bbrala as we are supporting D10.1 and D11 then I dropped deprecation helper method as updated the code with Error::logException, also updated the gitlab template to run on previous_minor and next_minor.
    for below code in response of #5
    public function normalize($object, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject
    I believe drupal core jsonapi normalize method and other methods have these return types

    Please review the MR!52.

  • 🇮🇳India ankitv18

    @bbrala PHPunit next major pipeline: https://git.drupalcode.org/issue/jsonapi_extras-3451984/-/jobs/1830197
    Do we need to fix this in this issue or open a separate issue?

  • Pipeline finished with Success
    14 days ago
    #196867
  • Pipeline finished with Success
    14 days ago
    Total: 172s
    #196871
  • Pipeline finished with Success
    14 days ago
    Total: 227s
    #196951
  • Pipeline finished with Failed
    14 days ago
    Total: 427s
    #197455
  • Pipeline finished with Failed
    14 days ago
    Total: 351s
    #197600
  • Status changed to Needs work 12 days ago
  • 🇮🇳India chandu7929 Pune

    @ankitv18 - I can see issue when enabling this module on Drupal 11.

    PHP Fatal error:  Declaration of Drupal\jsonapi_extras\Normalizer\JsonApiNormalizerDecoratorBase::supportsNormalization($data, $format = null): bool must be compatible with Symfony\Component\Serializer\Normalizer\NormalizerInterface::supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool in /Users/chandan.singh/Sites/D11/web/modules/contrib/jsonapi_extras/src/Normalizer/JsonApiNormalizerDecoratorBase.php on line 58
    
    Fatal error: Declaration of Drupal\jsonapi_extras\Normalizer\JsonApiNormalizerDecoratorBase::supportsNormalization($data, $format = null): bool must be compatible with Symfony\Component\Serializer\Normalizer\NormalizerInterface::supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool in /Users/chandan.singh/Sites/D11/web/modules/contrib/jsonapi_extras/src/Normalizer/JsonApiNormalizerDecoratorBase.php on line 58
     [warning] Drush command terminated abnormally.
    
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 days ago
    20 pass
  • Pipeline finished with Success
    12 days ago
    Total: 222s
    #199143
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 days ago
    18 pass, 2 fail
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 days ago
    18 pass, 2 fail
  • Pipeline finished with Canceled
    12 days ago
    Total: 68s
    #199151
  • Pipeline finished with Failed
    12 days ago
    Total: 242s
    #199153
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 days ago
    9 pass, 6 fail
  • Pipeline finished with Failed
    12 days ago
    Total: 229s
    #199166
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 days ago
    9 pass, 6 fail
  • Pipeline finished with Failed
    12 days ago
    Total: 305s
    #199178
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 days ago
    20 pass
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 days ago
    20 pass
  • Pipeline finished with Canceled
    12 days ago
    Total: 8s
    #199191
  • Pipeline finished with Success
    12 days ago
    Total: 219s
    #199192
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 days ago
    20 pass
  • Pipeline finished with Success
    12 days ago
    Total: 217s
    #199197
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 days ago
    20 pass
  • Pipeline finished with Success
    12 days ago
    Total: 260s
    #199208
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 days ago
    20 pass
  • Status changed to Needs review 12 days ago
  • 🇮🇳India ankitv18

    Updated the MR and fixes remaining type hint, validated on local by installing the module.

  • 🇮🇳India ankitv18

    ankitv18 → changed the visibility of the branch project-update-bot-only to hidden.

  • Pipeline finished with Success
    12 days ago
    Total: 225s
    #199216
  • Pipeline finished with Failed
    12 days ago
    Total: 227s
    #199328
  • Pipeline finished with Failed
    12 days ago
    Total: 225s
    #199345
  • Pipeline finished with Failed
    12 days ago
    #199352
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 11 days ago
    20 pass
  • Pipeline finished with Failed
    12 days ago
    Total: 257s
    #199449
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 11 days ago
    20 pass
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 11 days ago
    20 pass
  • Pipeline finished with Failed
    12 days ago
    Total: 182s
    #199452
  • Pipeline finished with Failed
    12 days ago
    Total: 257s
    #199453
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 11 days ago
    20 pass
  • Pipeline finished with Failed
    11 days ago
    Total: 286s
    #199464
  • 🇮🇳India ankitv18

    for phpunit previous major: https://git.drupalcode.org/issue/jsonapi_extras-3451984/-/jobs/1867426#L217 (These are the failing)
    Reason: to avoid phpcs issues like this: Drupal.Functions.MultiLineFunctionDeclaration.MissingTrailingComma
    There are many places where comma separator is added at the end of closing statement in the constructor (These changes taken place couple of weeks ago).

    So do we need that change or we can remove comma separator from those places and add phpcs:ignore Drupal.Functions.MultiLineFunctionDeclaration.MissingTrailingComma above last argument in the method.

    cc: @bbrala

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 11 days ago
    20 pass
  • Pipeline finished with Failed
    11 days ago
    Total: 216s
    #199480
  • 🇮🇳India ankitv18

    Now pipeline is failing on https://git.drupalcode.org/issue/jsonapi_extras-3451984/-/jobs/1867677#L102
    So I believe we can't run the tests below D10 cause of return type hint of public function normalize($object, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject {
    Dropping the D9 from info.yml, phpcs:ignore for comma trailing and previous major from gitlab

    cc: @bbrala @ptmkenny

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 11 days ago
    20 pass
  • Pipeline finished with Success
    11 days ago
    Total: 231s
    #199485
  • Pipeline finished with Success
    11 days ago
    Total: 213s
    #199536
  • Pipeline finished with Failed
    9 days ago
    Total: 263s
    #200935
  • Pipeline finished with Failed
    9 days ago
    Total: 190s
    #200972
  • Pipeline finished with Failed
    9 days ago
    #200974
  • Pipeline finished with Canceled
    9 days ago
    Total: 107s
    #200976
  • Pipeline finished with Failed
    9 days ago
    #200978
  • Pipeline finished with Failed
    9 days ago
    Total: 162s
    #200983
  • Pipeline finished with Failed
    9 days ago
    Total: 180s
    #200989
  • Pipeline finished with Success
    9 days ago
    Total: 199s
    #200997
  • Pipeline finished with Failed
    9 days ago
    Total: 300s
    #201096
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 9 days ago
    20 pass
  • This is an automated patch generated using Upgrade Status and Drupal Rector. Please see the issue summary for more details. A merge request (MR) is also openend and updated.

    It is important that any automated tests available are run and that you manually test the changes.

    Drupal 11 Compatibility

    According to the Upgrade Status module → these changes make this module compatible with Drupal 11! 🎉
    Therefore these changes update the info.yml file for Drupal 11 compatibility.

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

    Debug information

    Bot run #11-199781

    These packages were used to generate the fixes:

    1. drupal/upgrade_status: 4.3.2
    2. mglaman/phpstan-drupal: 1.2.11
    3. palantirnet/drupal-rector: 0.20.3
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 9 days ago
    20 pass
  • Pipeline finished with Success
    9 days ago
    Total: 198s
    #201489
  • Status changed to RTBC 8 days ago
  • 🇮🇳India chandu7929 Pune

    Reviewed MR #52 and changes looks good to me, hence RTBC.

  • Pipeline finished with Failed
    8 days ago
    Total: 415s
    #202113
  • Pipeline finished with Failed
    8 days ago
    Total: 262s
    #202403
  • Pipeline finished with Failed
    8 days ago
    Total: 292s
    #202404
  • Pipeline finished with Failed
    6 days ago
    Total: 337s
    #203865
  • Pipeline finished with Failed
    6 days ago
    Total: 301s
    #203877
  • Pipeline finished with Manual
    6 days ago
    #203916
  • Pipeline finished with Manual
    6 days ago
    #204120
  • Pipeline finished with Manual
    6 days ago
    #204128
  • Pipeline finished with Success
    5 days ago
    Total: 306s
    #204640
  • Pipeline finished with Failed
    5 days ago
    Total: 268s
    #204654
  • Pipeline finished with Success
    5 days ago
    Total: 200s
    #204965
  • Pipeline finished with Success
    5 days ago
    Total: 170s
    #205021
  • Pipeline finished with Success
    5 days ago
    Total: 199s
    #205069
  • Pipeline finished with Success
    5 days ago
    Total: 168s
    #205074
  • Pipeline finished with Failed
    4 days ago
    Total: 315s
    #205663
  • Pipeline finished with Success
    3 days ago
    Total: 137s
    #205927
  • Pipeline finished with Failed
    3 days ago
    Total: 279s
    #206067
  • Pipeline finished with Failed
    3 days ago
    #206093
  • Pipeline finished with Failed
    3 days ago
    Total: 271s
    #206096
  • Pipeline finished with Success
    3 days ago
    Total: 302s
    #206100
  • Pipeline finished with Failed
    3 days ago
    Total: 275s
    #206157
  • Pipeline finished with Success
    3 days ago
    Total: 439s
    #206162
  • Pipeline finished with Success
    2 days ago
    #206475
  • 🇺🇸United States japerry KVUO

    It'd be good if this still supported Drupal 9.5, as there are quite a few sites still on it -- supporting the last major allows people to more easily upgrade to D11 in the future.

    public function normalize($object, $format = NULL, array $context = []): array|bool|string|int|float|null|\ArrayObject

    While this is a hard break from Symfony, Drupal 9.5 is no worse off than 10. The bigger issue here is compatibility with downstream modules. I'm currently working on Schemata, and if I commit a release of that module before this one, JSONAPI extras will WSOD if its not updated first.

    So I'd recommend support Drupal 9.5 and getting a release out for this asap.

  • Status changed to Needs review about 15 hours ago
  • 🇺🇸United States japerry KVUO
  • Status changed to Needs work about 15 hours ago
  • 🇺🇸United States japerry KVUO

    Actually D11 tests are failing, So marking NW

  • 🇳🇱Netherlands bbrala Netherlands

    Keeping Drupal 9 support is kinda annoying, not sure how you see that with the return type changes. Those changes were introduced in 10. I could conditionally load imposters, but that feels kinda crap.

    Not sure how you see this.

  • 🇮🇳India ankitv18

    @bbrala https://git.drupalcode.org/issue/jsonapi_extras-3451984/-/jobs/1867802#L71 should I fix this in this MR or log a separate issue for that?

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update about 7 hours ago
    20 pass
Production build 0.69.0 2024