Skip to content

Instantly share code, notes, and snippets.

@shigemk2

shigemk2/throws.php

Created Feb 21, 2013
Embed
What would you like to do?
phpdocのthrowsの簡単な使い方
<?php
/**
* このメソッドは適当に作りました
*
* @param[in] $hoge
* @return 対応する配列
* @throws Exception 対応するデータがない場合
*/
public function hoge($hoge = '') {
if(! isset($array[$hoge])) {
throw new Exception('データがありません。');
}
return $array[$hoge];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment