Description
Description
A WARNING is thrown for sniff "Empty FUNCTION statement detected"
This warning should not be through if the empty function is an around
plugin. A common use-case for around plugins is to prevent execution of the original calling method. For example:
public function aroundPrepareFavicon(Renderer $subject, callable $proceed)
{
// Do not call $proceed() to remove favicon code
}
Expected behavior
I would expect this sniff to still run and throw a WARNING in all circumstances other than an around
plugin. The sniff should not throw a WARNING for an around
plugin.
A consideration may be to mandate the use of a comment for an around
plugin with an empty function statement. This would ensure that the empty around
plugin not calling the callable $proceed
is desired. See above for an example comment which explains why this around
plugin is empty.
Benefits
Empty around
plugins are not only valid but this is a common use-case. The sniff should not detect this as an error. A comment within an empty around
plugin would also most likely be desired and document to the user why this around
function is empty.