我注意到调用 hh_client 并不总是返回正确的结果。例如:我有以下代码:
后端\ConvertMessage.hh:
<?hh // strict
namespace ApiBackend\ConvertMessage {
enum Status: int {
success = 0;
// ... error codes
};
// ... some other classes
};
项目中的其他地方:
throw new \SoapFault(
'Server',
\ApiBackend\ConvertMessage\Status::getNames()[$result->status]
);
有时,在对项目进行一些更改后,我会收到以下错误消息:Could not find static method getNames in type ApiBackend\ConvertMessage\Status (Typing[4090])
当我在一个右大括号后删除分号时,hh_client 停止显示错误。但是当我在它的位置插入分号时,类型检查器仍然给我No errors!
消息。
这不是导致此问题的唯一文件 - 它发生在所有枚举中。
在我看来,hh_client 或 hh_server 的某些缓存有问题。
提前感谢您帮助我解决了这个问题(如果我的英语不太好,我很抱歉)。