PHP5 类型提示
时间:2008-03-11 来源:liuxingyuyuni
?php
/**
* @date Tue Mar 11 01:49:44 CST 2008
* @user BianYuan
* @todo PHP5 类型提示
* */
class DB {
function __construct() {
// DB CONNECT
}
}
class WebApp {
private $DB;
function __construct(DB $db) {
$this->DB = $db;
}
function run() {}
}
$dbLink = new DB();
$misc = null;
$app = new WebApp($misc);
//Catchable fatal error: Argument 1 passed to WebApp::__construct() must be an instance of DB, null given, called in PHPDocument2 on line 21 and defined in PHPDocument2 on line 14
?>
相关阅读 更多 +
排行榜 更多 +