There needs to be a way to tell PHPCS that the function is an AJAX-callback so that it generates warnings about duplicate @param documentation.
Considering the PHPCS warning:
phpcs: Hook implementations should not duplicate @param documentation
It should be able to warn like:
phpcs: Callback implementations should not duplicate @param documentation
I mean, I know it's as simple as implementing hooks except that instead of "Implements hook_
", the PHPDoc starts with "Implements callback_
";
The only problem is that currently (August 2019) it is not supported by Drupal's PHPCS standard and you don't get any warnings yet.
Source:
In Drupal's Official-documentation of August 2019, we can find below Callback implementation:
/**
* Implements callback_batch_finished().
*/
function _node_mass_update_batch_finished($success, $results, $operations) {
// ...
}
Note: Unlike hooks, any callback starts with an underscore (i.e. it is "_MYMODULE_descreptive_name
").
---
(In addition, it would be nice if we got warned when a callback implementation that is outside of any class has no underscore prefix)
Comments
Comment #2
Top-master CreditAttribution: Top-master commentedThere is also a question about this posted on Stack-overflow, which could be updated after this is resolved.
Comment #3
Top-master CreditAttribution: Top-master commented