Describe the bug
The Squiz.Commenting.FunctionComment sniff truncates class name if it contains underscores.
Code sample
/**
* @return integer|WP_Error
*/
function test()
{
return 0;
}
Custom ruleset
<?xml version="1.0"?>
<ruleset name="CS">
<rule ref="Squiz.Commenting.FunctionComment"/>
</ruleset>
To reproduce
Steps to reproduce the behavior:
- Create a file called
test.php with the code sample above
- Run
phpcbf test.php
- Check out the modified code. It corrected the
integer type to int, but it truncated the class name WP_Error to just WP:
/**
* @return int|WP
*/
function test()
{
return 0;
}
Expected behavior
The code after modification should look like:
/**
* @return int|WP_Error
*/
function test()
{
return 0;
}
Versions (please complete the following information)
|
|
| Operating System |
macOS 15.6 |
| PHP version |
8.4.7 |
| PHP_CodeSniffer version |
3.13.0 |
| Standard |
Squiz |
| Install type |
Composer |
Please confirm
Describe the bug
The
Squiz.Commenting.FunctionCommentsniff truncates class name if it contains underscores.Code sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.phpwith the code sample abovephpcbf test.phpintegertype toint, but it truncated the class nameWP_Errorto justWP:Expected behavior
The code after modification should look like:
Versions (please complete the following information)
Please confirm
masterbranch of PHP_CodeSniffer.