smartemailing/types

View on GitHub
src/Comparable/ArrayComparableTrait.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

declare(strict_types = 1);

namespace SmartEmailing\Types\Comparable;

use SmartEmailing\Types\ToArrayInterface;

trait ArrayComparableTrait
{

    public function equals(
        mixed $that
    ): bool
    {
        return $this instanceof ToArrayInterface &&
            $that instanceof ToArrayInterface &&
            \get_class($that) === static::class &&
            $this->toArray() === $that->toArray();
    }

}