This commit is contained in:
2020-12-15 17:17:10 +08:00
parent c8d9cfee40
commit 51b831f9ee
+18 -18
View File
@@ -49,16 +49,16 @@ use Snowflake\Snowflake;
class Controller extends Application class Controller extends Application
{ {
/** @var HttpParams $input */ /** @var null|HttpParams $input */
public HttpParams $input; public null|HttpParams $input;
/** @var HttpHeaders */ /** @var null|HttpHeaders */
public HttpHeaders $headers; public null|HttpHeaders $headers;
/** @var Request */ /** @var null|Request */
public Request $request; public null|Request $request;
/** /**
@@ -71,34 +71,34 @@ class Controller extends Application
} }
/** /**
* @param HttpParams $input * @param null|HttpParams $input
*/ */
public function setInput(HttpParams $input): void public function setInput(?HttpParams $input): void
{ {
$this->input = $input; $this->input = $input;
} }
/** /**
* @param HttpHeaders $headers * @param ?HttpHeaders $headers
*/ */
public function setHeaders(HttpHeaders $headers): void public function setHeaders(?HttpHeaders $headers): void
{ {
$this->headers = $headers; $this->headers = $headers;
} }
/** /**
* @param Request $request * @param ?Request $request
*/ */
public function setRequest(Request $request): void public function setRequest(?Request $request): void
{ {
$this->request = $request; $this->request = $request;
} }
/** /**
* @return HttpParams * @return ?HttpParams
* @throws Exception * @throws Exception
*/ */
public function getInput(): HttpParams public function getInput(): ?HttpParams
{ {
if (!$this->input) { if (!$this->input) {
$this->input = $this->getRequest()->params; $this->input = $this->getRequest()->params;
@@ -107,10 +107,10 @@ class Controller extends Application
} }
/** /**
* @return HttpHeaders * @return ?HttpHeaders
* @throws Exception * @throws Exception
*/ */
public function getHeaders(): HttpHeaders public function getHeaders(): ?HttpHeaders
{ {
if (!$this->headers) { if (!$this->headers) {
$this->headers = $this->getRequest()->headers; $this->headers = $this->getRequest()->headers;
@@ -122,7 +122,7 @@ class Controller extends Application
* @return Request * @return Request
* @throws Exception * @throws Exception
*/ */
public function getRequest(): Request public function getRequest(): ?Request
{ {
if (!$this->request) { if (!$this->request) {
$this->request = Snowflake::app()->request; $this->request = Snowflake::app()->request;
@@ -136,7 +136,7 @@ class Controller extends Application
* @return mixed * @return mixed
* @throws ComponentException * @throws ComponentException
*/ */
public function __get($methods) public function __get($methods): mixed
{ {
// TODO: Change the autogenerated stub // TODO: Change the autogenerated stub
if (property_exists($this, $methods)) { if (property_exists($this, $methods)) {