2017-06-02 5 views
0

私は常にphpdocのブロックでコロンを使用しています。たとえば、代わりの:コロン(例)でタグを閉じるとPHPdocに違いがありますか?

/** Some comment 
* 
*@private 
* 
*@param string $sTable The name of the table 
*@return bool True otherwise void 
*@example className->tableExists($sTable); 
*@since date 
*/ 

代わりに上記の、私は次のスタイルを使用します。

/** Some comment 
* 
* @private 
* 
* @param : string $sTable The name of the table 
* @return : bool True otherwise void 
* @example : className->tableExists($sTable); 
* @since : date 
*/ 

あなたが見る、私はコロンとタグや説明を分割することを好みます。読みやすく、スタイルも豊かです。しかし、これはPHPdocがdocblocをまったく解析するのに違いがあるのだろうか?

答えて

2

PHPDocumentorではかなりの違いがあります。 enter image description here

そのままofcourseのそれはその方法であることを多少論理的である enter image description here

/** 
* Test constructor. 
* @param string $var testvar 
* 
*/ 

出力:テストは、以下の

/** 
* Test constructor. 
* @param : string $var testvar 
* 
*/ 

はに文書化されます示してい構文エラー。 docblockを見栄え良くしたい場合は、値をスペースに揃えることができます。

/** Some comment 
* 
*@private 
* 
*@param string $sTable The name of the table 
*@return bool|void  True otherwise void 
*@example className->tableExists($sTable); 
*@since date 
*/ 
+0

DocBlockタグは、このような視覚的な書式設定のためのスペースを使用すると推定されているため、このようなコロンを処理できるドキュメントジェネレータプログラムはありません。 PhpDocumentorは確かにしません。 – ashnazg

0

PHPDoc自体についてはわかりませんが、一部のIDEには違いがあります。私はPHPStormでこれを試しましたが、@param@varは影響を受けませんでしたが、@returnは失敗しました。

私は非標準のフォーマットを使用して慎重になります。

関連する問題