Problem/Motivation
#3562868: Add types to class properties in core/tests code via Rector - round 3 completed using Rector on core/tests code with withPreparedSets(typeDeclarations: true).
Now we can rerun it every now and then to see if more code can be automatically refactored.
Proposed resolution
Use rector with type coverage on core/tests.
Install rector
$ composer require --dev rector/rector
Configure rector.php file
<?php
declare(strict_types=1);
return Rector\Config\RectorConfig::configure()
->withBootstrapFiles([
__DIR__ . '/vendor/[#/drupal-rector/config/drupal-phpunit-bootstrap-file.php',
])
->withPaths([
__DIR__ . '/core/tests',
])
->withSkip([
'*/*ixture*/*',
'*/Annotation/Doctrine/*',
])
->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 #3
mondrakeComment #4
smustgrave commentedSeems straight forward, nothing to add. Thanks!
Comment #6
amateescu commentedCommitted fb02153 and pushed to main. Thanks!