phpDocã§arrayã®ä¸èº«ãæ示ãã[PHP][PHPDoc]
軽ãTipså ±æãã
çããPHPDocãæ¸ãã¦ã¾ãã§ããããï¼
IDEã¨ãã ã¨ç¹ã«ã¸ã£ã³ãåãè£å®çãããå¹ãããã«ãªãããããã親åãªã³ã¼ãã«ãªãã¨æãã®ã§å²ã¨ç©æ¥µçã«æ¸ãããã«ãã¦ãã¾ãã
ä»åã¯ãã®PHPDocããã¿ã§ç¥ã£ãå°ãã¿ã®ãç´¹ä»ã§ãã ã¾ããä»åã¯PHPDocã§ã¯ãªãphpDocumentoråæãªè©±ã§è¡ããã¨æãã¾ãããããããã
phpDocumentor - PHPDocに代わるAPIドキュメント自動生成ツール - Do You PHP? ãã®ããããåèã«ãªããã¨æãã¾ãã
ã¾ããã°ãã°é åãå¼æ°ã«åã£ããå¤æ°ã«æ ¼ç´ããããããå ´åãããã¾ãããã
ããããæãä»ã¾ã§ã¯
<?php /** @var array $hoge */ $hoge = [1,2,3,4,5]; //ã¨ã /** * @param array $hoge * @return array */ public function fuga(array $hoge) { return $hoge; }
ã¨ãæ¸ãã¦ããã®ã§ãããããã ã¨arrayã®ä¸èº«ã¯ãªãã ãã£ã¦ãªããã¡ã§ãã
å®ã¯phpDocã¯ãã®æ©ã¿ãä¸å¿ãµãã¼ããã¦ãã¦ã次ã®ããã«ããã¾ãã
<?php /** @var int[] $hoge */ $hoge = [1,2,3,4,5]; //ã¨ã /** * @param int[] $hoge * @return int[] */ public function fuga(array $hoge) { return $hoge; }
åè: http://www.phpdoc.org/docs/latest/guides/types.html#arrays
å°å³ã«ããééããã®ã§ã使ã£ã¦ã¿ãã¨è¯ãããããã¾ãã:)