Problem/Motivation
This is a child issue of #3376057: [META] Add declare(strict_types=1) to all tests. After adding enabling strict types to all tests there were around 3000 errors. Fixing them all in one issue will lead to an enormous merge request that's difficult to review, as per the issue scope guidelines.
Steps to reproduce
Create the rector.php file:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(DeclareStrictTypesRector::class);
};
Process all test traits:
composer require rector/rector --dev
php ./vendor/bin/rector process core/tests/Drupal/Tests/Traits
find core/tests/Drupal/Tests -type f -name "*Trait.php" -maxdepth 1 | xargs php ./vendor/bin/rector process
find core -type d -path "*/tests/src/Traits" | xargs php ./vendor/bin/rector process
Proposed resolution
Fix all strict type issues in test traits
Follow up [@todo create follow up issue]