Skip to content

Instantly share code, notes, and snippets.

@shimabox
Last active August 17, 2022 00:54
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shimabox/5519549 to your computer and use it in GitHub Desktop.
Save shimabox/5519549 to your computer and use it in GitHub Desktop.
phpDocumentorのちょっとしたサンプル
<?php
/**
* PHPDocumentorのちょっとしたサンプル
* @author shimabox
*/
/**
* require
*/
require_once './Interfaces/IHoge.php';
/**
* Hogeですよ〜ん
* @package Sample
* @subpackage PhpDocumentor
*/
class Hoge implements IHoge
{
/**
* hoge property<br>説明が長くなりそうなら<b>改行タグ</b>入れるといい
* @var string
*/
protected $hoge = 'hoge';
/**
* コンストラクタだぞ<br>説明が長くなりそうなら<b>改行タグ</b>入れるといい と思ったけどここ(メソッドの説明)はそのままタグがでるぞ
*/
public function __construct()
{
}
/**
* hogehogeするぞ
* @return string
*/
public function hoge()
{
return $this->hoge;
}
/**
* piyopiyoするぞ
* @param string ピヨピヨしたい値<br>
* 説明が長くなりそうなら<b>改行タグ</b>入れるといい<br>
* paramの場所は改行の後無駄なスペースが入る<br>
* pタグで囲まれるし、div.element div.subelement > p にmargin入ってる
* @return string 値を受け取ってpiyoする<br>
* 説明が長くなりそうなら<b>改行タグ</b>入れるといい<br>
* returnの場所は改行の後無駄なスペースが入らない<br>
* paramと違ってpタグで囲まれない
*/
public function piyo($piyo='piyo')
{
return 'piyo::' . $piyo;
}
/**
* fugafugaするぞ
* @return void
*/
protected function fuga()
{
}
}
/**
* {@inheritdoc}
*
* {@inheritdoc} と書くと親クラスのコメントを参照してくれるみたい
*
* HogeChildです
* @package Sample
* @subpackage PhpDocumentor
*/
class HogeChild extends Hoge
{
/**
* hogehogeするぞ overrideは@seeを使うみたい
* @see Hoge::hoge()
* @return string
*/
public function hoge()
{
return 'hogechild';
}
}
<?php
/**
* PHPDocumentorのちょっとしたサンプル
* @author shimabox
*/
/**
* Hoge Interface
*
* @author shimabox
* @package Sample
* @subpackage PhpDocumentor\Interfaces
*/
interface IHoge
{
/**
* hogehogeするぞ
* @return string
*/
public function hoge();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment