问题
Is there a way to document that a particular function calls exit()
?
The use case is that we have a function that is responsible for handling redirects (checks for already sent headers, set the response code, etc...) and then crucially calls exit()
. Unfortunately, PHPStorm has no idea that this particular function terminates execution and thus suggests further warnings as if this function has returned when in practice, it never would.
回答1:
At the moment it's not possible.
https://youtrack.jetbrains.com/issue/WI-10673 -- watch this ticket (star/vote/comment) to get notified on progress.
ATM I may only suggest placing explicit die()
or exit()
calls after such function calls.
来源:https://stackoverflow.com/questions/31672862/phpdoc-function-exits