February’s release replaces the get-and-set method pair with a single method returning an Attribute object.
// 8.x
public function getFullNameAttribute(): string
{
return $this->first_name . ' ' . $this->last_name;
}
public function setFullNameAttribute(string $v): void { /* ... */ }
// 9.x
protected function fullName(): Attribute
{
return Attribute::make(
get: fn () => $this->first_name . ' ' . $this->last_name,
set: fn (string $v) => $this->split($v),
);
}
The old syntax still works and is not deprecated, so this is an option rather than a migration. The genuine improvement is Attribute::make(...)->shouldCache() for an accessor doing real work, which had no equivalent before — an accessor computing something expensive was recomputed on every read, including inside a loop over a collection.