djoos / Symfony-coding-standard

Development repository for the Symfony coding standard
MIT License
401 stars 102 forks source link

ReturnOrThrowSniff doesn't handle Closures properly #126

Closed istrof closed 6 years ago

istrof commented 6 years ago

When closure is defined, this sniff should handle code inside closure.

djoos commented 6 years ago

Thanks for your contribution @istrof!

stof commented 6 years ago

Are you sure this works fine for return statements of the main function in code placed after the closure ? I think they would now be attached to the closure rather than the main function (instead of assigning the closure ones to the main function like before)

istrof commented 6 years ago

@stof, you're right, this case is not covered yet. Is there a way in PHPCS to detect closure/function we're currently in?