问题描述
是否可以记录特定函数调用的exit()
?
Is there a way to document that a particular function calls exit()
?
用例是我们有一个函数负责处理重定向(检查已发送的标头,设置响应代码等),然后关键地调用exit()
.不幸的是,PHPStorm不知道此特定功能会终止执行,因此会提出进一步的警告,好像该功能在实践中已经返回时一样.
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.
推荐答案
目前不可能.
https://youtrack.jetbrains.com/issue/WI-10673 - -观看此票(星号/投票/评论)以获取进度通知.
https://youtrack.jetbrains.com/issue/WI-10673 -- watch this ticket (star/vote/comment) to get notified on progress.
ATM我可能只建议在此类函数调用之后放置显式的die()
或exit()
调用.
ATM I may only suggest placing explicit die()
or exit()
calls after such function calls.
这篇关于PHPDoc-函数退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!