We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--level
Larastan does not see properties that have been checked through the interface
use Illuminate\Database\Eloquent\Model; /** * @property-read string $url */ interface Page { public function getUrlAttribute(): string; } class News extends Model implements Page { public function getUrlAttribute(): string { return '/news/foo/'; } } function test(Model $model): array { $data = []; if ($model instanceof Page) { $data[] = $model->url; // Access to an undefined property Illuminate\Database\Eloquent\Model&Page::$url } return $data; }
The text was updated successfully, but these errors were encountered:
Try using an Accessor https://laravel.com/docs/10.x/eloquent-mutators#accessors-and-mutators
Then add PHP generics
/** * @return \Illuminate\Database\Eloquent\Casts\Attribute<string, never> */
Sorry, something went wrong.
Properties cannot be defined on interfaces https://phpstan.org/r/f14d865c-30c1-4075-9050-8b11086c1811
Update: link to PHPStan issue phpstan/phpstan#8550
No branches or pull requests
--level
used: 2Description
Larastan does not see properties that have been checked through the interface
Laravel code where the issue was found
The text was updated successfully, but these errors were encountered: