Improvements
Added generics for table associations as opt-in.
You can enable this by setting 'IdeHelper.assocsAsGenerics'
config to true
.
e.g. WheelsTable:
- * @property \TestApp\Model\Table\CarsTable&\Cake\ORM\Association\BelongsTo $Cars
+ * @property \Cake\ORM\Association\BelongsTo<\TestApp\Model\Table\CarsTable> $Cars
This is designed to work with CakePHP 5.0.3+ and allows PHPStan to better see those associations and their actual type.
The main idea here is that less inline annotations are needed for PHPStan/Psalm to detect those.
Inside Wheels table accessing Owner table methods through Cars:
$result = $this->Cars->Owner->someMethod();
Warning: This does not yet play well with most IDEs. The tradeoff seems to be that you lose IDE compatibility/autocomplete on the table methods here. So use with caution.