$addOnId
and understand that the PHPDocs supplement the other arguments without native type hints.public static function isAddOnActive(
string $addOnId,
int|null $versionId = null,
string|null $operator = '>='
): int|bool
Can you clarify which static analyzer does not merge native type hints with PHPDoc?
<?php
class XF
{
/**
* @param int|null $versionId
* @param string|null $operator
*
* @return int|bool
*/
public static function isAddOnActive(
string $addOnId,
$versionId = null,
$operator = '>='
)
{
return false;
}
}
PHP Docblock Checker by Dan Cryer (https://www.dancryer.com)
F 1/1 (100%)
Checked 1 files in 0.03 seconds.
0 Passed / 1 Errors / 1 Warnings
ERROR src/XF.php:3 - Class \XF is missing a docblock.
WARNING \XF::isAddOnActive - @param $addOnId missing.
FILE: /tmp/xenforo/src/XF.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 36 ERRORS AFFECTING 16 LINES
------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [ ] Doc comment for parameter $versionId does not match actual variable name $addOnId
7 | ERROR | [ ] Missing parameter comment
7 | ERROR | [ ] Doc comment for parameter $operator does not match actual variable name $versionId
I am fine if there is no PHPDoc (for parameters) at all in this case - but if it is there it IMHO should correctly list all parameters to avoid issues like those posted above.If the method were introduced in a version with PHP 8.0 as a minimum, the PHPDoc would have been omitted entirely
$addOnId
in the PHPDoc results in the correct behavior?We use essential cookies to make this site work, and optional cookies to enhance your experience.