smartemailing/types

View on GitHub
src/Comparable/StringComparableTrait.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

declare(strict_types = 1);

namespace SmartEmailing\Types\Comparable;

use SmartEmailing\Types\ToStringInterface;

trait StringComparableTrait
{

    public function equals(
        mixed $that
    ): bool
    {
        return $this instanceof ToStringInterface &&
            $that instanceof ToStringInterface &&
            \get_class($that) === static::class &&
            (string) $this === (string) $that;
    }

}