<?php

namespace Illuminate\Http\Resources;

use JsonSerializable;
use Illuminate\Support\Collection;

class MergeValue
{
    /**
     * The data to be merged.
     *
     * @var array
     */
    public $data;

    /**
     * Create new merge value instance.
     *
     * @param  \Illuminate\Support\Collection|\JsonSerializable|array  $data
     * @return void
     */
    public function __construct($data)
    {
        if ($data instanceof Collection) {
            $this->data = $data->all();
        } elseif ($data instanceof JsonSerializable) {
            $this->data = $data->jsonSerialize();
        } else {
            $this->data = $data;
        }
    }
}

<?php

namespace Illuminate\Http\Resources;

use JsonSerializable;
use Illuminate\Support\Collection;

class MergeValue
{
    /**
     * The data to be merged.
     *
     * @var array
     */
    public $data;

    /**
     * Create new merge value instance.
     *
     * @param  \Illuminate\Support\Collection|JsonSerializable|array  $data
     * @return void
     */
    public function __construct($data)
    {
        if ($data instanceof Collection) {
            $this->data = $data->all();
        } elseif ($data instanceof JsonSerializable) {
            $this->data = $data->jsonSerialize();
        } else {
            $this->data = $data;
        }
    }
}

--- 
+++ 
@@ -17,7 +17,7 @@
     /**
      * Create new merge value instance.
      *
-     * @param  \Illuminate\Support\Collection|JsonSerializable|array  $data
+     * @param  \Illuminate\Support\Collection|\JsonSerializable|array  $data
      * @return void
      */
     public function __construct($data)
Add leading slash to `JsonSerializable` on docblock

Co-Authored-By: rodrigopedra <9ab0a48cbad7071f1c06b52d0c74cf226c5339e9@gmail.com>