mglaman / drupal-change-record-triage

Used to triage Drupal change records to ensure phpstan-drupal, drupal-rector, and upgrade_status have appropriate issues.
MIT License
6 stars 0 forks source link

$modules is now a protected property in tests #9

Open mglaman opened 1 year ago

mglaman commented 1 year ago

https://www.drupal.org/node/2909426

Tests based on BrowserTestBase and KernelTestBase have a $modules property that allows to specify the modules that should be enabled before executing the tests. This property had always been intended to be protected, and it was declared as such in the two base classes.

However in practice many tests in Drupal core prior to Drupal 9.0.0 changed the visibility to public. Over time this problem became worse, mainly because some popular base classes (such as EntityKernelTestBase) were changing this property public, forcing all their child classes to make this property public as well. While there is no harm in making this property public, it is useless and the need to check the actual visibility to use when writing a test was resulting in lost developer time.

Starting with Drupal 9.0.0 this property should now always be protected. In 9.1.0-alpha1 and above, making the property public will cause a deprecation to be thrown.

bbrala commented 1 year ago

Fixed in https://github.com/palantirnet/drupal-rector/pull/210 for rector.

Does this still need work in phpstan? Or is this just done.