You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: while I think it would be good to add a check for this, it should be a warning and the checking for restore_current_blog() should be limited to the scope in which the call to switch_to_blog() is found.
Any such sniff will always have the potential for false positives as a plugin can have a wrapper PluginClass::restore_stuff() function declared in another file and we won't be able to trace the function calls through the code base/across files.
All the same, it is best practice to always call restore_current_blog() after a switch_to_blog()within the same function, so the fact that the sniff has the risk of false positives should not be a deterrent for creating it as the potential for bugs when the call is not made far outweighs the annoyance of false positives from a sniff.
Describe the solution you'd like
From #649 (comment), it would be worth flagging that
restore_current_blog()
should be called subsequently (if not already).What code should be reported as a violation?
What code should not be reported as a violation?
The text was updated successfully, but these errors were encountered: