#2540·larastan

NoUnnecessaryCollectionCallRule is not reported when model has docblock properties

Author: chack1172Created Aug 26, 2026Updated Aug 27, 2026
Labelsbug
  • Larastan Version: 3.9.6
  • Laravel Version: 13.x

Description

When a model has his properties defined in the docblock, NoUnnecessaryCollectionCallRule is not reported. This is caused by this line: https://github.com/larastan/larastan/blob/4f9b713a8e728b68f0639a6c26321f88d43c02c7/src/Properties/ModelPropertyHelper.php#L68

Laravel code where the issue was found

php
// app/Models/User.php
/**
 * @property int $id
 */
class User extends \Illuminate\Database\Eloquent\Model {}

// ----
User::all()->pluck('id'); -- No report
User::all()->pluck('email'); -- Reported