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.

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
new8.35 KB

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

ptmkenny’s picture

Issue summary: View changes

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).

bbrala’s picture

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.

ptmkenny’s picture

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.

bbrala’s picture

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

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

ankitv18’s picture

@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

Pipelines are passing now ~ Please review the MR!52.

ankitv18’s picture

@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?

chandu7929’s picture

Status: Needs review » Needs work

@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.
ankitv18’s picture

Status: Needs work » Needs review
StatusFileSize
new73.16 KB

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

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

ankitv18’s picture

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

ankitv18’s picture

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

project update bot’s picture

Issue summary: View changes
StatusFileSize
new707 bytes
new9.27 KB

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
chandu7929’s picture

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

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

japerry’s picture

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.

japerry’s picture

Status: Reviewed & tested by the community » Needs review
japerry’s picture

Status: Needs review » Needs work

Actually D11 tests are failing, So marking NW

bbrala’s picture

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.

ankitv18’s picture

@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?

japerry’s picture

Status: Needs work » Needs review

Changing back to needs review, I think we're good to go here.

  • bbrala committed d7ab3765 on 8.x-3.x authored by ptmkenny
    Issue #3451984 by ankitv18, japerry, Project Update Bot, ptmkenny,...
bbrala’s picture

Status: Needs review » Fixed

Thanks so much guys for working on this. I've tested the changes locally on 9, 10 and 11. Also tested on a running public api which works perfectly.

Al seems to work as intended. Lovely. Merging and releasing a RC for this

Status: Fixed » Closed (fixed)

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