for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Inspirum\Arrayable;
use function json_encode;
use const JSON_THROW_ON_ERROR;
/**
* @template TKey of array-key
* @template TValue
* @implements \Inspirum\Arrayable\Model<TKey,TValue>
*/
abstract class BaseModel implements Model
{
* @return array<TKey,TValue>
abstract public function __toArray(): array;
public function toArray(): array
return $this->__toArray();
}
public function jsonSerialize(): array
* @throws \JsonException
public function __toString(): string
return json_encode($this->jsonSerialize(), JSON_THROW_ON_ERROR);