1
这是执行PHP中的字符串构造函数参数接受的方式:强制执行字符串构造参数
public function __construct($myParameter)
{
if (! is_string($myParameter)) {
throw new InvalidArgumentException('My parameter must be a string');
}
$this->myParameter = $myParameter;
}