Problem/Motivation

Running the tests at 9.1 with deprecations un-supressed produces the deprecation warning

Declaring ::setUp without a void return typehint in {...} is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724

The Change Record is https://www.drupal.org/node/3114724

There are 297 warnings, all with the same message, covering a large number of Unit, Kernel and Functional tests. The message says that this is deprecated in 9.0.0 but this warning is not produced at 9.0, neither on drupal.org nor travis testing. It is only shown for core 9.1

As per the Typed Data issue #3165602: Declaring ::setUp without a void return typehint is deprecated in drupal:9.0.0 this will probably be postponed until PHP7.1 is the minimum version we need to support.

Comments

jonathan1055 created an issue. See original summary.

tr’s picture

In #3165602: Declaring ::setUp without a void return typehint is deprecated in drupal:9.0.0 I eventually agreed with you that we can do this now, at least in Typed Data, because this only affects the tests and because we do not run (and do not plant to ever run) PHP 7.0 tests in DrupalCI.

Because there is a BC layer for this change in Drupal 8, I think we should also be able to make this change now in Rules?

@jonathan1055: Can you roll a patch for this so that it can be tested here on DrupalCI? If it passes, I can commit it.

Pooja Ganjage’s picture

StatusFileSize
new46.2 KB

Hi,

I am creating a patch for this issue.

Please review the patch.

Thanks.

Pooja Ganjage’s picture

Status: Active » Needs review
jonathan1055’s picture

Status: Needs review » Needs work

Thanks Pooja, that's great. Good to see it runs OK at 8.8.

However, we need to check the deprecations at core 9.1. To do this, please can you make a new patch with everything from #3 plus the creation of the new file drupalci.yml as in patch #24 from #3089502-24: [meta] Rules deprecated code (you can take that patch #24 and append it to yours). Then test it at core 9.1. There will be other failures, due to other deprecations, but we can see if this particular message is removed with your changes.

Jonathan

Pooja Ganjage’s picture

StatusFileSize
new46.81 KB

Uploading new patch.

Pooja Ganjage’s picture

Status: Needs work » Needs review
tr’s picture

Title: [9.1] Declaring ::setUp without a void return typehint is deprecated (Rules) » [9.1] Declaring ::setUp without a void return typehint is deprecated (Rules)d with votingapi_widgets. Create new node with
Status: Needs review » Needs work

"Patch Failed to Apply"

Pooja Ganjage’s picture

StatusFileSize
new53.96 KB

Uploading new patch.

Pooja Ganjage’s picture

Status: Needs work » Needs review
Pooja Ganjage’s picture

Status: Needs review » Needs work
jonathan1055’s picture

Hi Pooja,
Your patch #9 has modules/contrib/rules/ before every file name. This is wrong, as the patch is applied from within the Rules root folder. You patch in #6 was much closer to being correct. If you look at the test result for that patch, you can see the error

error: drupalci.yml: No such file or directory

The drupalci.yml file does not exist, and this patch should be creating the file. In the 3089502-24.show_deprecations_via_drupalci.patch you can see

--- /dev/null
+++ b/drupalci.yml

whereas your patch has a/drupalci.yml instead of /dev/null. So, I suggest you go back to patch #6 and change it to /dev/null and forget #9. Hope that helps.

msuthars’s picture

Assigned: Unassigned » msuthars
tr’s picture

Title: [9.1] Declaring ::setUp without a void return typehint is deprecated (Rules)d with votingapi_widgets. Create new node with » [9.1] Declaring ::setUp without a void return typehint is deprecated (Rules)

I didn't mean to change the title in #8.

@msuthars: Why did you assign this to yourself?

msuthars’s picture

Assigned: msuthars » Unassigned
Status: Needs work » Needs review
StatusFileSize
new46.89 KB
new1.18 KB

Updated the patch as suggested by @jonathan1055. Please review.

jonathan1055’s picture

Thank you @msuthars, this looks good on first viewing. I have now queued it for testing at core 9.1 because that is where the deprecations are produced. This test will fail as there are other deprecations, but it should show that the ':setUp without a void return' message has been solved.

jonathan1055’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new47.01 KB

This is good. You can see in Patch #15 test https://www.drupal.org/pift-ci-job/1836908 that there are no "void" messages and we get 272 pass, 19 fail. On the existing codebase Patch #24 on the meta issue https://www.drupal.org/pift-ci-job/1832280 there are many "void" messages and the numbers at the top show 71 pass, 82 fail.

It's unfortunate that the drupal.org testbot output does not have a simple summary consolidating the deprecation messages, but I can show via Travis testing that the deprecations have dropped from 863 to 566, i.e. all 297 'void typehint' are solved by this patch.

Patch #17 makes the identical code changes, but has the drupalci.yml file removed, and the necessary changes to .travis.yml added, so this is ready for committing.

jonathan1055’s picture

StatusFileSize
new47.07 KB
new800 bytes

Patch #18 only changes .travis.yml to cater for a new 13x deprecation which was committed to core 9.1 today. I will raise a Rules issue in due course, but good to get the travis tests passing with this.

tr’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

  • TR committed 923bbf6 on 8.x-3.x authored by Pooja Ganjage
    Issue #3172048 by Pooja Ganjage, jonathan1055, msuthars: [9.1] Declaring...
jonathan1055’s picture

Thanks @Pooja Ganjage, @msuthars and @TR

Status: Fixed » Closed (fixed)

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