public function equals(self $that): bool
    {
        if (get_class($this) !== get_class($that)) {
            throw new CannotCompareDifferentIds;
        }
        return $this->id === $that->id;
    }
public function equals(self $that): bool
    {
        if (get_class($this) !== get_class($that)) {
            throw new CannotCompareDifferentIds;
        }
        return $this->id === $that->id;
    }
public function equals ( self $ that ) : bool { if ( get_class ( $ this ) !== get_class ( $ that ) ) { throw new CannotCompareDifferentIds ; } return $ this -> id === $ that -> id ; }
compare two Id instances for equality

Ids are considered equal if they are of the same
type and contain the same underlying string
representations

@param self $that
@return bool
@throws CannotCompareDifferentIds
compare two Id instances for equality