Problem/Motivation
Regular Rector run on every test class in core, including modules.
Proposed resolution
Use rector with type coverage on all tests classes in core.
Install rector
$ composer require --dev rector/rector palantirnet/drupal-rector
Configure rector.php file
declare(strict_types=1);
return Rector\Config\RectorConfig::configure()
->withBootstrapFiles([
'vendor/palantirnet/drupal-rector/config/drupal-phpunit-bootstrap-file.php',
])
->withPaths([
'core/tests',
'core/modules/**/tests/src',
])
->withSkip([
'*/*ixture*/*',
'*/Annotation/Doctrine/*',
'core/tests/Drupal/Tests/TestTools/ErrorHandler/DrupalDebugClassLoaderTest.php'
])
->withPreparedSets(typeDeclarations: true)
->withImportNames(
importDocBlockNames: false,
importShortClasses: false,
removeUnusedImports: false,
);
Run rector
$ ./vendor/bin/rector
Fix code style
$ composer phpcbf
Update baseline
$ ./vendor/bin/phpstan analyse -c core/phpstan.neon.dist --generate-baseline=core/.phpstan-baseline.php --memory-limit=2G
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Comments
Comment #2
mondrakeComment #4
mondrakeComment #5
smustgrave commentedNothing stood out that seemed to be an issue. LGTM.