Return type declaration must be compatible with CommerceKernelTestBase->setUp() : void

Created on 6 January 2023, over 1 year ago
Updated 26 January 2023, over 1 year ago

Problem/Motivation

PHPUnit errors out with missing ": void" after method setUp() declaration in multiple classes

Steps to reproduce

running "phpunit --list-tests" produces errors like the following (tested with phpunit 9.5.27):

PHP Fatal error: Declaration of Drupal\Tests\commerce_stock\Kernel\StockServiceManagerTest::setUp() must be compatible with Drupal\Tests\commerce\Kernel\CommerceKernelTestBase::setUp(): void in .../web/modules/contrib/commerce_stock/tests/src/Kernel/StockServiceManagerTest.php on line 23

Proposed resolution

Change setUp() method definitions thus:
public function setUp(): void {

Remaining tasks

none

User interface changes

none

API changes

none

Data model changes

none

📌 Task
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇺🇸United States millenniumtree Holualoa, HI

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India Suresh Prabhu Parkala Bangalore

    This patch applies cleanly without any errors for 8.x-1.x. Changing the status to needs review.
    @gayatri chahar this patch is for the commerce stock module and needs to apply against the same module. Correct me if I am wrong, but I think you have tried to apply this to the core. Which is not correct.

  • Status changed to Closed: duplicate over 1 year ago
  • 🇷🇴Romania silviuchingaru

    All tests were fixed in ✨ Drupal 10 compatibility (Fixed all tests) Fixed .

    I'm sorry that I did not continue this threa but i thought that this should be implemented in the Drupal 10 compatibility thread.

Production build 0.69.0 2024