-
Notifications
You must be signed in to change notification settings - Fork 43
Closed
Description
Bug Description
AlwaysReturnSniff doesn't actually trigger if the filter function doesn't include the return statement anywhere.
We have a bunch of tests to ensure AlwaysReturnSniff flags various problematic ways of returning from inside WP filters, but there is no test that ensures it raises a flag when return is omitted entirely.
Minimal Code Snippet
add_filter( 'bad_example_closure_with_no_returns', function( $input ) {
$input = $input . ' hello!';
// But we never return _anywhere_
}, 10, 2 );Error Code
WordPressVIPMinimum.Filters.AlwaysReturn.missingReturnStatement
Environment
Use php -v and composer show to get versions.
| Question | Answer |
|---|---|
| PHP version | 7.1.19 |
| PHP_CodeSniffer version | 3.3.2 |
| VIPCS version | master |
Tested Against master branch?
- I have verified the issue still exists in the
masterbranch of VIPCS.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels