Basic kernel test fails with Type of Drupal\KernelTests\Core\Entity\EntityKernelTestBase::$modules must be array Trying to port a Drupal 7 module to 9 with accompanying test and getting this error immediately when running it:
PHP Fatal error:  Type of Drupal\KernelTests\Core\Entity\EntityKernelTestBase::$modules must be array (as in class Drupal\KernelTests\KernelTestBase) in /var/www/html/docroot/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php on line 12

The test:
class MyModuleTest extends EntityKernelTestBase {

  use NodeCreationTrait;

  /**
   * @var \Drupal\mymodule\Query\YearsQuery
   */
  protected $query;

  /**
   * @var array $modules
   */
  protected static $modules = [
    'node',
    'mymodule',
    'mymodule_test',
  ];

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    ...

I checked around some of the core classes - the $modules declaration looks the same. Note that I am using PHPUnit 9.
From KernelTestBase:
 /**
  * Modules to enable.
  *
  * The test runner will merge the $modules lists from this class, the class
  * it extends, and so on up the class hierarchy. It is not necessary to
  * include modules in your list that a parent class has already declared.
  *
  * @see \Drupal\Tests\KernelTestBase::enableModules()
  * @see \Drupal\Tests\KernelTestBase::bootKernel()
  *
  * @var array
  */
 protected static $modules = [];

You'll need to match this declaration in your own code (though you can add to the array).