moved a test in the constructor

This commit is contained in:
Fabien Potencier 2011-12-21 18:53:18 +01:00
parent e44b8ba521
commit 8717d4425e

View File

@ -45,6 +45,10 @@ class StreamedResponse extends Response
parent::__construct(null, $status, $headers);
$this->callback = $callback;
if (!is_callable($this->callback)) {
throw new \LogicException('The Response callback must be a valid PHP callable.');
}
$this->streamed = false;
}
@ -76,10 +80,6 @@ class StreamedResponse extends Response
$this->streamed = true;
if (!is_callable($this->callback)) {
throw new \LogicException('The Response callback is not a valid PHP callable.');
}
call_user_func($this->callback);
}