Skip to content

Conversation

oligriffiths
Copy link

Currently, this sniff incorrectly fails for locally scoped named method like:

public function test() { function my_sort() { // do stuff } $a = array(); usort($a, 'my_sort'); }

This patch checks if the method is defined within the scope of another method

@gsherwood gsherwood changed the title Updated Squiz_Sniffs_Scope_MethodScopeSniff to handle methods … Squiz MethodScopeSniff doesn't handle nested functions Sep 20, 2015
@gsherwood
Copy link
Member

I couldn't merge this PR in because there was already a core function to help with this (see the commit that fixes the problem) so I used a different method of fixing it. But thank you for submitting this PR and reporting the problem.

@gsherwood gsherwood closed this Sep 20, 2015
jrfnl added a commit to jrfnl/PHP_CodeSniffer that referenced this pull request Nov 27, 2024
…ning-function-brace-kernighan-ritchie Generic/OpeningFunctionBraceKernighanRichie: improve test coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants