Questions tagged «docblocks»

2
如何为IDE记录魔术(_call和_callStatic)方法
在用记事本++和sublime进行了许多快乐的编码之后,建议我尝试使用PHP IDE。我正在尝试phpStorm,看起来不错。代码完成和文档是一个很棒的功能,但是当使用魔术方法时,对我来说却行不通。是否有解决方法使phpStorm了解魔术方法的状况? 我们的情况是这样的: abstract class a { public static function __callStatic($method,$args) { if(strpos($method,"get_by_") === 0) { //do stuff } elseif(strpos($method,"get_first_by_") === 0) { //do stuff } elseif($method == "get_all") { //do stuff } } } class b extends a { // some more stuff } b::get_by_user_id(27); b::get_first_by_id(156); b::get_all(); 神奇的callStatic方法使我们能够通过1个或多个组成函数调用的参数来获取对象的集合。 我看到在这些情况下有一个@method语句可以使用,但是phpStorm仅选择了这些语句中的第一个。此外,我只能将返回类型设置为“ …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.