mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-30 02:37:58 +08:00
fix code
This commit is contained in:
parent
750dd8e28f
commit
de4f7dfbc0
@ -41,3 +41,5 @@ parameters:
|
||||
- '#Method Hyperf\\Utils\\Serializer\\ScalarNormalizer::denormalize\(\) should return array\|object but returns#'
|
||||
- '#Function get_debug_type invoked with 1 parameter, 0 required#'
|
||||
- '#gc_status not found#'
|
||||
- '#Call to an undefined method Hyperf\\Utils\\HigherOrderCollectionProxy::toMessage().#'
|
||||
- '#Access to an undefined property Hyperf\\Resource\\Json\\JsonResource::\$preserveKeys.#'
|
||||
|
@ -97,7 +97,7 @@ trait ConditionallyLoadsAttributes
|
||||
if (($value instanceof PotentiallyMissing && $value->isMissing()) ||
|
||||
($value instanceof self &&
|
||||
$value->resource instanceof PotentiallyMissing &&
|
||||
$value->isMissing())) {
|
||||
$value->resource->isMissing())) {
|
||||
unset($data[$key]);
|
||||
} else {
|
||||
$numericKeys = $numericKeys && is_numeric($key);
|
||||
|
@ -9,6 +9,7 @@ declare(strict_types=1);
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace Hyperf\Resource\Json;
|
||||
|
||||
use Countable;
|
||||
@ -62,7 +63,9 @@ class ResourceCollection extends JsonResource implements Countable, IteratorAggr
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return $this->collection->map->toArray()->all();
|
||||
/** @var Collection $collection */
|
||||
$collection = $this->collection->map->toArray();
|
||||
return $collection->all();
|
||||
}
|
||||
|
||||
public function toResponse()
|
||||
@ -76,6 +79,9 @@ class ResourceCollection extends JsonResource implements Countable, IteratorAggr
|
||||
|
||||
public function toMessage()
|
||||
{
|
||||
return $this->collection->map->toMessage()->all();
|
||||
/** @var Collection $collection */
|
||||
$collection = $this->collection->map->toMessage();
|
||||
|
||||
return $collection->all();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user