Make logic more explicit

This tightens up the rules of 7baea87068e496d83d6afd46fccee699779cb2ad
This commit is contained in:
Samuel Georges 2016-07-23 15:50:48 +10:00
parent c70db75d38
commit 78a4067564
2 changed files with 8 additions and 8 deletions

View File

@ -449,16 +449,16 @@ class Controller extends Extendable
/*
* If the handler returned an array, we should add it to output for rendering.
* If it is a scalar, add it to the array with the key "result".
* Otherwise, pass it to Laravel as a response object.
* If it is a string, add it to the array with the key "result".
* If an object, pass it to Laravel as a response object.
*/
if (is_array($result)) {
$responseContents = array_merge($responseContents, $result);
}
elseif (is_scalar($result)) {
elseif (is_string($result)) {
$responseContents['result'] = $result;
}
elseif ($result !== null) {
elseif (is_object($result)) {
return $result;
}

View File

@ -648,16 +648,16 @@ class Controller
/*
* If the handler returned an array, we should add it to output for rendering.
* If it is a scalar, add it to the array with the key "result".
* Otherwise, pass it to Laravel as a response object.
* If it is a string, add it to the array with the key "result".
* If an object, pass it to Laravel as a response object.
*/
if (is_array($result)) {
$responseContents = array_merge($responseContents, $result);
}
elseif (is_scalar($result)) {
elseif (is_string($result)) {
$responseContents['result'] = $result;
}
elseif ($result !== null) {
elseif (is_object($result)) {
return $result;
}