Replies: 3 comments 2 replies
-
Thank you for opening this. |
Beta Was this translation helpful? Give feedback.
-
It does check the types, and it is necessary to be able to assign a readable type to a database column backed attribute (accessor). For computed properties (an attribute without a database column) you can explicitly set the type to /** @return Attribute<string[], never> */
protected function typeName(): Attribute
{
return Attribute::make(
get: fn (): string => self::TYPE_MAP[$this->media_type],
);
} or use the /** @return Attribute<string[], never> */
protected function typeName(): Attribute
{
return Attribute::get(
fn (): string => self::TYPE_MAP[$this->media_type],
);
} There's nothing to be done here |
Beta Was this translation helpful? Give feedback.
-
@egege means that the type in docblock and in |
Beta Was this translation helpful? Give feedback.
-
Following the link below,I have written some code, but it seems that it doesn't check the return types of the get or set functions for Attributes.
https://github.com/larastan/larastan/blob/2.x/docs/features.md
screenshot as follows
Beta Was this translation helpful? Give feedback.
All reactions