packagist dereuromark/cakephp-ide-helper 2.1.0

latest releases: dev-master, dev-dereuromark-patch-1, dev-better-event-method-annotation...
9 months ago

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.

Don't miss a new cakephp-ide-helper release

NewReleases is sending notifications on new releases.