Issue #3301205 by Spokje, mondrake, Gábor Hojtsy, quietone, catch, xjm: Replace the test class protected $modules deprecation error with a phpstan-drupal rule

(cherry picked from commit 9d64e97e46)
merge-requests/5366/head
Dave Long 2023-11-11 11:39:22 +00:00
parent a2b3ceec72
commit e0ce28fa3f
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
4 changed files with 3 additions and 8 deletions

View File

@ -23,7 +23,7 @@
"drupal/coder": "^8.3.10",
"instaclick/php-webdriver": "^1.4.1",
"justinrainbow/json-schema": "^5.2",
"mglaman/phpstan-drupal": "^1.2",
"mglaman/phpstan-drupal": "^1.2.1",
"micheh/phpcs-gitlab": "^1.1",
"mikey179/vfsstream": "^1.6.11",
"open-telemetry/exporter-otlp": "^1",

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6de6a531a498d73d06d78800399c841f",
"content-hash": "a13d08162bfae1cd2d3e808e6765474a",
"packages": [
{
"name": "asm89/stack-cors",

View File

@ -15,7 +15,7 @@
"drupal/coder": "^8.3.10",
"instaclick/php-webdriver": "^1.4.1",
"justinrainbow/json-schema": "^5.2",
"mglaman/phpstan-drupal": "^1.2",
"mglaman/phpstan-drupal": "^1.2.1",
"micheh/phpcs-gitlab": "^1.1",
"mikey179/vfsstream": "^1.6.11",
"open-telemetry/exporter-otlp": "^1",

View File

@ -51,11 +51,6 @@ class DrupalListener implements TestListener {
*/
public function startTest(Test $test): void {
$this->symfonyListener->startTest($test);
// Check for incorrect visibility of the $modules property.
$class = new \ReflectionClass($test);
if ($class->hasProperty('modules') && !$class->getProperty('modules')->isProtected()) {
@trigger_error('Declaring ' . get_class($test) . '::$modules with public visibility is deprecated in drupal:9.1.0 and must be declared protected in drupal:10.0.0. See https://www.drupal.org/node/2909426', E_USER_DEPRECATED);
}
}
/**