Problem/Motivation
In core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php, there are incorrect and misleading docblocks for class properties.
/**
* The typed configuration manager used for testing.
*
* @var \Drupal\Core\Config\TypedConfigManagerInterface|\PHPUnit\Framework\MockObject\Stub
*/
protected $typedConfigManager;
/**
* The typed configuration manager used for testing.
*
* @var \Drupal\Core\Config\Entity\ConfigEntityStorage
*/
protected $configEntityStorageInterface;
Both properties have identical descriptions, but represent different types:
* $typedConfigManager correctly references TypedConfigManagerInterface (with a mock/stub).
* $configEntityStorageInterface incorrectly describes itself as a "typed configuration manager" while its actual type is ConfigEntityStorage.
This inconsistency reduces code clarity and may confuse developers and static analysis tools.
Steps to reproduce
1. Open the file: core/modules/language/tests/src/Unit/ContentLanguageSettingsUnitTest.php
2. Locate the following properties:
* $typedConfigManager
* $configEntityStorageInterface
3. Observe that both docblocks describe the same purpose despite different types.
Proposed resolution
Update the docblock for $configEntityStorageInterface to accurately reflect its purpose and type.
For example:
/**
* The config entity storage used for testing.
*
* @var \Drupal\Core\Config\Entity\ConfigEntityStorage
*/
protected $configEntityStorageInterface;
Ensure the description matches the actual responsibility of the property.
Remaining tasks
None.
User interface changes
None.
---
Introduced terminology
None.
API changes
None.
Data model changes
None.
Release notes snippet
None.
Issue fork drupal-3582122
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3582122-incorrect-docblock-for
changes, plain diff MR !15275
Comments
Comment #2
sivaji_ganesh_jojodae commentedComment #3
sivaji_ganesh_jojodae commentedComment #4
sivaji_ganesh_jojodae commentedComment #7
shubham.prakash commentedComment #8
sivaji_ganesh_jojodae commentedThe MR looks fine but the Pipeline has failed. I've requested for re-run. +1 for the fix.
Comment #9
smustgrave commentedThis is just in the language module.
But this is the type of ticket that could be scoped more broadly vs by file or by module.
Can you do that search please.
Comment #10
smustgrave commentedActually better component
Comment #11
sivaji_ganesh_jojodae commentedFYI, this was identified while reviewing the MR for #3581407: Remove unused properties from unit tests. I haven’t verified whether similar incorrect property documentation exists elsewhere in core.
If this is a recurring pattern, the scope of the issue could potentially be expanded; otherwise, this can remain a targeted fix.
Comment #12
sivaji_ganesh_jojodae commentedComment #13
smustgrave commentedThink a search should be done else these little issues that aren’t addressing anything can come off spamy
Comment #14
smustgrave commentedLeft this for almost 2 months hoping a bigger search was done but will see what committers think
Comment #17
amateescu commentedI'm not sure how easy it would be to search for mistakes like this, but I think it's a good task for a novice :)
Committed a59fd7d to main and 3ba1907 to 11.x. Thanks!