OblikStudio / kirby-link-field

Links field for Kirby.
MIT License
77 stars 10 forks source link

__toString() can return null and produces type error in PHP 8+ #75

Closed pstaender closed 1 year ago

pstaender commented 1 year ago

Hi @hdodov,

TypeError Oblik\LinkField\Link::__toString(): Return value must be of type string, null returned if href() returns null. It could be fixed in https://github.com/OblikStudio/kirby-link-field/blob/d12257715d804705bc9c0b32369bae47ed3dce00/src/Link.php#L37 with a type cast:

public function __toString()
{
return (string) $this->href();
}

Regards

hdodov commented 1 year ago

Check out version 5.2.2. It should be fixed now.