Skip to content

laravel/attribute-accessors-mutators bugs #76

Open
@mortenscheel

Description

@mortenscheel

Desktop:

  • OS: Windows
  • OS Version: 11
  • App Version: 0.8.3

Describe the bug

  • The build crashes if the accessor/mutator method is required by an interface the model implements. It would probably be best if it just skips those without changing anything.
  • If Arr::set() is used in the mutator, something weird happens:
public function getFooAttribute($value)
{
    return $value;
}

public function setFooAttribute($value)
{
    Arr::set($this->attributes, 'foo', $value);
}

// Result:
protected function foo(): Attribute
{
    return new Attribute(
        get: fn ($value) => $value,
        set: function ($value) {
            Arr::set($this->attributes, 'foo', $value);
            return [
                ,
            ];
        },
    );
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions